Skip to content

Commit f5430a2

Browse files
authored
chore: test for missing dependencies (#930)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 93158ff commit f5430a2

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

.github/workflows/python.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,30 @@ jobs:
6868
- name: Run tox
6969
run: poetry run tox run -e pyupgrade -s false
7070

71+
deptry:
72+
name: test dependencies
73+
runs-on: ubuntu-latest
74+
timeout-minutes: 10
75+
steps:
76+
- name: Checkout
77+
# see https://github.com/actions/checkout
78+
uses: actions/checkout@v4
79+
- name: Setup Python Environment
80+
# see https://github.com/actions/setup-python
81+
uses: actions/setup-python@v5
82+
with:
83+
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
84+
architecture: 'x64'
85+
- name: Install poetry
86+
# see https://github.com/marketplace/actions/setup-poetry
87+
uses: Gr1N/setup-poetry@v9
88+
with:
89+
poetry-version: ${{ env.POETRY_VERSION }}
90+
- name: Install dependencies
91+
run: poetry install --no-root
92+
- name: Run tox
93+
run: poetry run tox run -e deptry -s false
94+
7195
coding-standards:
7296
name: Linting & Coding Standards
7397
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,38 @@ jobs:
6767
- name: Run tox
6868
run: poetry run tox run -e py -s false
6969

70+
deptry:
71+
name: test dependencies
72+
runs-on: ubuntu-latest
73+
timeout-minutes: 10
74+
steps:
75+
- name: Checkout
76+
# see https://github.com/actions/checkout
77+
uses: actions/checkout@v4
78+
- name: Setup Python Environment
79+
# see https://github.com/actions/setup-python
80+
uses: actions/setup-python@v5
81+
with:
82+
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
83+
architecture: 'x64'
84+
- name: Install poetry
85+
# see https://github.com/marketplace/actions/setup-poetry
86+
uses: Gr1N/setup-poetry@v9
87+
with:
88+
poetry-version: ${{ env.POETRY_VERSION }}
89+
- name: Install dependencies
90+
run: poetry install --no-root
91+
- name: Run tox
92+
run: poetry run tox run -e deptry -s false
93+
7094
release-PyPI:
7195
outputs:
7296
released: ${{ steps.release.outputs.released }} # "true" if a release was made, "false" otherwise
7397
version: ${{ steps.release.outputs.version }} # The newly released version if one was made, otherwise the current version
7498
tag: ${{ steps.release.outputs.tag }} # The Git tag corresponding to the version output
7599
needs:
76100
- quicktest
101+
- deptry
77102
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
78103
# limit this to being run on regular commits, not the commits that semantic-release will create
79104
# but also allow manual workflow dispatch

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ bandit = "1.8.5"
9595
tomli = { version = "^2.0.1", python = "<3.11" }
9696
tox = "4.27.0"
9797
pyupgrade = "3.20.0"
98+
deptry = "0.23.0"
9899

99100
# min version required to be able to install some dependencies
100101
# see https://github.com/MichaelKim0407/flake8-use-fstring/issues/33
@@ -156,3 +157,7 @@ prerelease_token = "alpha"
156157
match = "(\\d+\\.0\\.0-(dev|rc)|dev/\\d+\\.0\\.0)"
157158
prerelease = true
158159
prerelease_token = "rc"
160+
161+
162+
[tool.deptry]
163+
extend_exclude = ["docs", "package_aliases"]

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ envlist =
1010
mypy-{current,lowest}
1111
py{313,312,311,310,39}
1212
bandit
13+
deptry
1314
skip_missing_interpreters = True
1415
usedevelop = False
1516
download = False
@@ -47,6 +48,11 @@ skip_install = True
4748
commands =
4849
poetry run bandit -c bandit.yml -v -r cyclonedx_py tests
4950

51+
[testenv:deptry]
52+
# config is in `pyproject.toml`
53+
command =
54+
poetry run deptry -v .
55+
5056
[testenv:pyupgrade]
5157
allowlist_externals = poetry, sh
5258
commands = sh -c "\

0 commit comments

Comments
 (0)