Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Linter
on: [push]

jobs:

black:
runs-on: ubuntu-22.04
steps:
Expand All @@ -21,13 +20,13 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
cache: "pip" # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name : Check import order
run : isort . -c
- name: Check import order
run: isort . -c

flake8:
runs-on: ubuntu-22.04
Expand All @@ -37,7 +36,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
cache: "pip" # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -47,7 +46,7 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# option --exit-zero can be added to this line to set these errors as warnings
flake8 . --count --statistics --config setup.cfg
flake8 . --count --statistics

mypy:
runs-on: ubuntu-22.04
Expand All @@ -57,10 +56,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
cache: "pip" # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name : Lint with mypy
run : mypy . -v
- name: Lint with mypy
run: mypy . -v
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,7 @@ cython_debug/
# generate documentation
docs/*.html
docs/*.js
docs/example/
docs/example/

# UV
uv.lock
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Pollen Robotics
Copyright 2025 Pollen Robotics

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
49 changes: 47 additions & 2 deletions pyproject.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next step, replace black with Ruff :)

Original file line number Diff line number Diff line change
@@ -1,9 +1,54 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "example"
version = "0.1.0"
authors = [{ name = "Pollen Robotics", email = "contact@pollen-robotics.com" }]
description = "Python template project"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["numpy>1.25.1"]

[project.optional-dependencies]
dev = [
"black==25.1.0",
"flake8==7.2.0",
"Flake8-pyproject==1.2.3",
"pytest==8.3.5",
"coverage==7.8.0",
"mypy==1.15.0",
"isort==6.0.1",
"pdoc==15.0.1",
"pydocstyle==6.3.0",
]

[project.scripts]
example_entry_point = "example.celcius:main"
camera_entry_point = "example.cam_config:main"

[tool.flake8]
exclude = ["tests", ".venv"]
max-line-length = 128
extend-ignore = ["E203"]
max-complexity = 10

[tool.coverage.run]
branch = true

[tool.coverage.report]
show_missing = true

[tool.mypy]
ignore_missing_imports = true
exclude = ["tests"]
strict = true
plugins = ["numpy.typing.mypy_plugin"]
explicit_package_bases = true

[tool.isort]
profile = "black"

[tool.black]
line-length = 128
line-length = 128
59 changes: 0 additions & 59 deletions setup.cfg

This file was deleted.

16 changes: 8 additions & 8 deletions src/config_files/CONFIG_IMX296.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"socket_to_name": {
"CAM_B": "right",
"CAM_C": "left"
},
"inverted": false,
"fisheye": true,
"mono": false
}
"socket_to_name": {
"CAM_B": "right",
"CAM_C": "left"
},
"inverted": false,
"fisheye": true,
"mono": false
}
14 changes: 14 additions & 0 deletions src/example/cam_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import json
import logging
from importlib.resources import files
from typing import Any, List

Expand Down Expand Up @@ -78,3 +79,16 @@ def get_config_file_path(name: str) -> Any:
if file.stem == name:
return file.resolve()
return None


def main() -> None:
"""The main function that demonstrates the usage of the CamConfig class.

This function creates an instance of the CamConfig class, reads the camera configuration
data from a JSON file, and prints the configuration details. It also activates logging at
the INFO level.
"""
logging.basicConfig(level=logging.INFO)

cam_conf = CamConfig(get_config_file_path("CONFIG_IMX296"))
logging.info(cam_conf.to_string())