generated from sco1/py-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9613052
Showing
19 changed files
with
1,239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = False | ||
allow_dirty = True | ||
|
||
[bumpversion:file:pyproject.toml] | ||
search = version = "{current_version}" | ||
replace = version = "{new_version}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ubuntu:focal | ||
ARG PYTHON_PACKAGES="\ | ||
python3.10 python3.10-distutils python3.10-venv python3.10-tk \ | ||
python3.11 python3.11-distutils python3.11-venv python3.11-tk \ | ||
python3.12 python3.12-distutils python3.12-venv python3.12-tk \ | ||
" | ||
|
||
# Base utils | ||
RUN apt-get update && apt-get install --no-install-recommends -yq software-properties-common | ||
RUN apt-get -yq install git curl | ||
|
||
# Python versions | ||
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update | ||
RUN apt-get install -yq --no-install-recommends ${PYTHON_PACKAGES} | ||
|
||
# Shell | ||
RUN apt-get -yq install zsh | ||
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | ||
|
||
RUN chsh -s /usr/bin/zsh | ||
ENV SHELL /usr/bin/zsh | ||
ENTRYPOINT ["zsh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "Python Dev", | ||
"dockerFile": "Dockerfile", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"christian-kohler.path-intellisense", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-toolsai.jupyter", | ||
"ms-toolsai.jupyter-renderers", | ||
"ms-vscode.hexeditor", | ||
"redhat.vscode-yaml", | ||
"ryu1kn.partial-diff", | ||
"s3gf4ult.monokai-vibrant", | ||
"Tyriar.sort-lines", | ||
"VisualStudioExptTeam.vscodeintellicode", | ||
"vscode-icons-team.vscode-icons", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[flake8] | ||
max-line-length=100 | ||
import-order-style=pycharm | ||
application-import-names=py_template,tests | ||
extend-ignore= | ||
# pycodestyle | ||
E226, | ||
# flake8-annotations | ||
ANN002,ANN003,ANN101,ANN102,ANN204,ANN206, | ||
extend-exclude= | ||
.venv, | ||
per-file-ignores = | ||
tests/test_*.py:E501, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: sco1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: lint-and-test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
tags-ignore: | ||
- "**" # Skip re-linting when tags are added | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Poetry for caching | ||
run: pipx install poetry | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
cache: 'poetry' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools importlib-metadata | ||
pip install poetry | ||
poetry install | ||
- name: Run mypy | ||
run: poetry run mypy . | ||
if: always() | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11", "3.12", "3.13-dev"] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Poetry for caching | ||
run: pipx install poetry | ||
|
||
- name: Set up (release) Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
if: "!endsWith(matrix.python-version, '-dev')" | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' | ||
|
||
- name: Set up (deadsnakes) Python ${{ matrix.python-version }} | ||
uses: deadsnakes/action@v3.1.0 | ||
if: endsWith(matrix.python-version, '-dev') | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install -U pip setuptools importlib-metadata | ||
pip install tox-gh-actions | ||
- name: Run tests w/tox | ||
run: tox | ||
|
||
- name: Cache coverage for ${{ matrix.python-version }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cov_py${{ matrix.python-version }} | ||
path: .coverage | ||
|
||
combine-cov: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Pull coverage workflow artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: cov_cache/ | ||
|
||
- name: Install cov & combine | ||
run: | | ||
pip install coverage | ||
coverage combine ./cov_cache/**/.coverage | ||
- name: Report coverage | ||
run: | | ||
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
coverage report -m --skip-covered >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
coverage html | ||
- name: Publish cov HTML | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: htmlcov/ | ||
name: cov_report_html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: Build dist & publish | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install build dependencies & build | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
poetry build | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1.5 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_api_token }} | ||
|
||
- name: Upload wheel to release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | ||
gh release upload ${{ github.event.release.tag_name }} ./dist/py_template-*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Packaging | ||
*.egg-info/ | ||
build/ | ||
dist/ | ||
|
||
# Jupyter | ||
.ipynb_checkpoints | ||
*.ipynb | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
.python-version | ||
|
||
# jetbrains | ||
.idea/ | ||
.DS_Store | ||
|
||
# vscode | ||
.vscode | ||
|
||
# logs | ||
*.log | ||
test-*.xml | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
.coverage.* | ||
coverage.xml | ||
cov.xml | ||
htmlcov | ||
.pytest_cache/ | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
ci: | ||
autoupdate_schedule: monthly | ||
|
||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.4.2 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
name: isort | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-annotations | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-case-conflict | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: python-check-blanket-noqa | ||
- id: python-check-blanket-type-ignore | ||
- id: python-use-type-annotations | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.4.7 | ||
hooks: | ||
- id: ruff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
line-length = 100 | ||
fix = false | ||
output-format = "grouped" | ||
|
||
extend-exclude = [ | ||
"__pycache__", | ||
".cache", | ||
] | ||
|
||
[lint] | ||
select = [ | ||
"B", # flake8-bugbear | ||
"C4", # flake8-comprehensions | ||
"D", # pydocstyle/flake8-docstrings | ||
"F", # Pyflakes | ||
"FIX", # flake8-fixme | ||
"N", # pep8-naming | ||
] | ||
|
||
ignore = [ | ||
# pydocstyle | ||
"D100", | ||
"D104", | ||
"D105", | ||
"D107", | ||
"D203", | ||
"D212", | ||
"D214", | ||
"D215", | ||
"D301", | ||
"D400", | ||
"D401", | ||
"D402", | ||
"D404", | ||
"D405", | ||
"D406", | ||
"D407", | ||
"D408", | ||
"D409", | ||
"D410", | ||
"D411", | ||
"D412", | ||
"D413", | ||
"D414", | ||
"D416", | ||
"D417", | ||
# pep8-naming | ||
"N802", | ||
"N806", | ||
"N815", | ||
] | ||
|
||
[lint.per-file-ignores] | ||
"tests/test_*.py" = [ | ||
"D103", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Changelog | ||
Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<major>`.`<minor>`.`<patch>`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 - Present S. Co1 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# py-template | ||
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) | ||
[![Code style: black](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black) | ||
|
||
It's a Python project template! |
Oops, something went wrong.