Skip to content

Commit 1b791b6

Browse files
committed
dependabot, ruff, security checks
Made-with: Cursor
1 parent fea794a commit 1b791b6

File tree

7 files changed

+514
-19
lines changed

7 files changed

+514
-19
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
9+
- package-ecosystem: github-actions
10+
directory: "/"
11+
schedule:
12+
interval: weekly
13+
open-pull-requests-limit: 5

.github/workflows/python-package.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
- name: Install dependencies
2929
run: uv sync --extra dev
3030

31+
- name: Audit dependencies
32+
run: uv run pip-audit --ignore-vuln CVE-2026-4539
33+
34+
- name: Run bandit
35+
run: uv run bandit -r . -c pyproject.toml
36+
3137
- name: Run pre-commit (format & lint)
3238
run: uv run pre-commit run --all-files
3339

.pre-commit-config.yaml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 26.1.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.15.8
44
hooks:
5-
- id: black
6-
args: [--line-length=127]
7-
8-
- repo: https://github.com/pycqa/isort
9-
rev: 7.0.0
10-
hooks:
11-
- id: isort
12-
args: [--profile=black, --line-length=127]
13-
14-
- repo: https://github.com/pycqa/flake8
15-
rev: 7.3.0
16-
hooks:
17-
- id: flake8
18-
args: [--max-line-length=127]
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format
198

209
- repo: https://github.com/pre-commit/mirrors-mypy
2110
rev: v1.19.1

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44
This repository provides a basic Python project template, ideal for quick setup and efficient development.
55

66
## Features
7-
- **Workflow Configurations:** Automated testing and linting workflows in `.github/workflows` for multiple python versions.
7+
- **Workflow Configurations:** Automated testing, linting, `pip-audit`, and `bandit` in `.github/workflows` for multiple Python versions.
8+
- **Dependabot:** Weekly PRs for pip ([pyproject.toml](pyproject.toml)) and GitHub Actions.
89
- **Testing Setup:** Ready-to-use test cases in `tests` directory.
9-
- **Essential Files:** Includes `.pre-commit-config.yaml`, `.gitignore`, `pyproject.toml`.
10+
- **Essential Files:** Includes `.pre-commit-config.yaml` (Ruff + mypy), `.gitignore`, `pyproject.toml`.
1011
- **Python Scripts:** Sample `main.py` and `utils.py` for a quick start.
1112

1213
## Usage
1314
Use the template and modify the existing structure to suit your project needs.
1415

1516
## Updates
1617

18+
### Dependabot and `uv.lock`
19+
20+
Dependabot may update [pyproject.toml](pyproject.toml) only. After merging or applying those changes, run `uv lock` (or `uv lock --upgrade-package <name>`) and commit the updated [uv.lock](uv.lock) so installs and CI stay in sync.
21+
1722
### python3.12
1823

1924
**Faster Python:**

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ dependencies = []
77

88
[project.optional-dependencies]
99
dev = [
10+
"bandit[toml]",
11+
"pip-audit",
1012
"pre-commit",
1113
"pytest",
14+
"ruff",
1215
]
16+
17+
[tool.ruff]
18+
line-length = 127
19+
target-version = "py312"
20+
21+
[tool.ruff.lint]
22+
select = ["E", "F", "I"]
23+
24+
[tool.bandit]
25+
exclude_dirs = ["tests", ".venv"]

utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def concatenate_strings(str1: str, str2: str):
1+
def concatenate_strings(str1: str, str2: str) -> str:
22
"""
33
Concatenates two given strings.
44

uv.lock

Lines changed: 469 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)