generated from AtticusZeller/python-uv-package
-
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
Atticus Zeller
authored
Jan 7, 2025
0 parents
commit 1935693
Showing
247 changed files
with
244,654 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,16 @@ | ||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: "chore(rye)" | ||
|
||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: "ci(github-actions)" |
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,34 @@ | ||
name: mkdocs | ||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
with: | ||
# get full git commit to adjust for git-revision-date-localized plugin | ||
fetch-depth: 0 | ||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: install dependencies and deploy | ||
run: | | ||
uv sync --only-group docs | ||
uv run mkdocs gh-deploy --force | ||
# Reference | ||
# 1. https://squidfunk.github.io/mkdocs-material/publishing-your-site/ | ||
# 2. /~https://github.com/Kludex/python-template/blob/main/.github/workflows/docs.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,102 @@ | ||
name: Test And Release | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
name: Run Tests / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
run: uv python install ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: uv sync --python ${{ matrix.python-version }} --all-extras --dev | ||
|
||
- name: Run tests | ||
run: uv run bash scripts/test.sh | ||
|
||
- name: Run linters | ||
run: uv run bash scripts/lint.sh | ||
|
||
release: | ||
name: Bump Version and Release | ||
needs: test | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
permissions: | ||
id-token: write # enable for OIDC [4,5] | ||
contents: write | ||
|
||
outputs: | ||
version: ${{ steps.inspect_package.outputs.version }} | ||
package: ${{ steps.inspect_package.outputs.package }} | ||
|
||
environment: | ||
name: pypi # display pypi in page | ||
url: https://pypi.org/project/${{ steps.inspect_package.outputs.package }}/${{ steps.inspect_package.outputs.version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Install dependencies | ||
run: uv sync --dev | ||
|
||
# add trusted-publishers on pypi first[6] | ||
- name: Build | ||
run: uv build | ||
|
||
- name: Inspect package version | ||
id: inspect_package | ||
run: | | ||
version=$(uvx hatchling version) | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
package=$(uvx hatchling metadata | jq -r .name) | ||
echo "package=$package" >> "$GITHUB_OUTPUT" | ||
- name: Publish | ||
run: uv publish | ||
|
||
- name: Generate a changelog | ||
env: | ||
ATTICUS_PAT: ${{ secrets.ATTICUS_PAT }} | ||
run: uv run git-cliff -vv --latest --strip header --github-token "$ATTICUS_PAT" -o CHANGES.md | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
body_path: CHANGES.md | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Reference | ||
# 1. https://docs.astral.sh/uv/guides/integration/github/#syncing-and-running | ||
# 2. /~https://github.com/Kludex/python-template/blob/main/.github/workflows/main.yml | ||
# 3. /~https://github.com/softprops/action-gh-release/tree/master/ | ||
# 4. https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings | ||
# 5. https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi | ||
# 6. https://docs.pypi.org/trusted-publishers/adding-a-publisher/ |
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,163 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/#use-with-ide | ||
.pdm.toml | ||
|
||
# UV | ||
.ruff_cache/ | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at /~https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
.idea/ |
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,50 @@ | ||
# https://pre-commit.com/ | ||
# `pre-commit install` to set up the git hook scripts | ||
# `pre-commit autoupdate` to update repos | ||
# `pre-commit run --all-files` run hooks for all file | ||
exclude: (^|/)\..* # exclude hidden files or folder | ||
repos: | ||
- repo: /~https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: check-toml | ||
- id: check-yaml | ||
args: ["--unsafe"] | ||
- id: check-json | ||
- id: check-added-large-files | ||
args: ["--maxkb=51200"] | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: detect-private-key | ||
- id: destroyed-symlinks | ||
- id: check-vcs-permalinks | ||
# spell check | ||
- repo: /~https://github.com/codespell-project/codespell | ||
rev: v2.3.0 | ||
hooks: | ||
- id: codespell | ||
files: \.(py|sh|rst|yml|yaml|md)$ | ||
args: [--write-changes] | ||
# lint and format | ||
- repo: /~https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.8.6 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format | ||
# - repo: /~https://github.com/hadolint/hadolint | ||
# rev: v2.12.0 | ||
# hooks: | ||
# - id: hadolint | ||
# name: Lint Dockerfiles | ||
# description: Runs hadolint to lint Dockerfiles | ||
# language: system | ||
# types: ["dockerfile"] | ||
# entry: hadolint | ||
ci: | ||
# Settings for the https://pre-commit.ci/ continuous integration service | ||
autofix_prs: True | ||
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks | ||
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate | ||
autoupdate_schedule: monthly |
Oops, something went wrong.