From 72fb73774ba13e03d25c97b502681aa445e99db3 Mon Sep 17 00:00:00 2001 From: Freddy <100769900+FreddyFox892@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:34:32 +0200 Subject: [PATCH] Move optional dependencies from `dev_requirements` to `pyproject.toml` (#168) * Move optional dependencies from `dev_requirements` to `pyproject.toml` * rename --- .github/workflows/formatting.yml | 2 +- .github/workflows/python-publish.yml | 8 ++- dev_requirements/requirements-coverage.in | 2 - dev_requirements/requirements-coverage.txt | 8 --- dev_requirements/requirements-formatting.in | 3 - dev_requirements/requirements-formatting.txt | 20 ------ dev_requirements/requirements-linting.in | 2 - dev_requirements/requirements-linting.txt | 20 ------ dev_requirements/requirements-packaging.in | 3 - dev_requirements/requirements-packaging.txt | 72 -------------------- dev_requirements/requirements-tests.in | 3 - dev_requirements/requirements-tests.txt | 18 ----- dev_requirements/requirements-type_check.in | 4 -- dev_requirements/requirements-type_check.txt | 16 ----- pyproject.toml | 36 ++++++++-- requirements.in | 8 --- requirements.txt | 18 ++--- tox.ini | 13 ++-- 18 files changed, 54 insertions(+), 202 deletions(-) delete mode 100644 dev_requirements/requirements-coverage.in delete mode 100644 dev_requirements/requirements-coverage.txt delete mode 100644 dev_requirements/requirements-formatting.in delete mode 100644 dev_requirements/requirements-formatting.txt delete mode 100644 dev_requirements/requirements-linting.in delete mode 100644 dev_requirements/requirements-linting.txt delete mode 100644 dev_requirements/requirements-packaging.in delete mode 100644 dev_requirements/requirements-packaging.txt delete mode 100644 dev_requirements/requirements-tests.in delete mode 100644 dev_requirements/requirements-tests.txt delete mode 100644 dev_requirements/requirements-type_check.in delete mode 100644 dev_requirements/requirements-type_check.txt delete mode 100644 requirements.in diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 9dfedc7..67b5112 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r dev_requirements/requirements-formatting.txt + pip install .[formatting] - name: ${{ matrix.tool }} Code Formatter run: | ${{ matrix.tool }} . --check diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3dd0653..227f145 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -35,7 +35,11 @@ jobs: build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: [ "3.12" ] + os: [ ubuntu-latest ] # Specifying a GitHub environment, # Specifying a GitHub environment, which is strongly recommended by PyPI: https://docs.pypi.org/trusted-publishers/adding-a-publisher/ # you have to create an environment in your repository settings and add the environment name here environment: release @@ -52,7 +56,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r dev_requirements/requirements-packaging.txt + pip install .[packaging] - name: Build wheel and source distributions run: | python -m build diff --git a/dev_requirements/requirements-coverage.in b/dev_requirements/requirements-coverage.in deleted file mode 100644 index d1e1a80..0000000 --- a/dev_requirements/requirements-coverage.in +++ /dev/null @@ -1,2 +0,0 @@ -# specific requirements for the tox coverage env -coverage diff --git a/dev_requirements/requirements-coverage.txt b/dev_requirements/requirements-coverage.txt deleted file mode 100644 index 1f042e7..0000000 --- a/dev_requirements/requirements-coverage.txt +++ /dev/null @@ -1,8 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: -# -# pip-compile requirements-coverage.in -# -coverage==7.6.1 - # via -r dev_requirements/requirements-coverage.in diff --git a/dev_requirements/requirements-formatting.in b/dev_requirements/requirements-formatting.in deleted file mode 100644 index 41e6b86..0000000 --- a/dev_requirements/requirements-formatting.in +++ /dev/null @@ -1,3 +0,0 @@ -# specific requirements for the formatting envs -black -isort diff --git a/dev_requirements/requirements-formatting.txt b/dev_requirements/requirements-formatting.txt deleted file mode 100644 index ebe6462..0000000 --- a/dev_requirements/requirements-formatting.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: -# -# pip-compile requirements-formatting.in -# -black==24.8.0 - # via -r dev_requirements/requirements-formatting.in -click==8.1.3 - # via black -isort==5.13.2 - # via -r dev_requirements/requirements-formatting.in -mypy-extensions==1.0.0 - # via black -packaging==23.0 - # via black -pathspec==0.11.0 - # via black -platformdirs==3.1.0 - # via black diff --git a/dev_requirements/requirements-linting.in b/dev_requirements/requirements-linting.in deleted file mode 100644 index 787ac85..0000000 --- a/dev_requirements/requirements-linting.in +++ /dev/null @@ -1,2 +0,0 @@ -# specific requirements for the tox linting env -pylint diff --git a/dev_requirements/requirements-linting.txt b/dev_requirements/requirements-linting.txt deleted file mode 100644 index 3956226..0000000 --- a/dev_requirements/requirements-linting.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: -# -# pip-compile requirements-linting.in -# -astroid==3.3.3 - # via pylint -dill==0.3.7 - # via pylint -isort==5.13.2 - # via pylint -mccabe==0.7.0 - # via pylint -platformdirs==3.1.0 - # via pylint -pylint==3.3.0 - # via -r dev_requirements/requirements-linting.in -tomlkit==0.11.6 - # via pylint diff --git a/dev_requirements/requirements-packaging.in b/dev_requirements/requirements-packaging.in deleted file mode 100644 index 3aad7fa..0000000 --- a/dev_requirements/requirements-packaging.in +++ /dev/null @@ -1,3 +0,0 @@ -# requirements for the hatchling build ssystem -build -twine diff --git a/dev_requirements/requirements-packaging.txt b/dev_requirements/requirements-packaging.txt deleted file mode 100644 index ca6ae2f..0000000 --- a/dev_requirements/requirements-packaging.txt +++ /dev/null @@ -1,72 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.12 -# by the following command: -# -# pip-compile dev_requirements/requirements-packaging.in -# -build==1.2.2 - # via -r dev_requirements/requirements-packaging.in -certifi==2024.2.2 - # via requests -cffi==1.16.0 - # via cryptography -charset-normalizer==3.3.2 - # via requests -cryptography==42.0.5 - # via secretstorage -docutils==0.20.1 - # via readme-renderer -idna==3.6 - # via requests -importlib-metadata==7.0.2 - # via twine -jaraco-classes==3.3.1 - # via keyring -jeepney==0.8.0 - # via - # keyring - # secretstorage -keyring==24.3.1 - # via twine -markdown-it-py==3.0.0 - # via rich -mdurl==0.1.2 - # via markdown-it-py -more-itertools==10.5.0 - # via jaraco-classes -nh3==0.2.15 - # via readme-renderer -packaging==24.0 - # via build -pkginfo==1.10.0 - # via twine -pycparser==2.21 - # via cffi -pygments==2.17.2 - # via - # readme-renderer - # rich -pyproject-hooks==1.0.0 - # via build -readme-renderer==43.0 - # via twine -requests==2.31.0 - # via - # requests-toolbelt - # twine -requests-toolbelt==1.0.0 - # via twine -rfc3986==2.0.0 - # via twine -rich==13.7.1 - # via twine -secretstorage==3.3.3 - # via keyring -twine==5.1.1 - # via -r dev_requirements/requirements-packaging.in -urllib3==2.2.1 - # via - # requests - # twine -zipp==3.18.1 - # via importlib-metadata diff --git a/dev_requirements/requirements-tests.in b/dev_requirements/requirements-tests.in deleted file mode 100644 index 95971dc..0000000 --- a/dev_requirements/requirements-tests.in +++ /dev/null @@ -1,3 +0,0 @@ -# specific requirements for the tox tests env -pytest -pytest-asyncio diff --git a/dev_requirements/requirements-tests.txt b/dev_requirements/requirements-tests.txt deleted file mode 100644 index 5f9ac4d..0000000 --- a/dev_requirements/requirements-tests.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile '.\dev_requirements\requirements-tests.in' -# -iniconfig==2.0.0 - # via pytest -packaging==23.0 - # via pytest -pluggy==1.5.0 - # via pytest -pytest==8.3.3 - # via - # -r dev_requirements/requirements-tests.in - # pytest-asyncio -pytest-asyncio==0.24.0 - # via -r dev_requirements/requirements-tests.in diff --git a/dev_requirements/requirements-type_check.in b/dev_requirements/requirements-type_check.in deleted file mode 100644 index 55cde2e..0000000 --- a/dev_requirements/requirements-type_check.in +++ /dev/null @@ -1,4 +0,0 @@ -# specific requirements for the tox type_check environment -mypy -types-pytz -types-python-dateutil diff --git a/dev_requirements/requirements-type_check.txt b/dev_requirements/requirements-type_check.txt deleted file mode 100644 index f1d6cb8..0000000 --- a/dev_requirements/requirements-type_check.txt +++ /dev/null @@ -1,16 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile '.\dev_requirements\requirements-type_check.in' -# -mypy==1.11.2 - # via -r dev_requirements/requirements-type_check.in -mypy-extensions==1.0.0 - # via mypy -types-python-dateutil==2.9.0.20240906 - # via -r dev_requirements/requirements-type_check.in -types-pytz==2024.2.0.20240913 - # via -r dev_requirements/requirements-type_check.in -typing-extensions==4.8.0 - # via mypy diff --git a/pyproject.toml b/pyproject.toml index 6d9e01e..0104303 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,16 +18,44 @@ classifiers = [ ] dependencies = [ "bomf", - "pvframework>=0.0.8", "ibims>=0.3.6", - "python-dateutil", - "pydantic[email]", "more_itertools", + "pydantic[email]", + "pvframework>=0.0.8", + "python-dateutil", "pytz", - "schwifty", + "schwifty" ] # add all the dependencies from requirements.in here, too dynamic = ["readme", "version"] +[project.optional-dependencies] +coverage = [ + "coverage==7.6.1" +] +formatting = [ + "black==24.8.0", + "isort==5.13.2" +] +linting = [ + "pylint==3.3.0" +] +spellcheck = [ + "codespell==2.3.0" +] +packaging = [ + "build==1.2.2", + "twine==5.1.1" +] +tests = [ + "pytest==8.3.3", + "pytest-asyncio==0.24.0" +] +type_check = [ + "mypy==1.11.2", + "types-python-dateutil==2.9.0.20240906", + "types-pytz==2024.2.0.20240913" +] + [project.urls] Changelog = "https://github.com/Hochfrequenz/pedantic-validator-tool/releases" Homepage = "https://github.com/Hochfrequenz/pedantic-validator-tool" diff --git a/requirements.in b/requirements.in deleted file mode 100644 index e1bd051..0000000 --- a/requirements.in +++ /dev/null @@ -1,8 +0,0 @@ -bomf -pvframework>=0.0.8 -ibims>=0.3.6 -python-dateutil -pydantic[email] -more_itertools -pytz -schwifty diff --git a/requirements.txt b/requirements.txt index f984121..8b33213 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile requirements.in +# pip-compile pyproject.toml # annotated-types==0.7.0 # via pydantic @@ -12,7 +12,7 @@ bidict==0.22.1 # pvframework bomf==0.11.0 # via - # -r requirements.in + # -r pyproject.toml # ibims dnspython==2.4.2 # via email-validator @@ -23,39 +23,39 @@ frozendict==2.3.8 # bomf # pvframework ibims==0.3.6 - # via -r requirements.in + # via -r pyproject.toml idna==3.4 # via email-validator injector==0.21.0 # via bomf more-itertools==10.5.0 - # via -r requirements.in + # via -r pyproject.toml networkx==3.1 # via # bomf # pvframework pvframework==0.0.8 # via - # -r requirements.in + # -r pyproject.toml # bomf pycountry==22.3.5 # via schwifty pydantic[email]==2.9.2 # via - # -r requirements.in + # -r pyproject.toml # bomf pydantic-core==2.23.4 # via pydantic python-dateutil==2.9.0.post0 - # via -r requirements.in + # via -r pyproject.toml python-generics==0.0.2 # via bomf pytz==2024.2 - # via -r requirements.in + # via -r pyproject.toml rstr==3.2.2 # via schwifty schwifty==2024.9.0 - # via -r requirements.in + # via -r pyproject.toml six==1.16.0 # via python-dateutil typeguard==4.1.5 diff --git a/tox.ini b/tox.ini index 1732f11..626f771 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ commands = python -m pip install --upgrade pip # the tests environment is called by the Github action that runs the unit tests deps = -r requirements.txt - -r dev_requirements/requirements-tests.txt + .[tests] setenv = PYTHONPATH = {toxinidir}/src commands = python -m pytest --basetemp={envtmpdir} {posargs} @@ -22,7 +22,7 @@ commands = python -m pytest --basetemp={envtmpdir} {posargs} # the linting environment is called by the Github Action that runs the linter deps = {[testenv:tests]deps} - -r dev_requirements/requirements-linting.txt + .[linting] # add your fixtures like e.g. pytest_datafiles here setenv = PYTHONPATH = {toxinidir}/src commands = @@ -35,7 +35,7 @@ commands = setenv = PYTHONPATH = {toxinidir}/src deps = {[testenv:tests]deps} - -r dev_requirements/requirements-type_check.txt + .[type_check] commands = mypy --show-error-codes src/pvtool mypy --show-error-codes unittests @@ -46,7 +46,7 @@ commands = changedir = unittests deps = {[testenv:tests]deps} - -r dev_requirements/requirements-coverage.txt + .[coverage] setenv = PYTHONPATH = {toxinidir}/src commands = coverage run -m pytest --basetemp={envtmpdir} {posargs} @@ -61,19 +61,18 @@ deps = {[testenv:linting]deps} {[testenv:type_check]deps} {[testenv:coverage]deps} - -r dev_requirements/requirements-formatting.txt + .[formatting] pip-tools pre-commit commands = python -m pip install --upgrade pip - pip-compile requirements.in pip install -r requirements.txt pre-commit install [testenv:test_packaging] skip_install = true deps = - -r dev_requirements/requirements-packaging.txt + .[packaging] commands = python -m build twine check dist/*