From d083d3f9715e2a579227d4efb253970752ce3317 Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Mon, 31 Mar 2025 17:31:16 +0200 Subject: [PATCH 1/3] enhancement #45: remove setup.cfg --- LICENSE | 2 +- pyproject.toml | 49 +++++++++++++++++++++++- setup.cfg | 59 ----------------------------- src/config_files/CONFIG_IMX296.json | 16 ++++---- src/example/cam_config.py | 14 +++++++ 5 files changed, 70 insertions(+), 70 deletions(-) delete mode 100644 setup.cfg diff --git a/LICENSE b/LICENSE index 2822e0f..2bae156 100644 --- a/LICENSE +++ b/LICENSE @@ -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. diff --git a/pyproject.toml b/pyproject.toml index 3fa7277..73e6ccb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] +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 \ No newline at end of file +line-length = 128 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ad79521..0000000 --- a/setup.cfg +++ /dev/null @@ -1,59 +0,0 @@ -[metadata] -name = example -version = 0.1.0 -author = Pollen Robotics -author_email = contact@pollen-robotics.com -url = https://github.com/pollen-robotics/python-template -description = Python template project -long_description = file: README.md -long_description_content_type = text/markdown - - -[options] -packages = find: -zip_safe = True -include_package_data = True -package_dir= - =src -install_requires = - numpy==1.25.1 - -[options.packages.find] -where=src - -[options.package_data] -config_files = - *.json - -[options.extras_require] -dev = black==24.10.0 - flake8==7.1.1 - pytest==7.4.3 - coverage==7.3.2 - mypy==1.8.0 - isort==5.13.2 - pdoc==14.7.0 - pydocstyle==6.3.0 - -[options.entry_points] -console_scripts = - example_entry_point = example.celcius:main - -[flake8] -exclude = tests -max-line-length = 128 -extend-ignore = E203 -max-complexity = 10 - -[coverage:run] -branch=True - -[coverage:report] -show_missing=True - -[mypy] -ignore_missing_imports = True -exclude = tests -strict = True -plugins = numpy.typing.mypy_plugin -explicit_package_bases = True \ No newline at end of file diff --git a/src/config_files/CONFIG_IMX296.json b/src/config_files/CONFIG_IMX296.json index 17e0393..0cb0945 100644 --- a/src/config_files/CONFIG_IMX296.json +++ b/src/config_files/CONFIG_IMX296.json @@ -1,9 +1,9 @@ { - "socket_to_name": { - "CAM_B": "right", - "CAM_C": "left" - }, - "inverted": false, - "fisheye": true, - "mono": false -} \ No newline at end of file + "socket_to_name": { + "CAM_B": "right", + "CAM_C": "left" + }, + "inverted": false, + "fisheye": true, + "mono": false +} diff --git a/src/example/cam_config.py b/src/example/cam_config.py index d3caf8c..5217c4b 100644 --- a/src/example/cam_config.py +++ b/src/example/cam_config.py @@ -6,6 +6,7 @@ """ import json +import logging from importlib.resources import files from typing import Any, List @@ -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()) From fc4e59accc30deee06c70491f804a242c4c21eaa Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Mon, 31 Mar 2025 17:51:48 +0200 Subject: [PATCH 2/3] enhancement #45: remove use of setup.cfg in CI --- .github/workflows/lint.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 120f760..ee642a6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,6 @@ name: Linter on: [push] jobs: - black: runs-on: ubuntu-22.04 steps: @@ -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 @@ -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 @@ -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 @@ -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 From f9805f8e99d65d5454c7b6e63288d529e2bfd063 Mon Sep 17 00:00:00 2001 From: Pierre Rouanet Date: Mon, 12 May 2025 15:31:40 +0200 Subject: [PATCH 3/3] Update config to work with uv --- .gitignore | 5 ++++- pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 66a6599..4327078 100644 --- a/.gitignore +++ b/.gitignore @@ -167,4 +167,7 @@ cython_debug/ # generate documentation docs/*.html docs/*.js -docs/example/ \ No newline at end of file +docs/example/ + +# UV +uv.lock \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 73e6ccb..c7a4e72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ 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"] +dependencies = ["numpy>1.25.1"] [project.optional-dependencies] dev = [ @@ -29,7 +29,7 @@ example_entry_point = "example.celcius:main" camera_entry_point = "example.cam_config:main" [tool.flake8] -exclude = ["tests"] +exclude = ["tests", ".venv"] max-line-length = 128 extend-ignore = ["E203"] max-complexity = 10