Skip to content

Commit ee1e7cd

Browse files
committed
0 parents  commit ee1e7cd

22 files changed

Lines changed: 1685 additions & 0 deletions

.devcontainer/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ARG VARIANT="3"
2+
3+
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
4+
5+
ARG POETRY_VERSION="1.8.2"
6+
ARG POETRY_SRC="https://install.python-poetry.org"
7+
8+
USER vscode
9+
WORKDIR /home/vscode
10+
11+
RUN curl -fsSL -o install-poetry.py "${POETRY_SRC}" \
12+
&& python install-poetry.py --version $POETRY_VERSION \
13+
&& rm install-poetry.py
14+
15+
RUN mkdir -p .config/git \
16+
&& echo ".vscode/*" >> .config/git/ignore \
17+
&& echo "*.code-workspace" >> .config/git/ignore \
18+
&& echo ".history/" >> .config/git/ignore

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
3+
"name": "Python",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"args": {
7+
"POETRY_VERSION": "1.8.2",
8+
"VARIANT": "3.12"
9+
}
10+
},
11+
"remoteEnv": {
12+
"POETRY_VIRTUALENVS_IN_PROJECT": "true",
13+
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin"
14+
},
15+
"extensions": [
16+
"ms-vsliveshare.vsliveshare",
17+
"ms-python.python",
18+
"EditorConfig.EditorConfig"
19+
],
20+
"postCreateCommand": "poetry install",
21+
"remoteUser": "vscode"
22+
}

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2
10+
11+
[*.py]
12+
indent_size = 4
13+
14+
[Makefile]
15+
indent_style = tab

.github/actions/setup/action.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: Setup
3+
description: Setup Python and install dependencies.
4+
5+
inputs:
6+
python_version:
7+
description: The Python version.
8+
required: false
9+
default: '3.12'
10+
poetry_version:
11+
description: The Poetry version.
12+
required: false
13+
default: '1.8.2'
14+
install_dependencies:
15+
description: Install dependencies.
16+
required: false
17+
default: 'true'
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Setup Poetry cache on Linux
23+
uses: actions/cache@v4
24+
if: runner.os == 'Linux'
25+
with:
26+
key: poetry-${{ inputs.poetry_version }}-${{ inputs.python_version }}-${{ runner.os }}-${{ runner.arch }}
27+
path: |
28+
~/.local/bin
29+
~/.local/share/pypoetry
30+
- name: Setup Poetry cache on macOS
31+
uses: actions/cache@v4
32+
if: runner.os == 'macOS'
33+
with:
34+
key: poetry-${{ inputs.poetry_version }}-${{ inputs.python_version }}-${{ runner.os }}-${{ runner.arch }}
35+
path: |
36+
~/.local/bin
37+
~/.local/share/pypoetry
38+
~/Library/Application Support/pypoetry
39+
- name: Setup Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: ${{ inputs.python_version }}
43+
- name: Setup Poetry
44+
uses: Gr1N/setup-poetry@v9
45+
with:
46+
poetry-version: ${{ inputs.poetry_version }}
47+
- name: Setup Python with cache
48+
uses: actions/setup-python@v5
49+
if: inputs.install_dependencies == 'true'
50+
with:
51+
cache: poetry
52+
python-version: ${{ inputs.python_version }}
53+
- name: Check lockfile
54+
if: inputs.install_dependencies == 'true'
55+
shell: bash
56+
run: poetry check --lock
57+
- name: Install dependencies
58+
if: inputs.install_dependencies == 'true'
59+
shell: bash
60+
run: poetry install --sync

.github/workflows/_build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: _build
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
python_version:
8+
description: The Python version.
9+
type: string
10+
required: false
11+
default: '3.12'
12+
runs_on:
13+
description: The runner environment.
14+
type: string
15+
required: false
16+
default: ubuntu-latest
17+
upload_artifact:
18+
description: Upload the built artifact.
19+
type: string
20+
required: false
21+
default: 'false'
22+
outputs:
23+
artifact_name:
24+
description: The artifact name.
25+
value: build-${{ github.sha }}
26+
27+
jobs:
28+
build:
29+
name: Package
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 30
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
- name: Setup
36+
uses: ./.github/actions/setup
37+
with:
38+
python_version: ${{ inputs.python_version }}
39+
- name: Build
40+
run: make build
41+
- name: Upload artifact
42+
uses: actions/upload-artifact@v4
43+
if: inputs.upload_artifact == 'true'
44+
with:
45+
name: build-${{ github.sha }}
46+
if-no-files-found: error
47+
path: dist/

.github/workflows/_publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: _publish
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
artifact_name:
8+
description: The artifact name.
9+
type: string
10+
required: true
11+
secrets:
12+
registry_token:
13+
description: The package registry token.
14+
required: true
15+
16+
jobs:
17+
publish:
18+
name: Publish package
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 30
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
- name: Setup
25+
uses: ./.github/actions/setup
26+
with:
27+
install_dependencies: 'false'
28+
- name: Download artifact
29+
uses: actions/download-artifact@v4
30+
with:
31+
name: ${{ inputs.artifact_name }}
32+
path: dist/
33+
- name: Publish
34+
run: poetry publish --skip-existing -u $USERNAME -p $PASSWORD
35+
env:
36+
USERNAME: __token__
37+
PASSWORD: ${{ secrets.registry_token }}

.github/workflows/check.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
name: Check
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- '**'
11+
12+
jobs:
13+
test:
14+
name: Test (Python ${{ matrix.python }} on ${{ matrix.os_name }})
15+
runs-on: ${{ matrix.os }}
16+
timeout-minutes: 30
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os:
21+
- ubuntu-latest
22+
- macos-latest
23+
- windows-latest
24+
python:
25+
- '3.11'
26+
- '3.12'
27+
include:
28+
- os: ubuntu-latest
29+
os_name: Linux
30+
- os: macos-latest
31+
os_name: macOS
32+
- os: windows-latest
33+
os_name: Windows
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Setup
38+
uses: ./.github/actions/setup
39+
with:
40+
python_version: ${{ matrix.python }}
41+
- name: Test
42+
run: make test
43+
lint:
44+
name: Lint (Python ${{ matrix.python }})
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 30
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
python:
51+
- '3.11'
52+
- '3.12'
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
- name: Setup
57+
uses: ./.github/actions/setup
58+
with:
59+
python_version: ${{ matrix.python }}
60+
- name: Lint
61+
run: make lint
62+
build:
63+
name: Build (Python ${{ matrix.python }} on ${{ matrix.os_name }})
64+
uses: ./.github/workflows/_build.yml
65+
with:
66+
python_version: ${{ matrix.python }}
67+
runs_on: ${{ matrix.os }}
68+
upload_artifact: ${{ matrix.python == '3.11' && matrix.os == 'ubuntu-latest' }}
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
os:
73+
- ubuntu-latest
74+
- macos-latest
75+
- windows-latest
76+
python:
77+
- '3.11'
78+
- '3.12'
79+
include:
80+
- os: ubuntu-latest
81+
os_name: Linux
82+
- os: macos-latest
83+
os_name: macOS
84+
- os: windows-latest
85+
os_name: Windows
86+
install:
87+
name: Install (Python ${{ matrix.python }} on ${{ matrix.os_name }})
88+
runs-on: ${{ matrix.os }}
89+
timeout-minutes: 30
90+
needs: build
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
os:
95+
- ubuntu-latest
96+
- macos-latest
97+
- windows-latest
98+
python:
99+
- '3.11'
100+
- '3.12'
101+
include:
102+
- os: ubuntu-latest
103+
os_name: Linux
104+
- os: macos-latest
105+
os_name: macOS
106+
- os: windows-latest
107+
os_name: Windows
108+
steps:
109+
- name: Setup Python
110+
uses: actions/setup-python@v5
111+
with:
112+
python-version: ${{ matrix.python }}
113+
- name: Download artifact
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: ${{ needs.build.outputs.artifact_name }}
117+
path: .
118+
- name: Find wheels
119+
uses: tj-actions/glob@v21
120+
id: wheels
121+
with:
122+
files: '*.whl'
123+
- name: Install
124+
run: pip install ${{ steps.wheels.outputs.paths }}
125+
- name: Create main.py
126+
uses: DamianReeves/write-file-action@v1.3
127+
with:
128+
write-mode: overwrite
129+
path: main.py
130+
contents: |
131+
import seam
132+
- name: Run
133+
run: python main.py

.github/workflows/format.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Format
3+
4+
on:
5+
push:
6+
branches-ignore:
7+
- main
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
commit:
12+
name: Format code
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.head_ref }}
20+
token: ${{ secrets.GH_TOKEN }}
21+
- name: Import GPG key
22+
uses: crazy-max/ghaction-import-gpg@v6
23+
with:
24+
git_user_signingkey: true
25+
git_commit_gpgsign: true
26+
git_committer_name: ${{ secrets.GIT_USER_NAME }}
27+
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
28+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
29+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
30+
- name: Setup
31+
uses: ./.github/actions/setup
32+
- name: Format
33+
run: make format
34+
- name: Commit
35+
uses: stefanzweifel/git-auto-commit-action@v5
36+
if: always()
37+
with:
38+
commit_message: Run format
39+
commit_user_name: ${{ secrets.GIT_USER_NAME }}
40+
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
41+
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>

0 commit comments

Comments
 (0)