Skip to content

Commit 9c7cc37

Browse files
authored
Move optional dependencies from dev_requirements to pyproject.toml (#59)
1 parent 1421b1f commit 9c7cc37

18 files changed

+44
-247
lines changed

.github/workflows/formatting.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install -r dev_requirements/requirements-formatting.txt
24+
pip install .[formatting]
2525
- name: ${{ matrix.tool }} Code Formatter
2626
run: |
2727
${{ matrix.tool }} . --check

.github/workflows/python-publish.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ jobs:
3535
3636
build-n-publish:
3737
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
38-
runs-on: ubuntu-latest
38+
runs-on: ${{ matrix.os }}
39+
strategy:
40+
matrix:
41+
python-version: [ "3.12" ]
42+
os: [ ubuntu-latest ]
3943
# Specifying a GitHub environment, # Specifying a GitHub environment, which is strongly recommended by PyPI: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
4044
# you have to create an environment in your repository settings and add the environment name here
4145
environment: release
@@ -45,14 +49,14 @@ jobs:
4549
needs: tests
4650
steps:
4751
- uses: actions/checkout@v4
48-
- name: Set up Python
52+
- name: Set up Python ${{ matrix.python-version }}
4953
uses: actions/setup-python@v5
5054
with:
5155
python-version: ${{ matrix.python-version }}
5256
- name: Install dependencies
5357
run: |
5458
python -m pip install --upgrade pip
55-
pip install -r dev_requirements/requirements-packaging.txt
59+
pip install .[packaging]
5660
- name: Build wheel and source distributions
5761
run: |
5862
python -m build

dev_requirements/requirements-coverage.in

-2
This file was deleted.

dev_requirements/requirements-coverage.txt

-8
This file was deleted.

dev_requirements/requirements-formatting.in

-3
This file was deleted.

dev_requirements/requirements-formatting.txt

-24
This file was deleted.

dev_requirements/requirements-linting.in

-3
This file was deleted.

dev_requirements/requirements-linting.txt

-40
This file was deleted.

dev_requirements/requirements-packaging.in

-3
This file was deleted.

dev_requirements/requirements-packaging.txt

-78
This file was deleted.

dev_requirements/requirements-spell_check.in

-1
This file was deleted.

dev_requirements/requirements-spell_check.txt

-8
This file was deleted.

dev_requirements/requirements-tests.in

-4
This file was deleted.

dev_requirements/requirements-tests.txt

-44
This file was deleted.

dev_requirements/requirements-type_check.in

-4
This file was deleted.

dev_requirements/requirements-type_check.txt

-14
This file was deleted.

pyproject.toml

+29
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,35 @@ dependencies = [
2626
] # add all the dependencies here
2727
dynamic = ["readme", "version"]
2828

29+
[project.optional-dependencies]
30+
coverage = [
31+
"coverage==7.4.4"
32+
]
33+
formatting = [
34+
"black==24.8.0",
35+
"isort==5.13.2"
36+
]
37+
linting = [
38+
"pylint==3.2.6",
39+
"pylint-pydantic==0.3.2"
40+
]
41+
packaging = [
42+
"build==1.2.1",
43+
"twine==5.1.1"
44+
]
45+
spellcheck = [
46+
"codespell==2.2.6"
47+
]
48+
tests = [
49+
"aioresponses==0.7.6",
50+
"pytest==8.1.1",
51+
"pytest-asyncio==0.23.6"
52+
]
53+
type_check = [
54+
"mypy[pydantic]==1.8.0",
55+
"types-pytz==2024.1.0.20240203"
56+
]
57+
2958
[project.urls]
3059
Changelog = "https://github.com/Hochfrequenz/bssclient.py/releases"
3160
Homepage = "https://github.com/Hochfrequenz/bssclient.py"

tox.ini

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ commands = python -m pip install --upgrade pip
1414
# the tests environment is called by the Github action that runs the unit tests
1515
deps =
1616
-r requirements.txt
17-
-r dev_requirements/requirements-tests.txt
17+
.[tests]
1818
setenv = PYTHONPATH = {toxinidir}/src
1919
commands = python -m pytest --basetemp={envtmpdir} {posargs}
2020

2121
[testenv:linting]
2222
# the linting environment is called by the Github Action that runs the linter
2323
deps =
2424
{[testenv:tests]deps}
25-
-r dev_requirements/requirements-linting.txt
25+
.[linting]
2626
# add your fixtures like e.g. pytest_datafiles here
2727
setenv = PYTHONPATH = {toxinidir}/src
2828
commands =
@@ -35,7 +35,7 @@ commands =
3535
setenv = PYTHONPATH = {toxinidir}/src
3636
deps =
3737
{[testenv:tests]deps}
38-
-r dev_requirements/requirements-type_check.txt
38+
.[type_check]
3939
commands =
4040
mypy --show-error-codes src/bssclient
4141
mypy --show-error-codes unittests
@@ -46,7 +46,7 @@ commands =
4646
setenv = PYTHONPATH = {toxinidir}/src
4747
deps =
4848
-r requirements.txt
49-
-r dev_requirements/requirements-spell_check.txt
49+
.[spellcheck]
5050
commands =
5151
codespell --ignore-words=domain-specific-terms.txt src
5252
codespell --ignore-words=domain-specific-terms.txt README.md
@@ -58,7 +58,7 @@ commands =
5858
changedir = unittests
5959
deps =
6060
{[testenv:tests]deps}
61-
-r dev_requirements/requirements-coverage.txt
61+
.[coverage]
6262
setenv = PYTHONPATH = {toxinidir}/src
6363
commands =
6464
coverage run -m pytest --basetemp={envtmpdir} {posargs}
@@ -74,7 +74,7 @@ deps =
7474
{[testenv:type_check]deps}
7575
{[testenv:coverage]deps}
7676
{[testenv:spell_check]deps}
77-
-r dev_requirements/requirements-formatting.txt
77+
.[formatting]
7878
pip-tools
7979
pre-commit
8080
commands =
@@ -86,7 +86,7 @@ commands =
8686
[testenv:test_packaging]
8787
skip_install = true
8888
deps =
89-
-r dev_requirements/requirements-packaging.txt
89+
.[packaging]
9090
commands =
9191
python -m build
9292
twine check dist/*

0 commit comments

Comments
 (0)