Skip to content

Commit 04217d6

Browse files
committed
🎉 Initial implementation
1 parent 17acbdb commit 04217d6

27 files changed

+1480
-0
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: github-actions
9+
directory: /
10+
commit-message:
11+
prefix: ⬆️
12+
schedule:
13+
interval: weekly
14+
- package-ecosystem: pip
15+
directory: /
16+
commit-message:
17+
prefix: ⬆️
18+
schedule:
19+
interval: weekly

.github/workflows/tests.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: continuous-integration
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- "v[0-9]+.[0-9]+.[0-9]+*"
8+
pull_request:
9+
10+
jobs:
11+
12+
pytest:
13+
14+
name: Unit tests (python=${{matrix.python}}, sphinx${{matrix.sphinx}})
15+
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python: ["3.8", "3.11"]
22+
sphinx: ["", "~=7.0", "~=6.0", "~=5.0"]
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{matrix.python}}
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install sphinx${{matrix.sphinx}} -e ".[testing]"
34+
- name: Run sphinx-build
35+
run: pytest --cov=src --cov-report=xml --cov-report=term-missing
36+
37+
docs-html:
38+
39+
name: Build docs (sphinx${{matrix.sphinx}})
40+
41+
runs-on: ubuntu-latest
42+
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
sphinx: ["", "~=7.0", "~=5.0"]
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Set up Python
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: 3.8
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install sphinx${{matrix.sphinx}} -e ".[docs]"
58+
- name: Run sphinx-build
59+
run: sphinx-build -nW --keep-going -b html docs/ docs/_build/html
60+
61+
check:
62+
# https://github.com/marketplace/actions/alls-green#why
63+
# This job does nothing and is only used for the branch protection
64+
65+
if: always()
66+
67+
needs:
68+
- pytest
69+
- docs-html
70+
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- name: Decide whether the needed jobs succeeded or failed
75+
uses: re-actors/alls-green@release/v1
76+
with:
77+
jobs: ${{ toJSON(needs) }}
78+
79+
80+
publish:
81+
82+
name: Publish to PyPI
83+
needs:
84+
- check
85+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Checkout source
89+
uses: actions/checkout@v4
90+
- name: Set up Python 3.8
91+
uses: actions/setup-python@v4
92+
with:
93+
python-version: "3.8"
94+
- name: install flit
95+
run: |
96+
pip install flit~=3.4
97+
- name: Build and publish
98+
run: |
99+
flit publish
100+
env:
101+
FLIT_USERNAME: __token__
102+
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}

.gitignore

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105+
__pypackages__/
106+
107+
# Celery stuff
108+
celerybeat-schedule
109+
celerybeat.pid
110+
111+
# SageMath parsed files
112+
*.sage.py
113+
114+
# Environments
115+
.env
116+
.venv
117+
env/
118+
venv/
119+
ENV/
120+
env.bak/
121+
venv.bak/
122+
123+
# Spyder project settings
124+
.spyderproject
125+
.spyproject
126+
127+
# Rope project settings
128+
.ropeproject
129+
130+
# mkdocs documentation
131+
/site
132+
133+
# mypy
134+
.mypy_cache/
135+
.dmypy.json
136+
dmypy.json
137+
138+
# Pyre type checker
139+
.pyre/
140+
141+
# pytype static type analyzer
142+
.pytype/
143+
144+
# Cython debug symbols
145+
cython_debug/
146+
147+
# PyCharm
148+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150+
# and can be added to the global gitignore or merged into this file. For a more nuclear
151+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
152+
#.idea/

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-toml
10+
- id: check-yaml
11+
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.1.14
14+
hooks:
15+
- id: ruff
16+
args: [--fix]
17+
- id: ruff-format
18+
19+
- repo: https://github.com/pre-commit/mirrors-mypy
20+
rev: v1.8.0
21+
hooks:
22+
- id: mypy
23+
args: [--config-file=pyproject.toml]
24+
additional_dependencies:
25+
- types-docutils
26+
- sphinx~=7.0
27+
exclude: ^tests/

.readthedocs.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.8"
7+
8+
python:
9+
install:
10+
- method: pip
11+
path: .
12+
extra_requirements:
13+
- docs
14+
15+
sphinx:
16+
builder: html
17+
fail_on_warning: true

CONTRIBUTING.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Contributing
2+
3+
## Getting Started
4+
5+
1. Fork the repository on GitHub
6+
2. Clone the forked repository to your local machine
7+
3. Make your changes and add tests
8+
4. Run the tests
9+
5. Run the pre-commit hooks (or install them)
10+
6. Commit your changes
11+
7. Push your changes to your fork
12+
8. Open a pull request
13+
14+
## Running the pre-commit hooks
15+
16+
The pre-commit hooks are managed by [pre-commit](https://pre-commit.com/).
17+
To install them, run:
18+
19+
To run the hooks on all files, install pre-commit and run:
20+
21+
```bash
22+
pre-commit run --all
23+
```
24+
25+
Or to install the hooks so they run automatically on every commit, run:
26+
27+
```bash
28+
pre-commit install
29+
```
30+
31+
## Building the documentation
32+
33+
To build the documentation via `tox`, install it and run:
34+
35+
```bash
36+
tox -e docs-sphinx-latest
37+
```
38+
39+
## Running the tests
40+
41+
The tests are managed by [pytest](https://docs.pytest.org/en/latest/).
42+
43+
They can be run either via creating a virtual environment and running `pytest` in it,
44+
or using [tox](https://tox.wiki) to automatically create the virtual environment and run the tests.
45+
46+
To run the tests via `tox`, install it and run:
47+
48+
```bash
49+
tox
50+
```
51+
52+
or run `tox -av` to see all available environments, and run a specific one via:
53+
54+
```bash
55+
tox -e envname
56+
```
57+
58+
To run manually in an virtual environment, run:
59+
60+
```bash
61+
python -m venv .venv
62+
source .venv/bin/activate
63+
pip install -e ".[testing]"
64+
pytest
65+
```

0 commit comments

Comments
 (0)