Skip to content

Commit f137f65

Browse files
committed
Initial commit
0 parents  commit f137f65

29 files changed

+1614
-0
lines changed

.coveragerc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# .coveragerc to control coverage.py
2+
[run]
3+
branch = True
4+
source = check_python_h_first
5+
# omit = bad_file.py
6+
7+
[paths]
8+
source =
9+
src/
10+
*/site-packages/
11+
12+
[report]
13+
# Regexes for lines to exclude from consideration
14+
exclude_lines =
15+
# Have to re-enable the standard pragma
16+
pragma: no cover
17+
18+
# Don't complain about missing debug-only code:
19+
def __repr__
20+
if self\.debug
21+
22+
# Don't complain if tests don't hit defensive assertion code:
23+
raise AssertionError
24+
raise NotImplementedError
25+
26+
# Don't complain if non-runnable code isn't run:
27+
if 0:
28+
if __name__ == .__main__.:

.github/workflows/ci.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# GitHub Actions configuration **EXAMPLE**,
2+
# MODIFY IT ACCORDING TO YOUR NEEDS!
3+
# Reference: https://docs.github.com/en/actions
4+
5+
name: tests
6+
7+
on:
8+
push:
9+
# Avoid using all the resources/limits available by checking only
10+
# relevant branches and tags. Other branches can be checked via PRs.
11+
branches: [main]
12+
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
13+
pull_request: # Run in every PR
14+
workflow_dispatch: # Allow manually triggering the workflow
15+
schedule:
16+
# Run roughly every 15 days at 00:00 UTC
17+
# (useful to check if updates on dependencies break the package)
18+
- cron: '0 0 1,16 * *'
19+
20+
permissions:
21+
contents: read
22+
23+
concurrency:
24+
group: >-
25+
${{ github.workflow }}-${{ github.ref_type }}-
26+
${{ github.event.pull_request.number || github.sha }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
prepare:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
34+
steps:
35+
- uses: actions/checkout@v4
36+
with: {fetch-depth: 0} # deep clone for setuptools-scm
37+
- uses: actions/setup-python@v5
38+
id: setup-python
39+
with: {python-version: "3.12"}
40+
- name: Run static analysis and format checkers
41+
run: pipx run pre-commit run --all-files --show-diff-on-failure
42+
- name: Build package distribution files
43+
run: >-
44+
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
45+
tox -e clean,build
46+
- name: Record the path of wheel distribution
47+
id: wheel-distribution
48+
run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
49+
- name: Store the distribution files for use in other stages
50+
# `tests` and `publish` will use the same pre-built distributions,
51+
# so we make sure to release the exact same package that was tested
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: python-distribution-files
55+
path: dist/
56+
retention-days: 1
57+
58+
test:
59+
needs: prepare
60+
strategy:
61+
matrix:
62+
python:
63+
- "3.8" # oldest Python supported by PSF
64+
- "3.12" # newest Python that is stable
65+
platform:
66+
- ubuntu-latest
67+
- macos-latest
68+
- windows-latest
69+
runs-on: ${{ matrix.platform }}
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: actions/setup-python@v5
73+
id: setup-python
74+
with:
75+
python-version: ${{ matrix.python }}
76+
- name: Retrieve pre-built distribution files
77+
uses: actions/download-artifact@v4
78+
with: {name: python-distribution-files, path: dist/}
79+
- name: Run tests
80+
run: >-
81+
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
82+
tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
83+
-- -rFEx --durations 10 --color yes # pytest args
84+
- name: Generate coverage report
85+
run: pipx run coverage lcov -o coverage.lcov
86+
- name: Upload partial coverage report
87+
uses: coverallsapp/github-action@master
88+
with:
89+
path-to-lcov: coverage.lcov
90+
github-token: ${{ secrets.GITHUB_TOKEN }}
91+
flag-name: ${{ matrix.platform }} - py${{ matrix.python }}
92+
parallel: true
93+
94+
finalize:
95+
needs: test
96+
runs-on: ubuntu-latest
97+
steps:
98+
- name: Finalize coverage report
99+
uses: coverallsapp/github-action@master
100+
with:
101+
github-token: ${{ secrets.GITHUB_TOKEN }}
102+
parallel-finished: true
103+
104+
publish:
105+
needs: finalize
106+
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
107+
runs-on: ubuntu-latest
108+
permissions:
109+
contents: write
110+
steps:
111+
- uses: actions/checkout@v4
112+
- uses: actions/setup-python@v5
113+
with: {python-version: "3.12"}
114+
- name: Retrieve pre-built distribution files
115+
uses: actions/download-artifact@v4
116+
with: {name: python-distribution-files, path: dist/}
117+
- name: Publish Package
118+
env:
119+
# TODO: Set your PYPI_TOKEN as a secret using GitHub UI
120+
# - https://pypi.org/help/#apitoken
121+
# - https://docs.github.com/en/actions/security-guides/encrypted-secrets
122+
TWINE_REPOSITORY: pypi
123+
TWINE_USERNAME: __token__
124+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
125+
run: pipx run tox -e publish

.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Temporary and binary files
2+
*~
3+
*.py[cod]
4+
*.so
5+
*.cfg
6+
!.isort.cfg
7+
!setup.cfg
8+
*.orig
9+
*.log
10+
*.pot
11+
__pycache__/*
12+
.cache/*
13+
.*.swp
14+
*/.ipynb_checkpoints/*
15+
.DS_Store
16+
17+
# Project files
18+
.ropeproject
19+
.project
20+
.pydevproject
21+
.settings
22+
.idea
23+
.vscode
24+
tags
25+
26+
# Package files
27+
*.egg
28+
*.eggs/
29+
.installed.cfg
30+
*.egg-info
31+
32+
# Unittest and coverage
33+
htmlcov/*
34+
.coverage
35+
.coverage.*
36+
.tox
37+
junit*.xml
38+
coverage.xml
39+
.pytest_cache/
40+
41+
# Build and docs folder/files
42+
build/*
43+
dist/*
44+
sdist/*
45+
docs/api/*
46+
docs/_rst/*
47+
docs/_build/*
48+
cover/*
49+
MANIFEST
50+
51+
# Per-project virtualenvs
52+
.venv*/
53+
.conda*/
54+
.python-version

.isort.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[settings]
2+
profile = black
3+
known_first_party = check_python_h_first

.pre-commit-config.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
exclude: '^docs/conf.py'
2+
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: check-added-large-files
9+
- id: check-ast
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: check-xml
13+
- id: check-yaml
14+
- id: debug-statements
15+
- id: end-of-file-fixer
16+
- id: requirements-txt-fixer
17+
- id: mixed-line-ending
18+
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
19+
20+
## If you want to automatically "modernize" your Python code:
21+
# - repo: https://github.com/asottile/pyupgrade
22+
# rev: v3.17.0
23+
# hooks:
24+
# - id: pyupgrade
25+
# args: ['--py38-plus']
26+
27+
## If you want to avoid flake8 errors due to unused vars or imports:
28+
# - repo: https://github.com/PyCQA/autoflake
29+
# rev: v2.3.1
30+
# hooks:
31+
# - id: autoflake
32+
# args: [
33+
# --in-place,
34+
# --remove-all-unused-imports,
35+
# --remove-unused-variables,
36+
# ]
37+
38+
- repo: https://github.com/PyCQA/isort
39+
rev: 5.13.2
40+
hooks:
41+
- id: isort
42+
43+
- repo: https://github.com/psf/black
44+
rev: stable
45+
hooks:
46+
- id: black
47+
language_version: python3
48+
49+
## If like to embrace black styles even in the docs:
50+
# - repo: https://github.com/asottile/blacken-docs
51+
# rev: 1.18.0
52+
# hooks:
53+
# - id: blacken-docs
54+
# additional_dependencies: [black]
55+
56+
- repo: https://github.com/PyCQA/flake8
57+
rev: 7.1.1
58+
hooks:
59+
- id: flake8
60+
## You can add flake8 plugins via `additional_dependencies`:
61+
# additional_dependencies: [flake8-bugbear]
62+
63+
## Check for misspells in documentation files:
64+
# - repo: https://github.com/codespell-project/codespell
65+
# rev: v2.3.0
66+
# hooks:
67+
# - id: codespell

.readthedocs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
# Build documentation in the docs/ directory with Sphinx
8+
sphinx:
9+
configuration: docs/conf.py
10+
11+
# Build documentation with MkDocs
12+
#mkdocs:
13+
# configuration: mkdocs.yml
14+
15+
# Optionally build your docs in additional formats such as PDF
16+
formats:
17+
- pdf
18+
19+
build:
20+
os: ubuntu-22.04
21+
tools:
22+
python: "3.11"
23+
24+
python:
25+
install:
26+
- requirements: docs/requirements.txt
27+
- {path: ., method: pip}

AUTHORS.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
============
2+
Contributors
3+
============
4+
5+
* DWesl <22566757+DWesl@users.noreply.github.com>

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=========
2+
Changelog
3+
=========
4+
5+
Version 0.1
6+
===========
7+
8+
- Feature A added
9+
- FIX: nasty bug #1729 fixed
10+
- add your changes here!

0 commit comments

Comments
 (0)