From 64cae91dcf399de4a93399cf469c0199678cae8e Mon Sep 17 00:00:00 2001 From: Fstei Date: Fri, 27 Sep 2024 13:47:47 +0200 Subject: [PATCH] Move optional dependencies from `dev_requirements` to `pyproject.toml` --- .github/dependabot.yml | 2 +- .github/workflows/black.yml | 2 +- .github/workflows/release.yml | 8 +- dev_requirements/requirements-format.in | 3 - dev_requirements/requirements-format.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 | 82 ------------------- dev_requirements/requirements-spell_check.in | 1 - dev_requirements/requirements-spell_check.txt | 8 -- dev_requirements/requirements-tests.in | 2 - dev_requirements/requirements-tests.txt | 14 ---- dev_requirements/requirements-type_check.in | 4 - dev_requirements/requirements-type_check.txt | 16 ---- pyproject.toml | 27 ++++++ requirements.txt | 12 +-- tox.ini | 15 ++-- 18 files changed, 49 insertions(+), 192 deletions(-) delete mode 100644 dev_requirements/requirements-format.in delete mode 100644 dev_requirements/requirements-format.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-spell_check.in delete mode 100644 dev_requirements/requirements-spell_check.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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cd43f65..460dc96 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,7 +10,7 @@ updates: schedule: interval: "daily" - package-ecosystem: "pip" # See documentation for possible values - directory: "/dev_requirements/" # Location of package manifests + directory: "/" # Location of package manifests schedule: interval: "weekly" # Maintain dependencies for GitHub Actions diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 0b1ce82..1bfe5ed 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r dev_requirements/requirements-format.txt + pip install .[formatting] - name: ${{ matrix.tool }} Code Formatter run: | ${{ matrix.tool }} . --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23f6494..836c62c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.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-format.in b/dev_requirements/requirements-format.in deleted file mode 100644 index 41e6b86..0000000 --- a/dev_requirements/requirements-format.in +++ /dev/null @@ -1,3 +0,0 @@ -# specific requirements for the formatting envs -black -isort diff --git a/dev_requirements/requirements-format.txt b/dev_requirements/requirements-format.txt deleted file mode 100644 index cf68e60..0000000 --- a/dev_requirements/requirements-format.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile dev_requirements/requirements-format.in -# -black==24.8.0 - # via -r requirements-format.in -click==8.1.7 - # via black -isort==5.13.2 - # via -r requirements-format.in -mypy-extensions==1.0.0 - # via black -packaging==24.1 - # via black -pathspec==0.12.1 - # via black -platformdirs==4.2.2 - # 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 1dabf70..0000000 --- a/dev_requirements/requirements-linting.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile dev_requirements/requirements-linting.in -# -astroid==3.3.4 - # via pylint -dill==0.3.8 - # via pylint -isort==5.13.2 - # via pylint -mccabe==0.7.0 - # via pylint -platformdirs==4.2.2 - # via pylint -pylint==3.3.1 - # via -r dev_requirements/requirements-linting.in -tomlkit==0.13.0 - # via pylint diff --git a/dev_requirements/requirements-packaging.in b/dev_requirements/requirements-packaging.in deleted file mode 100644 index 9fef062..0000000 --- a/dev_requirements/requirements-packaging.in +++ /dev/null @@ -1,3 +0,0 @@ -# requirements for the hatchling build system -build -twine diff --git a/dev_requirements/requirements-packaging.txt b/dev_requirements/requirements-packaging.txt deleted file mode 100644 index cb718c7..0000000 --- a/dev_requirements/requirements-packaging.txt +++ /dev/null @@ -1,82 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: -# -# pip-compile dev_requirements/requirements-packaging.in -# -backports-tarfile==1.2.0 - # via jaraco-context -build==1.2.2 - # via -r dev_requirements/requirements-packaging.in -certifi==2024.7.4 - # via requests -cffi==1.16.0 - # via cryptography -charset-normalizer==3.3.2 - # via requests -cryptography==42.0.8 - # via secretstorage -docutils==0.20.1 - # via readme-renderer -idna==3.7 - # via requests -importlib-metadata==8.0.0 - # via - # keyring - # twine -jaraco-classes==3.4.0 - # via keyring -jaraco-context==5.3.0 - # via keyring -jaraco-functools==4.0.1 - # via keyring -jeepney==0.8.0 - # via - # keyring - # secretstorage -keyring==25.2.1 - # via twine -markdown-it-py==3.0.0 - # via rich -mdurl==0.1.2 - # via markdown-it-py -more-itertools==10.3.0 - # via - # jaraco-classes - # jaraco-functools -nh3==0.2.18 - # via readme-renderer -packaging==24.1 - # via build -pkginfo==1.10.0 - # via twine -pycparser==2.22 - # via cffi -pygments==2.18.0 - # via - # readme-renderer - # rich -pyproject-hooks==1.1.0 - # via build -readme-renderer==43.0 - # via twine -requests==2.32.3 - # 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.2 - # via - # requests - # twine -zipp==3.19.2 - # via importlib-metadata diff --git a/dev_requirements/requirements-spell_check.in b/dev_requirements/requirements-spell_check.in deleted file mode 100644 index e3da9e4..0000000 --- a/dev_requirements/requirements-spell_check.in +++ /dev/null @@ -1 +0,0 @@ -codespell diff --git a/dev_requirements/requirements-spell_check.txt b/dev_requirements/requirements-spell_check.txt deleted file mode 100644 index 7d37f75..0000000 --- a/dev_requirements/requirements-spell_check.txt +++ /dev/null @@ -1,8 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile dev_requirements/requirements-spell_check.in -# -codespell==2.3.0 - # via -r dev_requirements/requirements-spell_check.in diff --git a/dev_requirements/requirements-tests.in b/dev_requirements/requirements-tests.in deleted file mode 100644 index 5497961..0000000 --- a/dev_requirements/requirements-tests.in +++ /dev/null @@ -1,2 +0,0 @@ -# specific requirements for the tox tests env -pytest diff --git a/dev_requirements/requirements-tests.txt b/dev_requirements/requirements-tests.txt deleted file mode 100644 index 20bc7c0..0000000 --- a/dev_requirements/requirements-tests.txt +++ /dev/null @@ -1,14 +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==24.1 - # via pytest -pluggy==1.5.0 - # via pytest -pytest==8.3.3 - # 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 88d04ea..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.12.2 - # via mypy diff --git a/pyproject.toml b/pyproject.toml index f088798..ddce2f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,33 @@ dependencies = [ ] dynamic = ["readme", "version"] +[project.optional-dependencies] +coverage = [ + "coverage==7.6.1" +] +formatting = [ + "black==24.8.0", + "isort==5.13.2" +] +linting = [ + "pylint==3.3.1" +] +spell_check = [ + "codespell==2.3.0" +] +packaging = [ + "build==1.2.2", + "twine==5.1.1" +] +tests = [ + "pytest==8.3.3" +] +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/mj0nez/bdew-datetimes/releases" diff --git a/requirements.txt b/requirements.txt index 3d620a0..1c77de7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,16 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile requirements.in +# pip-compile --extra=test_packaging pyproject.toml # -holidays==0.57 - # via -r requirements.in +holidays==0.57 ; python_version >= "3.8" + # via bdew_datetimes (pyproject.toml) python-dateutil==2.9.0.post0 # via - # -r requirements.in + # bdew_datetimes (pyproject.toml) # holidays pytz==2024.2 - # via -r requirements.in + # via bdew_datetimes (pyproject.toml) six==1.16.0 # via python-dateutil diff --git a/tox.ini b/tox.ini index 01a5dcd..1402759 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,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} @@ -25,7 +25,7 @@ commands = python -m pytest --basetemp={envtmpdir} {posargs} # the linting environment runs pylint on the code base deps = -r requirements.txt - -r dev_requirements/requirements-linting.txt + .[linting] setenv = PYTHONPATH = {toxinidir}/src commands = pylint bdew_datetimes @@ -34,7 +34,7 @@ commands = # the type_check environment checks the type hints using mypy deps = -r requirements.txt - -r dev_requirements/requirements-type_check.txt + .[type_check] setenv = PYTHONPATH = {toxinidir}/src commands = mypy --show-error-codes src/bdew_datetimes @@ -43,7 +43,7 @@ commands = [testenv:format] # install isort and black and invoke them on the current folder deps = - -r dev_requirements/requirements-format.txt + .[formatting] commands = isort . black . @@ -58,12 +58,13 @@ deps = {[testenv:format]deps} pip-tools commands = - pip-compile --upgrade requirements.in + python -m pip install --upgrade pip + pip install -r requirements.txt [testenv:test_packaging] skip_install = true deps = - -r dev_requirements/requirements-packaging.txt + .[packaging] commands = python -m build twine check dist/* @@ -73,7 +74,7 @@ commands = setenv = PYTHONPATH = {toxinidir}/src deps = -r requirements.txt - -r dev_requirements/requirements-spell_check.txt + .[spell_check] commands = codespell --ignore-words=domain-specific-terms.txt src/bdew_datetimes codespell --ignore-words=domain-specific-terms.txt README.md