-
Notifications
You must be signed in to change notification settings - Fork 1
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 e839ddd
Showing
17 changed files
with
430 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 @@ | ||
* @daniel-mizsak |
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,3 @@ | ||
- [ ] Linting passes | ||
- [ ] Tests are added and passing | ||
- [ ] Documentation is updated |
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,14 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tox: | ||
uses: daniel-mizsak/workflows/.github/workflows/tox.yml@main | ||
with: | ||
python-version: "3.12" |
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,38 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/project/python-package-template-pypi | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up python. | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Upgrade pip. | ||
run: > | ||
python -m pip install --upgrade pip | ||
- name: Install dependencies. | ||
run: > | ||
pip install build | ||
- name: Build the package. | ||
run: > | ||
python -m build | ||
- name: Publish the package. | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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,38 @@ | ||
# Project | ||
|
||
# System | ||
.DS_Store | ||
*.log | ||
|
||
# Byte-compiled | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / Packaging | ||
.eggs/ | ||
*.egg | ||
*.egg-info/ | ||
build/ | ||
dist/ | ||
eggs/ | ||
sdist/ | ||
wheels/ | ||
|
||
# Unit test / Coverage reports | ||
.coverage | ||
.tox | ||
htmlcov/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
|
||
# IDE | ||
.idea/ | ||
.vscode/ |
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,30 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
# exclude: "" | ||
|
||
# pre-commit | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: [--maxkb=2000] | ||
- id: check-docstring-first | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: name-tests-test | ||
- id: trailing-whitespace | ||
|
||
# ruff | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.3.1 | ||
hooks: | ||
# Ruff linting | ||
- id: ruff | ||
args: [--line-length=120] | ||
# Ruff formatting | ||
- id: ruff-format |
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) Daniel Mizsak | ||
|
||
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,52 @@ | ||
## <div align="center"> 🐍 python-package-template</div> | ||
|
||
<div align="center"> | ||
<a href="https://github.com/daniel-mizsak/python-package-template/actions/workflows/ci.yml" target="_blank"><img src="https://github.com/daniel-mizsak/python-package-template/actions/workflows/ci.yml/badge.svg" alt="build status"></a> | ||
<a href="https://results.pre-commit.ci/latest/github/daniel-mizsak/python-package-template/main" target="_blank"><img src="https://results.pre-commit.ci/badge/github/daniel-mizsak/python-package-template/main.svg" alt="pre-commit.ci status"></a> | ||
<a href='https://daniel-mizsak-python-package-template.readthedocs.io/en/latest/?badge=latest'><img src='https://readthedocs.org/projects/daniel-mizsak-python-package-template/badge/?version=latest' alt='docs status' /></a> | ||
<a href="ttps://img.shields.io/github/license/daniel-mizsak/python-package-template" target="_blank"><img src="https://img.shields.io/github/license/daniel-mizsak/python-package-template" alt="license"></a> | ||
</div> | ||
|
||
|
||
## Overview | ||
A GitHub template with my python package configurations. | ||
|
||
## GitHub repository settings | ||
Code/About: | ||
- Releases | ||
|
||
General/Features: | ||
- Issues | ||
- Preserve this repository | ||
|
||
General/Pull Requests: | ||
- Allow merge commits | ||
- Allow squash merging | ||
- Allow rebase merging | ||
- Automatically delete head branches | ||
|
||
Branches/Branch protection rules:\ | ||
`main` | ||
- Protect matching branches | ||
- Require pull request reviews before merging | ||
- Dismiss stale pull request approvals when new commits are pushed | ||
- Require status checks to pass before merging | ||
- `pre-commit.ci - pr` | ||
- `tox / tox` | ||
|
||
Environments:\ | ||
`pypi` | ||
- Deployment protection rules: | ||
- Required reviewers: | ||
`daniel-mizsak` | ||
- Allow administrators to bypass configured protection rules | ||
|
||
## Setup PyPi trusted publishing | ||
|
||
[PyPi publishing settings](https://pypi.org/manage/account/publishing/) | ||
|
||
Add a new pending publisher: | ||
- PyPi Project Name: `python-package-template-pypi` (has to match the project name in `pyproject.toml`) | ||
- Owner: `daniel-mizsak` | ||
- Repository name: `https://github.com/daniel-mizsak/python-package-template` | ||
- Workflow name: `release.yml` |
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,6 @@ | ||
Add five | ||
======== | ||
|
||
Description of the `add_five` function: | ||
|
||
.. autofunction:: python_package_template.main.add_five |
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,37 @@ | ||
""" | ||
Configuration file for the Sphinx documentation builder. | ||
For the full list of built-in configuration values, see the documentation: | ||
https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
Built docs locally with: | ||
sphinx-build -b html docs/source/ docs/build/html | ||
@author "Daniel Mizsak" <[email protected]> | ||
""" | ||
|
||
from datetime import UTC, datetime | ||
|
||
from python_package_template import __version__ | ||
|
||
# Project | ||
author = "Daniel Mizsak" | ||
project = "python-package-template" | ||
copyright = f"{datetime.now(tz=UTC).year} {author}" # noqa: A001 | ||
version = __version__ | ||
|
||
# General | ||
master_doc = "index" | ||
source_suffix = ".rst" | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx_copybutton", | ||
] | ||
nitpicky = True | ||
|
||
# HTML | ||
html_theme = "furo" | ||
html_title = "python-package-template" | ||
pygments_style = "sphinx" | ||
pygments_dark_style = "monokai" | ||
html_static_path = ["_static"] |
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,9 @@ | ||
Welcome to python-package-template's documentation! | ||
=================================================== | ||
|
||
This is a template repository for my python packages. | ||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
add_five |
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,116 @@ | ||
# Build System | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
# Project Metadata | ||
[project] | ||
name = "python-package-template-pypi" # Name has to be unique on pypi. | ||
version = "0.0.1" | ||
description = "A github template with my python package configurations." | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
license = { file = "LICENSE" } | ||
authors = [{ name = "Daniel Mizsak", email = "[email protected]" }] | ||
keywords = [] | ||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
dependencies = [] | ||
[project.optional-dependencies] | ||
dev = ["mypy", "pre-commit", "pytest-cov", "pytest", "ruff", "tox"] | ||
docs = ["furo", "sphinx", "sphinx-copybutton"] | ||
[project.urls] | ||
Repository = "https://github.com/daniel-mizsak/python-package-template" | ||
|
||
# Tools | ||
# Hatch | ||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/python_package_template"] | ||
|
||
# MyPy | ||
[tool.mypy] | ||
ignore_missing_imports = true | ||
pretty = true | ||
show_column_numbers = true | ||
show_error_context = true | ||
strict = true | ||
warn_unreachable = true | ||
warn_unused_ignores = true | ||
|
||
# Pytest | ||
[tool.pytest.ini_options] | ||
addopts = "--cov=python_package_template" | ||
testpaths = ["tests"] | ||
|
||
# Ruff | ||
[tool.ruff] | ||
line-length = 120 | ||
[tool.ruff.lint] | ||
select = ["ALL"] | ||
ignore = [ | ||
"D203", # one-blank-line-before-class | ||
"D212", # multi-line-summary-first-line | ||
"FIX", # flake8-fixme | ||
"INP", # flake8-no-pep420 | ||
"S104", # hardcoded-bind-all-interfaces | ||
"TD002", # missing-todo-author | ||
"TD003", # missing-todo-link | ||
] | ||
[tool.ruff.lint.per-file-ignores] | ||
"__init__.py" = [ | ||
"D104", # undocumented-public-package | ||
] | ||
"tests/**/*.py" = [ | ||
"ANN001", # missing-type-function-argument | ||
"ANN201", # missing-return-type-undocumented-public-function | ||
"D", # pydocstyle | ||
"PLR2004", # magic-value-comparison | ||
"S101", # assert | ||
] | ||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" | ||
|
||
# Tox | ||
[tool.tox] | ||
legacy_tox_ini = """ | ||
[tox] | ||
envlist = | ||
py312 | ||
ruff | ||
mypy | ||
docs | ||
skip_missing_interpreters = true | ||
[gh] | ||
python = | ||
3.12 = py312, ruff, mypy, docs | ||
[testenv] | ||
deps = | ||
pytest | ||
pytest-cov | ||
commands = | ||
pytest {posargs:tests} | ||
[testenv:ruff] | ||
deps = | ||
ruff | ||
commands = | ||
ruff check src tests | ||
[testenv:mypy] | ||
deps = | ||
mypy | ||
commands = | ||
mypy src | ||
mypy tests | ||
[testenv:docs] | ||
extras = | ||
docs | ||
commands = | ||
sphinx-build -d "{envtmpdir}{/}doctree" docs "{toxworkdir}{/}docs_out" --color -b 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,18 @@ | ||
version: 2 | ||
|
||
build: | ||
os: "ubuntu-22.04" | ||
tools: | ||
python: "3.12" | ||
|
||
python: | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs | ||
|
||
sphinx: | ||
builder: html | ||
configuration: docs/conf.py | ||
fail_on_warning: true |
Oops, something went wrong.