Skip to content

Commit 2e67692

Browse files
authored
Merge pull request #3 from 56kyle/develop
Develop
2 parents 28c163d + 0448dd9 commit 2e67692

File tree

6 files changed

+19
-152
lines changed

6 files changed

+19
-152
lines changed

cookiecutter.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"package_name": "{{ cookiecutter.project_name.replace('-', '_') }}",
44
"friendly_name": "{{ cookiecutter.project_name.replace('-', ' ').title() }}",
55
"min_python_version": "3.9",
6-
"max_python_version": "3.12",
6+
"max_python_version": "3.13",
77
"author": "Kyle Oliver",
8-
"email": "56kyleoliver@gmail.com",
8+
"email": "56kyleoliver+cookiecutter-robust-python@gmail.com",
99
"github_user": "56kyle",
1010
"version": "0.0.0",
1111
"copyright_year": "{% now 'utc', '%Y' %}",

noxfile.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test(session: Session) -> None:
113113
"author_name='Test Author'",
114114
"author_email='test@example.com'",
115115
"license='MIT'",
116-
"python_version='3.12'", # Use a fixed version for test stability
116+
"python_version='3.13'", # Use a fixed version for test stability
117117
"add_rust_extension='n'", # Test without Rust initially, add another test session for Rust
118118
# Add other variables needed by cookiecutter.json here to ensure no prompts
119119
])
@@ -176,7 +176,3 @@ def release_template(session: Session):
176176
session.log("Template version bumped and tag created locally via Commitizen/uvx.")
177177
session.log("IMPORTANT: Push commits and tags to remote (`git push --follow-tags`) to trigger CD for the TEMPLATE.")
178178

179-
180-
# Default sessions to run if no arguments are given to Nox in the template repo.
181-
# Often includes core checks and potentially documentation build and/or template tests.
182-
nox.options.sessions = ["check", "docs"]
Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,19 @@
1-
# .cz.toml
2-
# See https://commitizen-tools.github.io/commitizen/config/
3-
4-
# Commitizen configuration for project release management (using Conventional Commits).
5-
61
[tool.commitizen]
7-
# Format for Git tags created by cz bump. '$version' is replaced by the new version.
82
tag_format = "v$version"
9-
10-
# Versioning scheme to use for deciding the next version based on commit types.
11-
# See https://commitizen-tools.github.io/commitizen/versioning/ for options.
12-
# 'pep440' (default) is common for Python (e.g., 0.1.0, 1.2.3)
13-
# 'semver' is another popular standard (major.minor.patch)
143
version_scheme = "pep440"
154

165
# Set to true to allow bumping to 0.y.z from 0.(y-1).z when commit types normally trigger major bump.
176
# Recommended for initial development phases before 1.0.0.
187
major_version_zero = true
198

20-
# Files where the version string should be updated when 'cz bump' is run.
21-
# Ensure these paths and variable names match your project.
229
write_version_files = [
23-
# Updates the [project].version in pyproject.toml (PEP 621)
2410
"pyproject.toml:version",
25-
# Example: Update __version__ in your package's __init__.py
2611
"src/{{ cookiecutter.package_name }}/__init__.py:__version__",
27-
# Add other files if needed (e.g., YOUR_APP/__init__.py for complex structures)
2812
]
29-
30-
# File where Commitizen reads/writes the commit message for manual commits (standard).
3113
commit_msg_file = ".git/COMMIT_EDITMSG"
3214

33-
# Optional: Define specific commit types and their impact on version bumping/changelog sections.
34-
# See https://commitizen-tools.github.io/commitizen/getting_started/#setting-the-cz-config
35-
# The default types are usually sufficient (feat, fix, breaking changes, etc.) but can be customized.
36-
# [tool.commitizen.commit_types]
37-
# feat = { description = "A new feature", section = "Features" }
38-
# fix = { description = "A bug fix", section = "Bug Fixes" }
39-
# chore = { description = "Build process or auxiliary tool changes", hidden = true }
40-
41-
42-
# Optional: Configuration for Git host integrations (e.g., creating GitHub releases).
43-
# See https://commitizen-tools.github.io/commitizen/changelog/#git-host-configuration
4415
[tool.commitizen.github]
45-
release = true # Enable GitHub release creation
46-
release_asset_path = "dist/*" # Attach build artifacts from the 'dist' directory
16+
release = true
17+
release_asset_path = "dist/*"
4718
release_asset_descriptions = { "*.tar.gz": "Source distribution", "*.whl": "Python Wheel" }
48-
base_url = "https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}" # Your repo URL
19+
base_url = "https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}"
Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,23 @@
11
# .pre-commit-config.yaml
22
# See https://pre-commit.com/
3+
default_stages: [commit]
34

4-
# This file configures the pre-commit framework, listing hooks that run on staged files before commits.
5-
# Ruff is configured to run the full set of enabled linting rules and formatting on files in the commit.
6-
7-
# --- Default settings for hooks if not overridden ---
8-
default_stages: [commit] # Run hooks by default on 'commit' stage
9-
10-
# Exclude patterns for hooks (relative to project root).
11-
# Ensure consistency with .gitignore. Hooks often have built-in excludes for standard dirs.
12-
# exclude: ^docs/.*$ # Example exclude for documentation source files (handled by Ruff excludes often)
13-
14-
# --- Repositories containing hooks ---
155
repos:
16-
# Standard pre-commit hooks provided by the framework developers.
17-
# See https://github.com/pre-commit/pre-commit-hooks
186
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
# Use a specific tag or commit hash (pinning for reproducibility).
20-
rev: v4.6.0 # Update periodically to get newer hooks/fixes.
7+
rev: v4.6.0
218
hooks:
22-
# Prevent adding large files that should probably be in Git LFS or ignored.
239
- id: check-added-large-files
24-
args: ["--max-size=1000000"] # Set max file size to 1MB (adjust as needed).
25-
26-
# Check YAML files (e.g., CI workflows, Docker Compose) for syntax errors.
10+
args: ["--max-size=1000000"]
2711
- id: check-yaml
28-
29-
# Check TOML files (e.g., pyproject.toml, .ruff.toml) for syntax errors.
3012
- id: check-toml
31-
32-
# Ensure files end with a single newline and are not excessively blank at the end.
3313
- id: end-of-file-fixer
34-
35-
# Removes unwanted trailing whitespace from lines.
3614
- id: trailing-whitespace
3715

38-
# Ruff hooks (Formatter and Linter checks) from Astral.
39-
# See https://github.com/astral-sh/ruff-pre-commit
40-
# Match the rev/version to the version of Ruff used in the template's pyproject.toml dependencies.
41-
- repo: https://github.com/astral-sh/ruff-pre-commit # Official hooks from Astral (Ruff creator)
42-
# Pin to the version of Ruff used in pyproject.toml (or a compatible version).
43-
rev: v0.3.5 # **Ensure this matches/is compatible with the Ruff version in pyproject.toml**
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.3.5
4418
hooks:
45-
# Run the Ruff formatter (covers code formatting and import sorting).
46-
# Automatically fixes issues like line length, spacing, quotes, and sorts imports.
47-
# Run this hook first so the linter doesn't report fixable style issues.
4819
- id: ruff-format
49-
# Explicitly point to the separate ruff config file.
50-
args: [--config={{ PROJECT_SLUG }}/.ruff.toml] # Path relative to project root.
20+
args: [--config={{ PROJECT_SLUG }}/.ruff.toml]
5121

52-
# Run the Ruff linter.
53-
# This hook runs the *full set of enabled linting rules* configured in .ruff.toml.
54-
# Use --fix to automatically fix many lint issues.
55-
# Use --exit-non-zero-on-fix to make the commit fail if any fixes were applied
56-
# (prompts user to 'git add' and re-commit the corrected files).
5722
- id: ruff
5823
args: [--fix, --exit-non-zero-on-fix, --config={{ PROJECT_SLUG }}/.ruff.toml]
59-
60-
61-
# --- Optional Hooks ---
62-
# Add hooks for other tools if they are fast enough for pre-commit and needed.
63-
# Ensure any tools used here are listed as development dependencies in pyproject.toml
64-
# so pre-commit can install them.
65-
66-
# Note: More time-consuming checks (e.g., full Pyright, comprehensive Bandit/pip-audit scans)
67-
# are typically too slow for mandated pre-commit hooks across large projects.
68-
# These are run via Task Automation (Nox) and enforced in CI.

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[project]
22
name = "{{ cookiecutter.package_name }}"
33
version = "0.1.0"
4-
description = "{{ cookiecutter.project_description }}"
4+
description = "{{ cookiecutter.package_name }}"
55
authors = [
66
{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}" },
77
]
88
license = { text = "{{ cookiecutter.license }}" }
99
readme = "README.md"
10-
requires-python = ">={{ cookiecutter.python_version }},<4.0"
10+
requires-python = ">={{ cookiecutter.min_python_version}},<4.0"
1111

1212
keywords = [
13-
"{{ cookiecutter.project_slug.replace('_', '-') }}",
13+
"{{ cookiecutter.project_name.replace('_', '-') }}",
1414
]
1515

1616
classifiers = [
@@ -72,10 +72,6 @@ requires = [
7272
build-backend = {% if cookiecutter.add_rust_extension == 'y' -%} "maturin" {% else -%} "setuptools.build_meta" {% endif %}
7373

7474

75-
# --- Tool-specific configurations ---
76-
# Configuration details are often in separate files (.ruff.toml, pyrightconfig.json)
77-
# Link to their documentation for full config options.
78-
7975
[tool.uv]
8076
# See https://docs.astral.sh/uv/reference/configuration/
8177

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// pyrightconfig.json
2-
// See https://github.com/microsoft/pyright/blob/main/docs/configuration.md
3-
// This file configures the Pyright static type checker.
4-
51
{
62
"include": [
73
"src",
@@ -21,74 +17,27 @@
2117
".coverage",
2218
"rust"
2319
],
24-
// Path to search for virtual environments relative to this config file.
25-
// "." searches in the current directory and subdirectories (like .venv).
2620
"venvPath": ".",
27-
// Name of the default virtual environment directory to search within venvPath.
28-
// UV's default is ".venv" relative to the project root.
2921
"venv": ".venv",
30-
// Execution environments help map source paths to target Python versions/extra paths.
3122
"executionEnvironments": [
3223
{
33-
// Analyze source code within the 'src' directory
3424
"root": "src",
35-
"pythonVersion": "{{ cookiecutter.python_version }}",
36-
// Paths to add to sys.path for analysis within this environment
3725
"extraPaths": []
3826
},
3927
{
4028
"root": "tests",
41-
"pythonVersion": "{{ cookiecutter.python_version }}",
4229
"extraPaths": []
4330
}
4431
],
45-
// === Reporting Severity Levels ===
46-
// Control severity for different types of issues (error, warning, information, ignore)
47-
// Change these to "error" once you have addressed issues in your project for stricter enforcement.
48-
49-
// Reporting level for basic type issues.
5032
"reportMissingImports": true,
51-
// Flag imports Pyright cannot find
5233
"reportMissingTypeStubs": true,
53-
// Flag imported libraries without type stubs
5434

5535
"reportGeneralTypeIssues": "warning",
56-
// Warn about common type problems
5736
"reportPropertyTypeMismatch": "warning",
58-
// Warn if getter/setter types don't align
5937
"reportReturnTypeFromAnnotation": "warning",
60-
// Check consistency between return annotation and actual code path returns
61-
62-
// === Strictness Flags ===
63-
// Enabling "strict": true turns on a comprehensive set of strict type checking rules.
64-
// It's recommended to enable this once your project is well-typed for maximum safety.
65-
// It's equivalent to enabling all "report..." rules listed below.
66-
// "strict": true, # Uncomment and set to true for strict mode
67-
68-
// Alternatively, enable individual strict rules progressively:
69-
// "basic": true # Enables a moderate set of strict rules (often a good starting point before full strict)
70-
// See Pyright docs for descriptions of all strict rules:
71-
// https://github.com/microsoft/pyright/blob/main/docs/configuration.md#information-about-type-checking-rules
72-
73-
// Examples of strict rules included in "strict": true or "basic": true
74-
// "reportAny": "warning", # Disallows explicit or implicit use of 'Any'
75-
// "reportUndefinedVariable": "error", # Required. Flags uses of variables before assignment.
76-
// "reportUnusedImport": "warning", # Flags unused imports (also caught by Ruff).
77-
// "reportUnusedVariable": "warning", # Flags unused variables (also caught by Ruff).
78-
// "reportMissingParameterType": "warning",# Flags function parameters missing type annotations
79-
// "reportMissingReturnType": "warning", # Flags functions missing return type annotations
80-
// "reportOptionalOperand": "warning", # Flags operations on potentially None values
81-
82-
// --- Other Configuration ---
83-
// Set the python version explicitly for analysis context
38+
"reportMissingReturnType": "warning",
39+
"basic": true,
40+
"reportMissingParameterType": "warning",
41+
"reportOptionalOperand": "warning",
8442
"pythonVersion": "{{ cookiecutter.python_version }}"
85-
86-
// Set the python platform explicitly if cross-platform analysis is needed (less common for typical projects)
87-
// "pythonPlatform": "Linux", # "Linux", "Darwin" (macOS), "Windows"
88-
89-
// Define custom typeshed paths if needed
90-
// "typeshedPath": "path/to/typeshed",
91-
92-
// Specify a minimum threshold of confidence for inferred types (advanced)
93-
// "analyzeUnannotatedFunctions": true, # Analyze functions even if not annotated (part of basic)
9443
}

0 commit comments

Comments
 (0)