Skip to content

Commit

Permalink
Move optional dependencies from dev_requirements to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddyFox892 committed Sep 24, 2024
1 parent f68aadd commit 2d1fa1c
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements/requirements-packaging.txt
pip install .[test_packaging]
- name: Build wheel and source distributions
run: |
python -m build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
pip install tox
- name: install pydantic if requested
if: matrix.run_step == 'true'
run: pip install -r dev_requirements/requirements-pydantic.txt
run: pip install .[pydantic]
- name: Run the Unit Tests via Tox
run: |
tox -e tests
2 changes: 0 additions & 2 deletions dev_requirements/requirements-coverage.in

This file was deleted.

9 changes: 0 additions & 9 deletions dev_requirements/requirements-coverage.txt

This file was deleted.

3 changes: 0 additions & 3 deletions dev_requirements/requirements-formatting.in

This file was deleted.

21 changes: 0 additions & 21 deletions dev_requirements/requirements-formatting.txt

This file was deleted.

2 changes: 0 additions & 2 deletions dev_requirements/requirements-linting.in

This file was deleted.

21 changes: 0 additions & 21 deletions dev_requirements/requirements-linting.txt

This file was deleted.

3 changes: 0 additions & 3 deletions dev_requirements/requirements-packaging.in

This file was deleted.

72 changes: 0 additions & 72 deletions dev_requirements/requirements-packaging.txt

This file was deleted.

1 change: 0 additions & 1 deletion dev_requirements/requirements-pydantic.in

This file was deleted.

16 changes: 0 additions & 16 deletions dev_requirements/requirements-pydantic.txt

This file was deleted.

1 change: 0 additions & 1 deletion dev_requirements/requirements-spell_check.in

This file was deleted.

9 changes: 0 additions & 9 deletions dev_requirements/requirements-spell_check.txt

This file was deleted.

2 changes: 0 additions & 2 deletions dev_requirements/requirements-tests.in

This file was deleted.

15 changes: 0 additions & 15 deletions dev_requirements/requirements-tests.txt

This file was deleted.

2 changes: 0 additions & 2 deletions dev_requirements/requirements-type_check.in

This file was deleted.

13 changes: 0 additions & 13 deletions dev_requirements/requirements-type_check.txt

This file was deleted.

29 changes: 27 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,33 @@ dependencies = [] # add all the fundamend dependencies here, None so far
dynamic = ["readme", "version"]

[project.optional-dependencies]
pydantic = ["pydantic>=2"] # if you install fundamend[pydantic], the dataclasses from pydantic will be used

coverage = [
"coverage==7.6.1"
]
formatting = [
"black==24.8.0",
"isort==5.13.2"
]
linting = [
"pylint==3.3.0"
]
pydantic = [
"pydantic>=2"
# if you install fundamend[pydantic], the dataclasses from pydantic will be used
]
spellcheck = [
"codespell==2.3.0"
]
test_packaging = [
"build==1.2.2",
"twine==5.1.1"
]
tests = [
"pytest==8.3.3"
]
type_check = [
"mypy==1.11.2"
]


[project.urls]
Expand Down
26 changes: 10 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ 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}

[testenv:linting]
# 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 =
Expand All @@ -35,8 +35,8 @@ commands =
setenv = PYTHONPATH = {toxinidir}/src
deps =
{[testenv:tests]deps}
-r dev_requirements/requirements-type_check.txt
-r dev_requirements/requirements-pydantic.txt
.[type_check]
.[pydantic]
commands =
mypy --show-error-codes src/fundamend --strict
mypy --show-error-codes unittests --strict
Expand All @@ -47,7 +47,7 @@ commands =
setenv = PYTHONPATH = {toxinidir}/src
deps =
-r requirements.txt
-r dev_requirements/requirements-spell_check.txt
.[spellcheck]
commands =
codespell --ignore-words=domain-specific-terms.txt src
codespell --ignore-words=domain-specific-terms.txt README.md
Expand All @@ -58,20 +58,14 @@ commands =
changedir = unittests
deps =
{[testenv:tests]deps}
-r dev_requirements/requirements-coverage.txt
-r dev_requirements/requirements-pydantic.txt
.[coverage]
.[pydantic]
setenv = PYTHONPATH = {toxinidir}/src
commands =
coverage run -m pytest --basetemp={envtmpdir} {posargs}
coverage html --omit .tox/*,unittests/*
coverage report --fail-under 95 --omit .tox/*,unittests/*

[testenv:compile_requirements]
deps =
pip-compile-multi
commands =
pip-compile-multi -d dev_requirements --autoresolve

[testenv:dev]
# the dev environment contains everything you need to start developing on your local machine.
deps =
Expand All @@ -80,7 +74,7 @@ deps =
{[testenv:type_check]deps}
{[testenv:coverage]deps}
{[testenv:spell_check]deps}
-r dev_requirements/requirements-formatting.txt
.[formatting]
pip-tools
pre-commit
commands =
Expand All @@ -91,7 +85,7 @@ commands =
[testenv:test_packaging]
skip_install = true
deps =
-r dev_requirements/requirements-packaging.txt
.[test_packaging]
commands =
python -m build
twine check dist/*
Expand All @@ -100,6 +94,6 @@ commands =
usedevelop = True
deps =
-r requirements.txt
-r dev_requirements/requirements-pydantictxt
.[pydantic]
commands =
python json_schemas/generate_json_schemas.py

0 comments on commit 2d1fa1c

Please sign in to comment.