Skip to content

Commit 3f106b0

Browse files
committed
chore: deduplicate .pre-commit-config.yaml repos block
1 parent 53c8192 commit 3f106b0

File tree

14 files changed

+1044
-420
lines changed

14 files changed

+1044
-420
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "pip"
3+
- package-ecosystem: "uv"
44
directory: "/"
55
schedule:
66
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 0 additions & 130 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ jobs:
100100
path: htmlcov
101101

102102
- name: Build Sphinx docs via uv
103+
if: "${{ matrix.python-version == '3.11' }}"
103104
run: |
104105
uv run python -m sphinx -b html docs docs/_build/html || true
105106
106107
- name: Upload docs artifact
108+
if: "${{ matrix.python-version == '3.11' }}"
107109
uses: actions/upload-artifact@v4
108110
with:
109111
name: docs-html

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: [3.10, 3.11, 3.12, 3.13, 3.14]
15+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1616

1717
steps:
1818
- name: Checkout repository
@@ -46,13 +46,13 @@ jobs:
4646
- name: Install build tools and uv
4747
run: |
4848
python -m pip install --upgrade pip setuptools wheel
49-
pip install uv
49+
python -m pip install uv
5050
51-
- name: Build wheelhouse for project and dev deps
51+
- name: Build wheelhouse for project and dev deps (via uv)
5252
run: |
5353
# Build wheels for the project and development extras into .wheelhouse
54-
# This will be fast when the cache is warm.
55-
python -m pip wheel -w .wheelhouse "[dev]" || python -m pip wheel -w .wheelhouse ".[dev]"
54+
# Use uv-managed venv to build reproducibly
55+
uv pip wheel -w .wheelhouse --no-build-isolation ".[dev]"
5656
5757
- name: Create venv (uv)
5858
run: |
@@ -62,7 +62,7 @@ jobs:
6262
- name: Install project dev dependencies into venv from wheelhouse
6363
run: |
6464
# Install using only the local wheels for reproducibility / speed
65-
uv pip install --no-index --find-links .wheelhouse "[dev]" || uv pip install --no-index --find-links .wheelhouse ".[dev]"
65+
uv pip install --no-index --find-links .wheelhouse ".[dev]"
6666
6767
- name: Run ruff (via uv)
6868
run: uv run ruff check .

.pre-commit-config.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-merge-conflict
10+
- id: check-toml
11+
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.1.6
14+
hooks:
15+
- id: ruff
16+
args: [--fix]
17+
- id: ruff-format
18+
19+
- repo: https://github.com/psf/black
20+
rev: 23.11.0
21+
hooks:
22+
- id: black
23+
24+
- repo: https://github.com/pre-commit/mirrors-mypy
25+
rev: v1.7.0
26+
hooks:
27+
- id: mypy
28+
additional_dependencies:
29+
- pydantic>=2.5.0
30+
- aiohttp>=3.9.0
31+
- click>=8.1.0
32+
- beautifulsoup4>=4.12.0
33+
args: [--ignore-missing-imports]
34+
exclude: ^tests/

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
SHELL := /bin/bash
2+
.PHONY: help install sync test lint type format docs precommit clean
3+
4+
help:
5+
@echo "Available targets:"
6+
@echo " make install # install uv (if missing) and sync dependencies"
7+
@echo " make sync # uv sync --all-extras"
8+
@echo " make test # run tests with coverage"
9+
@echo " make lint # run ruff"
10+
@echo " make type # run mypy"
11+
@echo " make format # format with ruff"
12+
@echo " make docs # build Sphinx docs"
13+
@echo " make precommit # install pre-commit hooks"
14+
@echo " make clean # remove build artifacts"
15+
16+
install:
17+
@command -v uv >/dev/null 2>&1 || \
18+
{ echo "uv not found. Please install uv in your Python environment. Example:"; \
19+
echo " python -m pip install --upgrade pip && python -m pip install uv"; exit 1; }
20+
uv sync --all-extras
21+
22+
sync:
23+
uv sync --all-extras
24+
25+
test:
26+
uv run pytest --cov
27+
28+
lint:
29+
uv run ruff check .
30+
31+
type:
32+
uv run mypy src
33+
34+
format:
35+
uv run ruff format .
36+
37+
docs:
38+
uv run sphinx-build -b html docs docs/_build
39+
40+
precommit:
41+
uv run pre-commit install
42+
43+
clean:
44+
rm -rf .venv build dist htmlcov coverage.xml coverage.json docs/_build

pyproject.toml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "python-project-deployment"
77
version = "0.1.0"
88
description = "A scaffolding tool for creating new Python packages with best practices"
99
readme = "README.md"
10-
requires-python = ">=3.10"
10+
requires-python = ">=3.13"
1111
license = {text = "MIT"}
1212
authors = [
1313
{name = "Magic Man", email = "deleterious420+PythonProjectDeployment@gmail.com"},
@@ -31,12 +31,18 @@ dependencies = [
3131

3232
[project.optional-dependencies]
3333
dev = [
34-
"pytest>=7.4.0",
34+
"pytest>=8.0.0",
3535
"pytest-cov>=4.1.0",
36-
"black>=23.7.0",
36+
"black>=23.11.0",
3737
"isort>=5.12.0",
38-
"mypy>=1.5.0",
39-
"ruff>=0.0.287",
38+
"mypy>=1.7.0",
39+
"ruff>=0.14.0",
40+
"pre-commit>=3.8.0",
41+
"bandit>=1.7.0",
42+
"safety>=2.0.0",
43+
"sphinx>=7.0.0",
44+
"sphinx-rtd-theme>=2.0.0",
45+
"sphinx-autodoc-typehints>=2.2.0",
4046
]
4147

4248
[project.scripts]
@@ -55,22 +61,23 @@ addopts = "--cov=python_project_deployment --cov-report=term-missing --cov-repor
5561

5662
[tool.black]
5763
line-length = 100
58-
target-version = ['py313']
64+
target-version = ['py312']
65+
66+
[tool.ruff]
67+
line-length = 100
68+
target-version = "py312"
69+
src = ["python_project_deployment", "tests"]
70+
71+
[tool.ruff.lint]
72+
select = ["E", "F", "I", "N", "W", "B", "C4"]
73+
per-file-ignores = {"tests/*" = ["S101", "S108"]}
5974

6075
[tool.isort]
6176
profile = "black"
6277
line_length = 100
6378

6479
[tool.mypy]
65-
python_version = "3.10"
80+
python_version = "3.13"
6681
warn_return_any = true
6782
warn_unused_configs = true
6883
disallow_untyped_defs = true
69-
70-
[tool.ruff]
71-
line-length = 100
72-
target-version = "py313"
73-
74-
[tool.ruff.lint]
75-
select = ["E", "F", "I", "N", "W", "B", "C4"]
76-
per-file-ignores = {"tests/*" = ["S101", "S108"]}

python_project_deployment/cli.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def main(
5050
verbose: bool,
5151
) -> None:
5252
"""Scaffold a new Python package with best practices.
53-
53+
5454
PACKAGE_NAME: Valid Python package identifier (e.g., my_awesome_pkg)
5555
TARGET_DIR: Absolute path to parent directory for the project
56-
56+
5757
Example:
5858
scaffold-python my_package /home/user/projects
5959
"""
@@ -107,15 +107,16 @@ def main(
107107

108108
# Success message
109109
click.echo("\n" + "=" * 50)
110-
click.secho(" Scaffold complete!", fg="green", bold=True)
111-
click.echo(f"\n📍 Project created at: {result_path}")
110+
click.secho(" Scaffold complete!", fg="green", bold=True)
111+
click.echo(f"\n Project created at: {result_path}")
112112

113-
click.echo("\n📖 Next steps:")
113+
click.echo("\n Next steps:")
114114
click.echo(f" 1. cd {result_path}")
115115
click.echo(" 2. source .venv/bin/activate # (or use uv run)")
116-
click.echo(f" 3. uv run python -c \"import {package_name}; print({package_name}.hello())\"")
116+
example_cmd = f'uv run python -c "import {package_name}; print({package_name}.hello())"'
117+
click.echo(f" 3. {example_cmd}")
117118

118-
click.echo("\n🔍 Available commands:")
119+
click.echo("\n Available commands:")
119120
click.echo(" • Run tests: pytest")
120121
click.echo(" • View coverage: open htmlcov/index.html")
121122
click.echo(" • Build docs: sphinx-build -b html docs docs/_build/html")
@@ -140,6 +141,7 @@ def main(
140141
click.secho(f"\n❌ Unexpected Error: {e}", fg="red", bold=True)
141142
if verbose:
142143
import traceback
144+
143145
click.echo("\n" + traceback.format_exc())
144146
sys.exit(1)
145147

python_project_deployment/models.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class ProjectConfig(BaseModel):
1010
"""Configuration model for a Python project to be scaffolded.
11-
11+
1212
Attributes:
1313
package_name: Valid Python package identifier
1414
target_dir: Absolute path to parent directory where project will be created
@@ -62,9 +62,7 @@ def validate_package_name(cls, v: str) -> str:
6262
def validate_target_dir(cls, v: Path) -> Path:
6363
"""Validate that target_dir is an absolute path."""
6464
if not v.is_absolute():
65-
raise ValueError(
66-
f"target_dir must be an absolute path, got: {v}"
67-
)
65+
raise ValueError(f"target_dir must be an absolute path, got: {v}")
6866
return v
6967

7068
@model_validator(mode="after")

0 commit comments

Comments
 (0)