Skip to content

Commit c25b2ba

Browse files
authored
Initial commit
0 parents  commit c25b2ba

23 files changed

+2895
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "template-python",
3+
// https://mcr.microsoft.com/en-us/product/devcontainers/python/tags
4+
"image": "mcr.microsoft.com/devcontainers/python:dev-3.13-bookworm",
5+
"customizations": {
6+
"vscode": {
7+
"extensions": [
8+
"ms-python.python",
9+
"charliermarsh.ruff",
10+
"GitHub.copilot-chat"
11+
]
12+
}
13+
},
14+
"postCreateCommand": "pipx install uv && make install-deps-dev",
15+
"remoteUser": "vscode"
16+
}

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.git
2+
.github
3+
.venv
4+
*.pyc
5+
*.env
6+
.coverage
7+
.devcontainer
8+
.gitignore
9+
.pre-commit-config.yaml
10+
.pytest_cache
11+
.ruff_cache
12+
__pycache__
13+
tests

.github/dependabot.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories#supported-ecosystems-and-repositories
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
- package-ecosystem: "uv"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: docker-release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
jobs:
7+
release:
8+
runs-on: "ubuntu-latest"
9+
timeout-minutes: 5
10+
steps:
11+
- name: Check out the repo
12+
uses: actions/checkout@v4
13+
- name: Log in to Docker Hub
14+
uses: docker/login-action@v3
15+
with:
16+
username: ${{ secrets.DOCKERHUB_USERNAME }}
17+
password: ${{ secrets.DOCKERHUB_TOKEN }}
18+
# https://github.com/docker/build-push-action/issues/42#issuecomment-915323168
19+
- name: Set Versions
20+
uses: actions/github-script@v7
21+
id: set_version
22+
with:
23+
script: |
24+
const tag = context.ref.substring(10)
25+
const no_v = tag.replace('v', '')
26+
const dash_index = no_v.lastIndexOf('-')
27+
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
28+
core.setOutput('tag', tag)
29+
core.setOutput('no-v', no_v)
30+
core.setOutput('no-dash', no_dash)
31+
- name: Build and push tag ${{steps.set_version.outputs.no-dash}}
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: .
35+
push: true
36+
build-args: |
37+
GIT_REVISION=${{ github.sha }}
38+
GIT_TAG=${{steps.set_version.outputs.no-dash}}
39+
tags: |
40+
${{ secrets.DOCKERHUB_USERNAME }}/template-python:${{steps.set_version.outputs.no-dash}}
41+
${{ secrets.DOCKERHUB_USERNAME }}/template-python:latest

.github/workflows/docker.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: docker
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "feature/**"
8+
pull_request:
9+
branches:
10+
- "main"
11+
12+
jobs:
13+
docker:
14+
runs-on: "ubuntu-latest"
15+
timeout-minutes: 5
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # to retrieve git tags
20+
# How to set system path variable in github action workflow: https://stackoverflow.com/a/68214331
21+
- name: Add to PATH
22+
shell: bash
23+
run: |
24+
echo "/home/runner/bin" >> $GITHUB_PATH
25+
- name: Run CI tests for Docker
26+
shell: bash
27+
run: |
28+
make ci-test-docker TOOLS_DIR="/home/runner/bin"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ghcr
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
env:
7+
IMAGE_NAME: template-python
8+
jobs:
9+
ghcr:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
permissions:
13+
packages: write
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: docker/login-action@v3
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Set Versions
23+
uses: actions/github-script@v7
24+
id: set_version
25+
with:
26+
script: |
27+
const tag = context.ref.substring(10)
28+
const no_v = tag.replace('v', '')
29+
const dash_index = no_v.lastIndexOf('-')
30+
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
31+
core.setOutput('tag', tag)
32+
core.setOutput('no-v', no_v)
33+
core.setOutput('no-dash', no_dash)
34+
- name: Set meta data tag = ${{steps.set_version.outputs.no-dash}}
35+
uses: docker/metadata-action@v5
36+
id: meta
37+
with:
38+
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
39+
tags: |
40+
type=semver,pattern={{version}},value=v${{steps.set_version.outputs.no-dash}}
41+
type=raw,value=latest
42+
- uses: docker/build-push-action@v6
43+
with:
44+
push: true
45+
context: .
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: github-pages
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: write
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Configure Git Credentials
14+
run: |
15+
git config user.name github-actions[bot]
16+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.x
20+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
21+
- uses: actions/cache@v4
22+
with:
23+
key: mkdocs-material-${{ env.cache_id }}
24+
path: .cache
25+
restore-keys: |
26+
mkdocs-material-
27+
- run: pip install mkdocs-material
28+
- run: mkdocs gh-deploy --force

.github/workflows/test.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "feature/**"
8+
- "copilot/**"
9+
pull_request:
10+
branches:
11+
- "main"
12+
13+
jobs:
14+
test:
15+
strategy:
16+
matrix:
17+
platform:
18+
- "ubuntu-latest"
19+
python-version:
20+
- "3.13"
21+
runs-on: ${{ matrix.platform }}
22+
timeout-minutes: 5
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up uv
26+
shell: bash
27+
run: pipx install uv
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
- name: Run CI tests
33+
shell: bash
34+
run: |
35+
make ci-test
36+
make ci-test-docs

.gitignore

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/
161+
162+
# Project
163+
*.env
164+
requirements.txt

0 commit comments

Comments
 (0)