From ac7f86d3aa0a1bce7e46a84a329fe92d3d070fac Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Mon, 18 Nov 2024 14:35:25 +0100 Subject: [PATCH] Declare optional dependencies in pyproject.toml And thus get rid of requirements.txt files. --- .github/workflows/docs.yml | 2 +- .github/workflows/tests.yml | 2 +- .readthedocs.yaml | 3 ++- MANIFEST.in | 1 - debian/source/options | 2 +- pyproject.toml | 26 ++++++++++++++++++++++++++ requirements-ci.txt | 15 --------------- requirements/dev.txt | 5 ----- tox.ini | 11 ++++++++--- 9 files changed, 39 insertions(+), 28 deletions(-) delete mode 100644 requirements-ci.txt delete mode 100644 requirements/dev.txt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4fd6a95..84c5a79 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: with: python-version: 3.11 - name: Install dependencies - run: python -m pip install -r requirements-ci.txt -e . + run: python -m pip install -e ".[doc]" - name: Check documentation run: | rst2html --strict README.rst > /dev/null diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7dd7393..40c2928 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: run: python -m pip install tox - name: Test with pytest run: | - tox -e tests + tox -e tests-ci - name: Upload coverage to Codecov if: ${{ matrix.python-version == '3.12' }} uses: codecov/codecov-action@v3 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 4345504..8b7e7ab 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,4 +9,5 @@ python: install: - method: pip path: . - - requirements: requirements-ci.txt + extra_requirements: + - doc diff --git a/MANIFEST.in b/MANIFEST.in index 721e3cc..e1dfc99 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -15,7 +15,6 @@ recursive-include tests/data *.conf *.includeme *.log pgpass* exclude .editorconfig exclude .readthedocs.yaml exclude Makefile -exclude requirements/dev.txt prune .circleci prune rpm prune debian diff --git a/debian/source/options b/debian/source/options index 57e446f..fe60316 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = "(^[^/]*[.]egg-info/|.circleci|.coverage|.editorconfig|.github|.mypy_cache|.pytest_cache|.readthedocs.yaml|.venv|Makefile|docs/_build|dist|rpm|setup.cfg|scripts|tox.ini|requirements/)" +extend-diff-ignore = "(^[^/]*[.]egg-info/|.circleci|.coverage|.editorconfig|.github|.mypy_cache|.pytest_cache|.readthedocs.yaml|.venv|Makefile|docs/_build|dist|rpm|setup.cfg|scripts|tox.ini)" diff --git a/pyproject.toml b/pyproject.toml index da45412..b4834c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,32 @@ classifiers = [ ] dynamic = ["version"] +[project.optional-dependencies] +dev = [ + "pgtoolkit[lint,typing,test,doc]", +] +lint = [ + "black", + "check-manifest", + "flake8", + "isort", +] +typing = [ + "mypy", +] +test = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-mock", + "psycopg2-binary", +] +doc = [ + "sphinx", + "sphinx-autobuild", + "sphinx_rtd_theme", +] + [project.urls] Repository = "https://github.com/dalibo/pgtoolkit" Documentation = "https://pgtoolkit.readthedocs.io/" diff --git a/requirements-ci.txt b/requirements-ci.txt deleted file mode 100644 index 2206d99..0000000 --- a/requirements-ci.txt +++ /dev/null @@ -1,15 +0,0 @@ -black>=24.2.0 -check-manifest -codecov -docutils>=0.21.0 -flake8 -isort -mypy>=0.982 -pytest -pytest-asyncio -pytest-cov -pytest-mock -sphinx -sphinx-autobuild -sphinx_rtd_theme -psycopg2-binary diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 125eb6f..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -flake8 -black -check-manifest -isort -mypy diff --git a/tox.ini b/tox.ini index b741973..dad53e1 100644 --- a/tox.ini +++ b/tox.ini @@ -10,17 +10,22 @@ commands= check-manifest isort --check --diff . deps = - -r requirements/dev.txt + flake8 + black + check-manifest + isort skip_install = true -[testenv:tests] +[testenv:tests{,-ci}] allowlist_externals = ./tests/datatests.sh commands = pytest -ra --cov --cov-report=term-missing pgtoolkit/ tests/ ./tests/datatests.sh deps = - -r requirements-ci.txt + ci: codecov +extras = + test [testenv:typing] commands=