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
#157)

* Move optional dependencies from `dev_requirements` to `pyproject.toml`

* add maus
  • Loading branch information
FreddyFox892 authored Sep 25, 2024
1 parent 729e53a commit 0d3bcd3
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 226 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
10 changes: 7 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,14 +49,14 @@ jobs:
needs: tests
steps:
- uses: actions/checkout@v4
- name: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- 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
3 changes: 0 additions & 3 deletions dev_requirements/requirements-coverage.in

This file was deleted.

13 changes: 0 additions & 13 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-spell_check.in

This file was deleted.

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

This file was deleted.

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

This file was deleted.

38 changes: 0 additions & 38 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.

38 changes: 36 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,45 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]

dependencies = ["click", "loguru", "jinja2", "pydantic", "python-docx", "efoli>=0.0.3"] # add all the dependencies here

dependencies = [
"click",
"loguru",
"jinja2",
"pydantic",
"python-docx",
"efoli>=0.0.3"
] # add all the dependencies here

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"
]
test_packaging = [
"build==1.2.2",
"twine==5.1.1"
]
tests = [
"maus[tree]==0.6.1",
"pytest==8.3.3",
"pytest-loguru==0.4.0",
"syrupy==4.7.1"
]
type_check = [
"mypy==1.11.2"
]

[project.urls]
Changelog = "https://github.com/Hochfrequenz/migmose/releases"
Homepage = "https://github.com/Hochfrequenz/migmose"
Expand Down
23 changes: 9 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,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:update_snapshots]
# 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]
syrupy
setenv = PYTHONPATH = {toxinidir}/src
commands = python -m pytest --basetemp={envtmpdir} {posargs} --snapshot-update
Expand All @@ -32,10 +32,11 @@ commands = python -m pytest --basetemp={envtmpdir} {posargs} --snapshot-update
# 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 =
pylint src --ignore=_migmose_version.py
pylint migmose
pylint unittests --rcfile=unittests/.pylintrc
# add single files (ending with .py) or packages here
Expand All @@ -45,7 +46,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/migmose --strict
mypy --show-error-codes unittests
Expand All @@ -56,7 +57,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 @@ -66,19 +67,13 @@ commands =
# the coverage environment is called by the Github Action that runs the coverage measurement
deps =
{[testenv:tests]deps}
-r dev_requirements/requirements-coverage.txt
.[coverage]
setenv = PYTHONPATH = {toxinidir}/src
commands =
coverage run -m pytest --basetemp={envtmpdir} {posargs}
coverage html --omit .tox/*,unittests/*,src/migmose/__main__.py
coverage report --fail-under 80 --omit .tox/*,unittests/*,src/migmose/__main__.py

[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 @@ -87,7 +82,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 @@ -98,7 +93,7 @@ commands =
[testenv:test_packaging]
skip_install = true
deps =
-r dev_requirements/requirements-packaging.txt
.[test_packaging]
commands =
python -m build
twine check dist/*

0 comments on commit 0d3bcd3

Please sign in to comment.