Skip to content
Merged
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML
*.py.jinja linguist-language=Python
*.toml.jinja linguist-language=TOML
*.md.jinja linguist-language=Markdown
*.yaml.jinja linguist-language=YAML
39 changes: 39 additions & 0 deletions PACKAGE_TEMPLATE/.github/workflows/updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# https://pixi.sh/latest/advanced/updates_github_actions/
name: Update lockfiles

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
schedule:
- cron: 0 5 1 * *

jobs:
pixi-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
run-install: false

- name: Update lockfiles
run: |
set -o pipefail
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md

- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: Update pixi lockfile"
title: "chore: Update pixi lockfile"
body-path: diff.md
branch: update-pixi
base: main
labels: pixi
delete-branch: true
add-paths: pixi.lock
7 changes: 0 additions & 7 deletions PACKAGE_TEMPLATE/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,12 @@ dmypy.json
# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.pixi

coverage-report
recipe.yaml
.ruff_cache
src/testmypixipkg/__pycache__/__init__.cpython-312.pyc
**/__pycache__/*
*./**/.pyc
**.pyc
16 changes: 16 additions & 0 deletions PACKAGE_TEMPLATE/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@
=============================

{{ package_description }}

[![pixi-badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json&style=flat-square)](https://github.com/prefix-dev/pixi)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square)](https://github.com/astral-sh/ruff)
[![Built with Material for MkDocs](https://img.shields.io/badge/mkdocs--material-gray?logo=materialformkdocs&style=flat-square)](https://github.com/squidfunk/mkdocs-material)

![GitHub repo size](https://img.shields.io/github/repo-size/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub last commit](https://img.shields.io/github/last-commit/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub commit activity](https://img.shields.io/github/commit-activity/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub issues](https://img.shields.io/github/issues/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub pull requests](https://img.shields.io/github/issues-pr/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub contributors](https://img.shields.io/github/contributors/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub stars](https://img.shields.io/github/stars/{{ github_username }}/{{ project_slug }}?style=flat-square)
![GitHub forks](https://img.shields.io/github/forks/{{ github_username }}/{{ project_slug }}?style=flat-square)

![GitHub release (latest by date)](https://img.shields.io/github/v/release/{{ github_username }}/{{ project_slug }}?style=flat-square)
34 changes: 34 additions & 0 deletions PACKAGE_TEMPLATE/config/coverage.toml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[tool.coverage.run]
# Specify the source code directories to measure
# Ensures coverage only tracks relevant package code
source = ["{{ package_name }}"]

# Omit specific files or directories from coverage
# Excludes non-relevant files from coverage reporting
omit = [
"tests/*",
"*/__init__.py",
]

[tool.coverage.report]
# Exclude lines matching these patterns
# Ignores specific patterns from coverage calculations
exclude_lines = [
# Standard pragma to ignore code blocks
"pragma: no cover",

# Don't complain about missing debug-only code
"def __repr__",
"if self.debug",

# Don't complain if tests don't hit defensive assertion code
"raise AssertionError",
"raise NotImplementedError",

# Don't complain if non-runnable code isn't run
"if __name__ == .__main__.:",

# Type checking related
"if TYPE_CHECKING:",
"pass",
]
31 changes: 31 additions & 0 deletions PACKAGE_TEMPLATE/config/hatch.toml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[version]
# Path to file containing version string
# https://hatch.pypa.io/latest/version/#sources
path = "src/{{ package_name }}/__init__.py"

[build]
# Output directory for built distributions
# https://hatch.pypa.io/latest/config/build/#output-directory
directory = "dist"

# Include package data files
# https://hatch.pypa.io/latest/config/build/#include-package-data
include-package-data = true

# Generate reproducible builds
# https://hatch.pypa.io/latest/config/build/#reproducible
reproducible = false

[build.targets.wheel]
# A Wheel is a built distribution format
# https://packaging.python.org/en/latest/specifications/binary-distribution-format/
# https://hatch.pypa.io/latest/plugins/builder/wheel/

packages = ["src/{{ package_name }}"]

[build.targets.sdist]
# A Source Distribution (or "sdist") is a built distribution format
# https://packaging.python.org/en/latest/specifications/source-distribution-format/
# https://hatch.pypa.io/latest/plugins/builder/sdist/

include = ["src/{{ package_name }}"]
63 changes: 63 additions & 0 deletions PACKAGE_TEMPLATE/config/mypy.ini.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[mypy]

# Specify the source code directories to analyze
files = src

# Exclude files from analysis
exclude = tests

# Specify the Python version to use for type checking
# This ensures mypy uses the correct Python version's type system
python_version = {{ python_version }}

# Set the cache directory
cache_dir = .cache/mypy

# Warn when returning Any from a function with a non-Any return type
# Helps maintain type safety by catching implicit Any returns
warn_return_any = True

# Warn about mypy config options that are unused
# Helps keep the mypy configuration clean and relevant
warn_unused_configs = True

# Require type annotations for all function definitions
# Enforces explicit type annotations, improving code clarity and type safety
disallow_untyped_defs = True

# Disallow functions with incomplete type annotations
# Ensures all function arguments and return types are properly annotated
disallow_incomplete_defs = True

# Type check the interior of functions without type annotations
# Helps catch type errors even in functions without annotations
check_untyped_defs = True

# Require type annotations for decorators
# Ensures type safety when using custom decorators
disallow_untyped_decorators = True

# Make Optional explicit - no implicit Optional from None default
# Improves code clarity by requiring explicit Optional annotations
no_implicit_optional = True

# Warn about casting that does not change the type
# Helps identify and remove unnecessary type casts
warn_redundant_casts = True

# Warn about unneeded '# type: ignore' comments
# Helps maintain clean code by identifying outdated type ignores
warn_unused_ignores = True

# Warn about functions that end without returning
# Catches potential bugs where functions don't return as expected
warn_no_return = True

# Warn about code that is never executed
# Helps identify dead code and logical errors
warn_unreachable = True

[mypy-pytest.*]
# Ignore missing type hints in pytest package
# Prevents errors when pytest's types are not available
ignore_missing_imports = True
64 changes: 64 additions & 0 deletions PACKAGE_TEMPLATE/config/pytest.ini.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[pytest]
# Minimum required pytest version for this configuration
# Ensures compatibility with the specified features
minversion = 7.0

# Additional command-line options to always include
# Sets default behavior for test runs
addopts =
# Show detailed test progress and results
# Improves visibility of test execution
--verbose
# Show local variables in tracebacks
# Helps with debugging failed tests
--showlocals
# Generate coverage report
# Tracks code coverage during test execution
--cov={{ package_name }}
# Output coverage report in terminal
# Provides immediate feedback on coverage
--cov-report=term-missing
# Generate XML coverage report
# Creates detailed coverage report for upload to code coverage services
--cov-report=xml:coverage-report/coverage.xml
# Generate HTML coverage report
# Creates detailed coverage report for analysis
--cov-report=html:coverage-report/htmlcov
# Point to coverage config file
# Allows customization of coverage report generation
--cov-config=config/coverage.toml

# Patterns for test discovery
# Defines which files are considered test files
testpaths =
tests
{{ package_name }}

# Python paths to add to PYTHONPATH
# Ensures test modules can import package code
pythonpath = .

# Markers for categorizing tests
# Allows running specific test categories
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
integration: marks tests as integration tests
unit: marks tests as unit tests

# Files to ignore during test collection
# Excludes specified files from testing
norecursedirs = *.egg .eggs dist build docs .tox .git __pycache__

# Test filename patterns
# Defines patterns for test file discovery
python_files = test_*.py *_test.py *_tests.py

# Configure console output style
# Sets the format of test result output
console_output_style = progress

# {% if enable_xdist %}
# #Number of processes for parallel testing
# #Speeds up test execution on multi-core systems
# numprocesses = auto
# {% endif %}
34 changes: 34 additions & 0 deletions PACKAGE_TEMPLATE/config/releaserc.toml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[semantic_release]
version_variables = ["src/{{ package_name }}/__init__.py:__version__"]
version_toml = ["pyproject.toml:project.version"]
upload_to_release = true
remove_dist = false
commit_message = "chore(sem-ver): {version}"
patch_without_tag = false
major_on_zero = false

[semantic_release.branches.main]
match = "(main|master)"

[semantic_release.branches.dev]
# any branch that contains "dev" will be considered a dev branch
match = "(dev|develop)"
prerelease = true
prerelease_token = "rc"

[semantic_release.commit_parser_options]
allowed_tags = [
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"style",
"refactor",
"test",
]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0
Loading
Loading