Skip to content

Commit 0374e65

Browse files
committed
deptry workflow
1 parent 5a2b9ea commit 0374e65

3 files changed

Lines changed: 123 additions & 1 deletion

File tree

.github/workflows/deptry.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Workflow: Deptry
2+
#
3+
# Purpose: This workflow identifies missing and obsolete dependencies in the project.
4+
# It helps maintain a clean dependency tree by detecting unused packages and
5+
# implicit dependencies that should be explicitly declared.
6+
#
7+
# Trigger: This workflow runs on every push and on pull requests to main/master
8+
# branches (including from forks)
9+
10+
name: "DEPTRY"
11+
12+
# Permissions: Only read access to repository contents is needed
13+
permissions:
14+
contents: read
15+
16+
on:
17+
push:
18+
pull_request:
19+
branches: [ main, master ]
20+
21+
jobs:
22+
deptry_analysis:
23+
name: Check dependencies with deptry
24+
runs-on: ubuntu-latest
25+
container:
26+
image: ghcr.io/astral-sh/uv:0.9.5-python3.12-trixie
27+
28+
steps:
29+
- uses: actions/checkout@v5
30+
31+
- name: Run deptry
32+
run: |
33+
set -euo pipefail
34+
if [ -f "pyproject.toml" ]; then
35+
if [ -d "src" ]; then
36+
SOURCE_FOLDER="src"
37+
else
38+
SOURCE_FOLDER="."
39+
fi
40+
uvx deptry "$SOURCE_FOLDER"
41+
else
42+
printf "${YELLOW:-}[WARN] No pyproject.toml found, skipping deptry${RESET:-}\n"
43+
fi

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ dev-dependencies = [
7676
"jedi>=0.18.1",
7777
"pytest-cov>=3.0.0",
7878
"yfinance>=0.1.70",
79-
"ecos>=2.0.14"
79+
"ecos>=2.0.14",
80+
"pre-commit==4.3.0",
8081
]
8182

8283
[tool.deptry.per_rule_ignores]

uv.lock

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)