Skip to content

Commit 17a58c0

Browse files
authored
Initial commit
0 parents  commit 17a58c0

File tree

20 files changed

+802
-0
lines changed

20 files changed

+802
-0
lines changed

.bumpversion.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[tool.bumpversion]
2+
current_version = "2025.09.0"
3+
parse = '^(?P<year>\d{4})\.(?P<month>\d{2})\.(?P<patch>\d+)$'
4+
# ← use your part names here and pad month to two digits
5+
serialize = ["{year}.{month:02d}.{patch}"]
6+
tag = true
7+
tag_name = "v{new_version}"
8+
commit = true
9+
message = "Release: {new_version}"
10+
11+
[tool.bumpversion.parts.year]
12+
type = "calver"
13+
# calver_format only affects how the part’s default or reset value is computed,
14+
# you can leave this or remove if you don’t need it.
15+
16+
[tool.bumpversion.parts.month]
17+
type = "calver"
18+
# likewise, calver_format here is optional once you’re formatting via Python syntax.
19+
20+
[tool.bumpversion.parts.patch]
21+
type = "integer"
22+
23+
[[tool.bumpversion.files]]
24+
filename = "src/template_python_lib/__init__.py"
25+
search = '__version__ = "{current_version}"'
26+
replace = '__version__ = "{new_version}"'

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
max-line-length = 119
3+
# default is 79, 119 is max for GitHub code review.
4+
# No reason to limit ourselves to 79 if the code looks uglier or less readable.
5+
exclude = .git,__pycache__,build,dist
6+
per-file-ignores =
7+
*/__init__.py: F401

.github/workflows/ci.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.11", "3.12"]
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: pip
24+
cache-dependency-path: |
25+
pyproject.toml
26+
**/requirements*.txt
27+
28+
- name: Install project (dev + test extras)
29+
run: |
30+
python -m pip install -U pip
31+
pip install -e .[dev,test]
32+
33+
# ---- Lint & type-check ----
34+
- name: Ruff (lint)
35+
run: ruff check .
36+
37+
- name: Ruff (format check)
38+
run: ruff format --check .
39+
40+
- name: mypy
41+
run: mypy .
42+
43+
# ---- Tests ----
44+
- name: Run tests
45+
run: pytest -q
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Manual CalVer Release
2+
3+
# give the token write access to repo contents (default is read)
4+
permissions:
5+
contents: write
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
dry_run:
11+
description: 'Dry-run only? (no commit, no push)'
12+
type: boolean
13+
default: true
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
# persist the GITHUB_TOKEN in .git/config so pushes/auth work
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
persist-credentials: true
24+
fetch-depth: 0
25+
fetch-tags: true
26+
27+
- name: Configure Git for the runner
28+
run: |
29+
git config user.name "${{ github.actor }}"
30+
git config user.email "${{ github.actor }}@users.noreply.github.com"
31+
32+
- name: Set up Python 3.11
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.11'
36+
37+
- name: Install bump-my-version
38+
run: pip install bump-my-version
39+
40+
- name: Compute & (dry-)apply CalVer bump
41+
env:
42+
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
43+
run: |
44+
set -e
45+
# If `DRY_RUN` was passed via act CLI, keep it; else use the workflow‐dispatch input
46+
DRY_RUN="${DRY_RUN:-$INPUT_DRY_RUN}"
47+
echo "DRY_RUN is: '$DRY_RUN'"
48+
49+
# 1) Get latest tag or empty
50+
LATEST=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
51+
YEAR=$(date +%Y) # calendar year
52+
MONTH=$(date +%m) # zero-padded month
53+
PREFIX="v${YEAR}.${MONTH}"
54+
55+
if [[ "$LATEST" == $PREFIX.* ]]; then
56+
SEQ=${LATEST##*.}
57+
NEXT_SEQ=$((SEQ + 1))
58+
else
59+
NEXT_SEQ=0
60+
fi
61+
62+
NEW_VERSION="${YEAR}.${MONTH}.${NEXT_SEQ}"
63+
echo "Next version will be ${NEW_VERSION}"
64+
65+
# Build the bump command
66+
CMD="bump-my-version bump --new-version ${NEW_VERSION}"
67+
if [[ "$DRY_RUN" == 'true' ]]; then
68+
CMD+=" --dry-run --verbose --no-commit --no-tag"
69+
fi
70+
echo "Running: $CMD"
71+
# expose DRY_RUN to all later steps
72+
echo "DRY_RUN=$DRY_RUN" >> $GITHUB_ENV
73+
$CMD
74+
75+
- name: Push changes
76+
if: env.DRY_RUN == 'false'
77+
run: git push origin HEAD --follow-tags

.gitignore

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116+
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121+
__pypackages__/
122+
123+
# Celery stuff
124+
celerybeat-schedule
125+
celerybeat.pid
126+
127+
# SageMath parsed files
128+
*.sage.py
129+
130+
# Environments
131+
.env
132+
.venv
133+
env/
134+
venv/
135+
ENV/
136+
env.bak/
137+
venv.bak/
138+
139+
# Spyder project settings
140+
.spyderproject
141+
.spyproject
142+
143+
# Rope project settings
144+
.ropeproject
145+
146+
# mkdocs documentation
147+
/site
148+
149+
# mypy
150+
.mypy_cache/
151+
.dmypy.json
152+
dmypy.json
153+
154+
# Pyre type checker
155+
.pyre/
156+
157+
# pytype static type analyzer
158+
.pytype/
159+
160+
# Cython debug symbols
161+
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
#.idea/
169+
170+
# Ruff stuff:
171+
.ruff_cache/
172+
173+
# PyPI configuration file
174+
.pypirc
175+
176+
# macOS specific files
177+
.DS_Store
178+
.AppleDouble
179+
.LSOverride
180+
181+
# Thumbnails
182+
._*
183+
184+
# Files that might appear on external disks
185+
.Spotlight-V100
186+
.Trashes
187+
188+
# Directories potentially created on remote AFP share
189+
.AppleDB
190+
.AppleDesktop
191+
Network Trash Folder
192+
Temporary Items
193+
.apdisk

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# .pre-commit-config.yaml
2+
repos:
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
rev: v0.6.9
5+
hooks:
6+
- id: ruff
7+
- id: ruff-format
8+
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v4.6.0
11+
hooks:
12+
- id: end-of-file-fixer
13+
- id: trailing-whitespace

.readthedocs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version, and other tools you might need
8+
build:
9+
os: ubuntu-24.04
10+
tools:
11+
python: "3.11"
12+
13+
sphinx:
14+
configuration: docs/source/conf.py
15+
16+
# declare the Python requirements required to build your documentation
17+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
18+
# Install the package itself so that the version can be fetched dynamically during docs building (see docs/source/conf.py)
19+
python:
20+
install:
21+
- method: pip
22+
path: .
23+
extra_requirements: [docs]

0 commit comments

Comments
 (0)