Skip to content

Commit 4889ac3

Browse files
committed
Initial commit
0 parents  commit 4889ac3

File tree

19 files changed

+1194
-0
lines changed

19 files changed

+1194
-0
lines changed

.bumper.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tool.bumper]
2+
current_version = "0.1.0"
3+
4+
[[tool.bumper.files]]
5+
file = "./pyproject.toml"
6+
search = 'version = "{current_version}"'
7+
8+
[[tool.bumper.files]]
9+
file = "./README.md"
10+
search = "rev: v{current_version}"

.flake8

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[flake8]
2+
max-line-length=100
3+
import-order-style=pycharm
4+
application-import-names=pre_commit_python_eol,tests
5+
extend-ignore=
6+
# pycodestyle
7+
E203,E226,E701
8+
# flake8-annotations
9+
ANN002,ANN003,ANN101,ANN102,ANN204,ANN206,
10+
extend-exclude=
11+
.venv,
12+
per-file-ignores =
13+
tests/test_*.py:E501,

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: sco1

.github/workflows/lint_test.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: lint-and-test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags-ignore:
9+
- "**" # Skip re-linting when tags are added
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
with:
21+
version: "0.6.x"
22+
enable-cache: true
23+
cache-dependency-glob: "uv.lock"
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version-file: "pyproject.toml"
29+
30+
- name: Install dependencies
31+
run: uv sync --all-extras --dev
32+
33+
- name: Run mypy
34+
run: uv run mypy .
35+
if: always()
36+
37+
test:
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
python-version: ["3.11", "3.12", "3.13"]
42+
fail-fast: false
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Install uv
48+
uses: astral-sh/setup-uv@v6
49+
with:
50+
version: "0.6.x"
51+
enable-cache: true
52+
cache-dependency-glob: "uv.lock"
53+
54+
- name: Set up (release) Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v5
56+
if: "!endsWith(matrix.python-version, '-dev')"
57+
with:
58+
python-version: ${{ matrix.python-version }}
59+
60+
- name: Set up (deadsnakes) Python ${{ matrix.python-version }}
61+
uses: deadsnakes/action@v3.2.0
62+
if: endsWith(matrix.python-version, '-dev')
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
66+
- name: Install dependencies
67+
run: |
68+
uv venv
69+
uv pip install tox-gh-actions tox-uv
70+
71+
- name: Run tests w/tox
72+
run: uv run tox
73+
74+
- name: Cache coverage for ${{ matrix.python-version }}
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: cov_py${{ matrix.python-version }}
78+
path: .coverage
79+
if-no-files-found: error
80+
include-hidden-files: true
81+
82+
combine-cov:
83+
runs-on: ubuntu-latest
84+
needs: test
85+
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Set up Python
90+
uses: actions/setup-python@v5
91+
with:
92+
python-version-file: "pyproject.toml"
93+
94+
- name: Pull coverage workflow artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: cov_cache/
98+
99+
- name: Install cov & combine
100+
run: |
101+
python -m pip install coverage
102+
coverage combine ./cov_cache/**/.coverage
103+
104+
- name: Report coverage
105+
run: |
106+
coverage html
107+
108+
# Report a markdown version to the action summary
109+
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY
110+
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
111+
112+
- name: Publish cov HTML
113+
uses: actions/upload-artifact@v4
114+
with:
115+
path: htmlcov/
116+
name: cov_report_html

.github/workflows/pypi_release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: Build dist & publish
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v6
19+
with:
20+
version: "0.6.x"
21+
enable-cache: true
22+
cache-dependency-glob: "uv.lock"
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version-file: "pyproject.toml"
28+
29+
- name: Build package
30+
run: uv build
31+
32+
- name: Upload wheel to release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run:
36+
gh release upload ${{ github.event.release.tag_name }} ./dist/pre_commit_python_eol-*.whl

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Packaging
7+
*.egg-info/
8+
build/
9+
dist/
10+
11+
# Jupyter
12+
.ipynb_checkpoints
13+
*.ipynb
14+
15+
# Environments
16+
.env
17+
.venv
18+
env/
19+
venv/
20+
ENV/
21+
env.bak/
22+
venv.bak/
23+
.python-version
24+
25+
# jetbrains
26+
.idea/
27+
.DS_Store
28+
29+
# vscode
30+
.vscode
31+
32+
# logs
33+
*.log
34+
test-*.xml
35+
36+
# Unit test / coverage reports
37+
.coverage
38+
.tox
39+
.coverage.*
40+
coverage.xml
41+
cov.xml
42+
htmlcov
43+
.pytest_cache/
44+
45+
# mypy
46+
.mypy_cache/

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
ci:
2+
autoupdate_schedule: quarterly
3+
4+
repos:
5+
- repo: https://github.com/psf/black
6+
rev: 25.1.0
7+
hooks:
8+
- id: black
9+
- repo: https://github.com/pycqa/isort
10+
rev: 6.0.1
11+
hooks:
12+
- id: isort
13+
name: isort
14+
- repo: https://github.com/pycqa/flake8
15+
rev: 7.2.0
16+
hooks:
17+
- id: flake8
18+
additional_dependencies:
19+
- flake8-annotations
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: v5.0.0
22+
hooks:
23+
- id: check-case-conflict
24+
- id: check-json
25+
- id: check-merge-conflict
26+
- id: check-toml
27+
- id: check-yaml
28+
- id: end-of-file-fixer
29+
- id: mixed-line-ending
30+
- id: trailing-whitespace
31+
- repo: https://github.com/pre-commit/pygrep-hooks
32+
rev: v1.10.0
33+
hooks:
34+
- id: python-check-blanket-noqa
35+
- id: python-check-blanket-type-ignore
36+
- id: python-use-type-annotations
37+
- repo: https://github.com/astral-sh/ruff-pre-commit
38+
rev: v0.11.8
39+
hooks:
40+
- id: ruff

.pre-commit-hooks.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- id: check-eol
2+
name: Check supported Python EOL
3+
entry: checkeol
4+
language: python
5+
files: '^pyproject.toml$'
6+
types: [toml]

.ruff.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
line-length = 100
2+
fix = false
3+
output-format = "grouped"
4+
5+
extend-exclude = [
6+
"__pycache__",
7+
".cache",
8+
]
9+
10+
[lint]
11+
select = [
12+
"B", # flake8-bugbear
13+
"C4", # flake8-comprehensions
14+
"D", # pydocstyle/flake8-docstrings
15+
"F", # Pyflakes
16+
"FIX", # flake8-fixme
17+
"N", # pep8-naming
18+
]
19+
20+
ignore = [
21+
# pydocstyle
22+
"D100",
23+
"D104",
24+
"D105",
25+
"D107",
26+
"D203",
27+
"D212",
28+
"D214",
29+
"D215",
30+
"D301",
31+
"D400",
32+
"D401",
33+
"D402",
34+
"D404",
35+
"D405",
36+
"D406",
37+
"D407",
38+
"D408",
39+
"D409",
40+
"D410",
41+
"D411",
42+
"D412",
43+
"D413",
44+
"D414",
45+
"D416",
46+
"D417",
47+
# pep8-naming
48+
"N802",
49+
"N806",
50+
"N815",
51+
]
52+
53+
[lint.per-file-ignores]
54+
"tests/test_*.py" = [
55+
"D101",
56+
"D103",
57+
]
58+
59+
[lint.flake8-bugbear]
60+
extend-immutable-calls = [
61+
# Typer CLI
62+
"typer.Option",
63+
"typer.Argument",
64+
]

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Changelog
2+
Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<major>`.`<minor>`.`<patch>`)

0 commit comments

Comments
 (0)