Skip to content

Commit e63c035

Browse files
authored
chore(ci): create Python backend CI workflow (linting job) (#9)
1 parent 1ee41d2 commit e63c035

File tree

4 files changed

+73
-20
lines changed

4 files changed

+73
-20
lines changed

.github/workflows/python-ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Python CI
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "api/**"
7+
- ".github/workflows/python-ci.yml"
8+
- ".secrets.baseline"
9+
push:
10+
branches: [main]
11+
12+
jobs:
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v6
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.13"
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v5
28+
with:
29+
enable-cache: true
30+
31+
- name: Ruff format check
32+
working-directory: api
33+
run: uvx [email protected] format . --check
34+
35+
- name: Ruff linting check
36+
working-directory: api
37+
run: uvx [email protected] check .
38+
39+
- name: Detect Secrets
40+
run: |
41+
git ls-files -z | xargs -0 uvx --from git+https://github.com/IBM/[email protected]+ibm.64.dss \
42+
detect-secrets-hook --baseline .secrets.baseline

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ repos:
1818
# when "--baseline" without "--use-all-plugins", pre-commit scan with just plugins in baseline file
1919
# when "--baseline" with "--use-all-plugins", pre-commit scan with all available plugins
2020
# add "--fail-on-unaudited" to fail pre-commit for unaudited potential secrets
21-
args: [--baseline, .secrets.baseline, --use-all-plugins]
21+
args: [--baseline, .secrets.baseline, --use-all-plugins]

.secrets.baseline

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "package-lock.json|tsconfig.tsbuildinfo|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-10-29T16:10:27Z",
6+
"generated_at": "2025-12-17T15:55:17Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -77,28 +77,20 @@
7777
}
7878
],
7979
"results": {
80-
"Doc/setup.md": [
80+
"AGENTS.md": [
8181
{
82-
"hashed_secret": "11fa7c37d697f30e6aee828b4426a10f83ab2380",
83-
"is_secret": false,
84-
"is_verified": false,
85-
"line_number": 151,
86-
"type": "Secret Keyword",
87-
"verified_result": null
88-
},
89-
{
90-
"hashed_secret": "b3b3595b8540a184df1f9953a7a8e4ee056a803a",
91-
"is_secret": false,
82+
"hashed_secret": "829c3804401b0727f70f73d4415e162400cbe57b",
9283
"is_verified": false,
93-
"line_number": 176,
84+
"line_number": 116,
9485
"type": "Secret Keyword",
9586
"verified_result": null
96-
},
87+
}
88+
],
89+
"CONTRIBUTING.md": [
9790
{
98-
"hashed_secret": "235ca8ecd22dbaae08d2971367bebdc1d1bd0224",
99-
"is_secret": false,
91+
"hashed_secret": "829c3804401b0727f70f73d4415e162400cbe57b",
10092
"is_verified": false,
101-
"line_number": 224,
93+
"line_number": 68,
10294
"type": "Secret Keyword",
10395
"verified_result": null
10496
}
@@ -154,15 +146,15 @@
154146
"hashed_secret": "829c3804401b0727f70f73d4415e162400cbe57b",
155147
"is_secret": false,
156148
"is_verified": false,
157-
"line_number": 301,
149+
"line_number": 389,
158150
"type": "Secret Keyword",
159151
"verified_result": null
160152
},
161153
{
162154
"hashed_secret": "958f57f57d72a30f329ee5538f21b0257a49a46e",
163155
"is_secret": false,
164156
"is_verified": false,
165-
"line_number": 353,
157+
"line_number": 441,
166158
"type": "Secret Keyword",
167159
"verified_result": null
168160
}

api/pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tool.ruff]
2+
target-version = "py313"
3+
line-length = 88
4+
5+
[tool.ruff.lint]
6+
# E: pycodestyle (PEP 8)
7+
# F: Pyflakes (unused variables, imports, etc.)
8+
# I: isort (import sorting)
9+
select = ["E", "F", "I"]
10+
11+
# Temporary ignore this rules when updating existing code
12+
ignore = ["E402", "I001", "E501"]
13+
14+
[tool.ruff.lint.per-file-ignores]
15+
# Ignore specific rules in specific files (e.g., .ipynb)
16+
# E402: Module level import not at top of file
17+
# I001: isort found an import in the wrong position
18+
# E501: Line too long
19+
"api/Code/*.ipynb" = ["E402", "I001", "E501"]

0 commit comments

Comments
 (0)