Skip to content

Commit f3fc476

Browse files
committed
ci: simplify workflow and refactor to src layout
- Simplified CI workflow to test single Python version (3.13) instead of matrix - Removed linting, type checking, and security scanning from CI pipeline - Streamlined to essential pytest tests only, removed coverage reporting - Refactored project structure to use src/ layout pattern - Moved python_project_deployment/ module to src/python_project_deployment/ - Added pre-commit configuration for local development (ruff, mypy, hooks) - Minor whitespace cleanup in PR template This reduces CI complexity and maintenance overhead while adopting the standard src-based project structure for better package isolation. Development quality checks are now handled via pre-commit hooks instead of CI.
1 parent 2a29937 commit f3fc476

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+317
-212
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Fixes #(issue number)
2828

2929
- [Brief description of change 1]
3030
- [Brief description of change 2]
31-
- [Brief description of change 3]
31+
- [Brief description of change 3]
3232

3333
## Testing
3434

.github/workflows/ci.yml

Lines changed: 8 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,22 @@
1-
name: CI (uv)
1+
name: CI
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
88

9-
# Cancel redundant runs per-branch/PR
109
concurrency:
1110
group: ci-${{ github.workflow }}-${{ github.ref }}
1211
cancel-in-progress: true
1312

14-
# Least-privilege for the jobs below
1513
permissions:
1614
contents: read
1715

1816
jobs:
19-
test:
20-
name: Test / Lint / Typecheck (uv)
17+
build:
18+
name: Build Check
2119
runs-on: ubuntu-latest
22-
# Write perms only where needed
23-
permissions:
24-
contents: read
25-
strategy:
26-
fail-fast: false
27-
matrix:
28-
include:
29-
- python-version: "3.11"
30-
experimental: false
31-
- python-version: "3.12"
32-
experimental: false
33-
- python-version: "3.13"
34-
experimental: false
35-
- python-version: "3.14" # treat 3.14 as experimental so CI doesn't block if it breaks
36-
experimental: true
37-
continue-on-error: ${{ matrix.experimental }}
3820

3921
steps:
4022
- name: Checkout
@@ -46,118 +28,10 @@ jobs:
4628
enable-cache: true
4729

4830
- name: Set up Python
49-
run: uv python install ${{ matrix.python-version }}
31+
run: uv python install 3.13
5032

51-
# Ensure dev tools (ruff, mypy, pytest, bandit, safety, pytest-cov) are declared in pyproject dev deps.
52-
- name: Sync dependencies
53-
run: uv sync --all-extras --dev
33+
- name: Run tests
34+
run: uv run pytest -v
5435

55-
- name: Lint (ruff)
56-
run: uv run ruff check .
57-
58-
- name: Typecheck (mypy)
59-
run: uv run mypy python_project_deployment
60-
61-
- name: Tests (pytest)
62-
run: uv run pytest --cov --cov-report=xml --cov-report=html
63-
64-
- name: Dangerous API scan (grep)
65-
continue-on-error: true
66-
shell: bash
67-
run: |
68-
set -euo pipefail
69-
if grep -rn -E '\beval\(|\bexec\(|pickle\.loads|yaml\.load\(|subprocess\.(Popen|call)\(' python_project_deployment/ tests/ 2>/dev/null | grep -v 'yaml\.load_safe' || true; then
70-
echo "⚠️ Potentially dangerous API usage detected. Please review." >&2
71-
exit 2
72-
fi
73-
74-
- name: Upload coverage.xml
75-
uses: actions/upload-artifact@v5
76-
with:
77-
name: coverage-${{ matrix.python-version }}
78-
path: coverage.xml
79-
80-
- name: Upload coverage HTML
81-
uses: actions/upload-artifact@v5
82-
with:
83-
name: coverage-html-${{ matrix.python-version }}
84-
path: htmlcov
85-
86-
security:
87-
name: Security Scan (Bandit)
88-
runs-on: ubuntu-latest
89-
needs: test
90-
permissions:
91-
contents: read
92-
93-
env:
94-
SECURITY_FAIL_LEVEL: MEDIUM
95-
96-
steps:
97-
- name: Checkout
98-
uses: actions/checkout@v5
99-
100-
- name: Install uv
101-
uses: astral-sh/setup-uv@v7
102-
with:
103-
enable-cache: true
104-
105-
- name: Set up Python
106-
run: uv python install 3.11
107-
108-
- name: Sync dependencies
109-
run: uv sync --all-extras --dev
110-
111-
- name: Run Bandit (JSON)
112-
run: |
113-
uv run bandit -r python_project_deployment/ -f json -o bandit-report.json || true
114-
uv run bandit -r python_project_deployment/ -f txt
115-
116-
- name: Apply Bandit threshold
117-
run: uv run python scripts/security_bandit_check.py
118-
continue-on-error: true
119-
120-
- name: Upload security reports
121-
uses: actions/upload-artifact@v5
122-
with:
123-
name: security-reports
124-
path: bandit-report.json
125-
126-
docs:
127-
name: Build Documentation
128-
runs-on: ubuntu-latest
129-
needs: test
130-
permissions:
131-
contents: write # Needed for GitHub Pages deployment
132-
133-
steps:
134-
- name: Checkout
135-
uses: actions/checkout@v5
136-
137-
- name: Install uv
138-
uses: astral-sh/setup-uv@v7
139-
with:
140-
enable-cache: true
141-
142-
- name: Set up Python
143-
run: uv python install 3.11
144-
145-
- name: Sync dependencies (includes sphinx)
146-
run: uv sync --all-extras --dev
147-
148-
- name: Build documentation
149-
run: uv run sphinx-build -b html docs docs/_build/html
150-
151-
- name: Upload documentation artifacts
152-
uses: actions/upload-artifact@v5
153-
with:
154-
name: documentation
155-
path: docs/_build/html
156-
157-
- name: Deploy to GitHub Pages
158-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
159-
uses: peaceiris/actions-gh-pages@v4
160-
with:
161-
github_token: ${{ secrets.GITHUB_TOKEN }}
162-
publish_dir: ./docs/_build/html
163-
keep_files: false
36+
- name: Build package
37+
run: uv build

.pre-commit-config.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Pre-commit configuration for Python Project Deployment
2+
# See https://pre-commit.com for more information
3+
# See https://pre-commit.com/hooks.html for more hooks
4+
15
repos:
26
- repo: https://github.com/astral-sh/ruff-pre-commit
37
rev: v0.8.4
@@ -9,20 +13,20 @@ repos:
913
- repo: https://github.com/pre-commit/pre-commit-hooks
1014
rev: v5.0.0
1115
hooks:
12-
# Removed trailing-whitespace and end-of-file-fixer to reduce auto-fix noise
16+
- id: trailing-whitespace
17+
- id: end-of-file-fixer
1318
- id: check-yaml
14-
- id: check-added-large-files
15-
args: ['--maxkb=1000'] # Allow up to 1MB files
1619
- id: check-toml
20+
- id: check-merge-conflict
21+
- id: mixed-line-ending
1722

18-
# Commented out Sphinx rebuild hook to avoid documentation build warnings
19-
# Uncommatuent if you want docs to rebuild on commit:
20-
# - repo: local
21-
# hooks:
22-
# - id: rebuild-docs
23-
# name: Rebuild Sphinx documentation
24-
# entry: bash -c 'uv run sphinx-build -b html docs docs/_build -q'
25-
# language: system
26-
# pass_filenames: false
27-
# stages: [commit]
28-
# files: '^(python_project_deployment/.*\.py|docs/.*\.rst)$'
23+
- repo: https://github.com/pre-commit/mirrors-mypy
24+
rev: v1.13.0
25+
hooks:
26+
- id: mypy
27+
additional_dependencies:
28+
- pydantic>=2.12.3
29+
- pydantic-settings>=2.10.0
30+
- click>=8.3.0
31+
- types-PyYAML
32+
args: [--ignore-missing-imports]

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

Makefile

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
SHELL := /bin/bash
2-
.PHONY: help install sync test lint type format docs docs-watch docs-clean docs-rebuild precommit clean
2+
.PHONY: help install sync test quick-test test-cov lint type format check security docs docs-watch docs-clean docs-rebuild precommit clean
33

44
help:
5-
@echo "Available targets:"
5+
@echo "=== Quick Commands (Recommended for Development) ==="
6+
@echo " make quick-test # run tests FAST (no coverage, no strict checks)"
67
@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 docs-watch # build docs with auto-reload on changes"
14-
@echo " make docs-clean # remove built docs"
15-
@echo " make docs-rebuild # clean + rebuild docs"
16-
@echo " make precommit # install pre-commit hooks"
8+
@echo " make format # auto-format code with ruff"
9+
@echo ""
10+
@echo "=== Quality Checks (Optional) ==="
11+
@echo " make test-cov # run tests with coverage reporting"
12+
@echo " make lint # check code style with ruff"
13+
@echo " make type # type check with mypy"
14+
@echo " make security # run security scans (bandit)"
15+
@echo " make check # run ALL quality checks"
16+
@echo ""
17+
@echo "=== Other Commands ==="
18+
@echo " make sync # sync dependencies with uv"
19+
@echo " make docs # build Sphinx documentation"
20+
@echo " make docs-watch # build docs with auto-reload"
21+
@echo " make precommit # install pre-commit hooks (OPTIONAL)"
1722
@echo " make clean # remove build artifacts"
1823

1924
install:
@@ -25,8 +30,16 @@ install:
2530
sync:
2631
uv sync --all-extras
2732

28-
test:
29-
uv run pytest --cov
33+
test: quick-test
34+
@echo "Tip: Use 'make quick-test' for faster testing without coverage"
35+
36+
quick-test:
37+
@echo " Running tests (fast mode, no coverage)..."
38+
uv run pytest -v
39+
40+
test-cov:
41+
@echo " Running tests with coverage reporting..."
42+
uv run pytest --cov --cov-report=term --cov-report=html
3043

3144
lock:
3245
uv lock
@@ -35,10 +48,33 @@ lint:
3548
uv run ruff check .
3649

3750
type:
38-
uv run mypy python_project_deployment
51+
uv run mypy src/python_project_deployment
52+
53+
check:
54+
@echo " Running all quality checks..."
55+
@echo ""
56+
@echo " [1/4] Formatting check..."
57+
@uv run ruff format --check . || echo "Format issues found - run 'make format' to fix"
58+
@echo ""
59+
@echo " [2/4] Linting..."
60+
@uv run ruff check . || echo "Lint issues found"
61+
@echo ""
62+
@echo " [3/4] Type checking..."
63+
@uv run mypy src/python_project_deployment || echo "Type issues found"
64+
@echo ""
65+
@echo " [4/4] Running tests..."
66+
@uv run pytest -v || echo "Test failures found"
67+
@echo ""
68+
@echo " Quality check complete!"
69+
70+
security:
71+
@echo " Running security scans..."
72+
@uv run bandit -r src/python_project_deployment/ || echo "Security issues found"
3973

4074
format:
75+
@echo " Auto-formatting code..."
4176
uv run ruff format .
77+
@echo " Format complete!"
4278

4379
docs:
4480
@echo " Building Sphinx documentation..."

docs/generated/python_project_deployment.cli.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@
22
===============================
33

44
.. automodule:: python_project_deployment.cli
5-
6-

docs/generated/python_project_deployment.models.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
.. automodule:: python_project_deployment.models
55

6-
6+
77
.. rubric:: Classes
88

99
.. autosummary::
10-
10+
1111
ProjectConfig
12-

docs/generated/python_project_deployment.scaffolder.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
.. automodule:: python_project_deployment.scaffolder
55

6-
6+
77
.. rubric:: Classes
88

99
.. autosummary::
10-
10+
1111
Scaffolder
12-

pyproject.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ Homepage = "https://github.com/Magic-Man-us/PythonProjectDeployment"
5858
Repository = "https://github.com/Magic-Man-us/PythonProjectDeployment"
5959

6060
[tool.hatch.build.targets.wheel]
61-
packages = ["python_project_deployment"]
61+
packages = ["src/python_project_deployment"]
6262

6363
[tool.pytest.ini_options]
6464
testpaths = ["tests"]
65-
addopts = "--cov=python_project_deployment --cov-report=term-missing --cov-report=html"
65+
# Coverage reporting is optional - remove --cov flags for faster test runs
66+
addopts = "-v"
67+
# Uncomment below to enable coverage reporting:
68+
# addopts = "--cov=src/python_project_deployment --cov-report=term-missing --cov-report=html"
6669

6770
[tool.black]
6871
line-length = 100
@@ -71,7 +74,7 @@ target-version = ['py312']
7174
[tool.ruff]
7275
line-length = 100
7376
target-version = "py312"
74-
src = ["python_project_deployment", "tests"]
77+
src = ["src", "tests"]
7578

7679
[tool.ruff.lint]
7780
select = ["E", "F", "I", "N", "W", "B", "C4"]
@@ -83,9 +86,12 @@ line_length = 100
8386

8487
[tool.mypy]
8588
python_version = "3.13"
86-
warn_return_any = true
89+
warn_return_any = false # Relaxed: don't warn on Any returns
8790
warn_unused_configs = true
88-
disallow_untyped_defs = true
91+
disallow_untyped_defs = false # Relaxed: allow untyped functions
92+
mypy_path = "src"
93+
# Strict mode disabled for easier development
94+
# To enable strict type checking, set the above to true
8995

9096
[dependency-groups]
9197
dev = [

0 commit comments

Comments
 (0)