Skip to content

Commit 51e5971

Browse files
committed
initial pull from cookieutter-uv example; not yet functional
1 parent aa17fd8 commit 51e5971

28 files changed

+2383
-483
lines changed

.devcontainer/devcontainer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "python-package",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
7+
"runArgs": [
8+
// avoid UID/GID remapping under rootless Podman
9+
"--userns=keep-id"
10+
],
11+
"features": {},
12+
13+
// Use 'postCreateCommand' to run commands after the container is created.
14+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
15+
16+
// Configure tool-specific properties.
17+
"customizations": {
18+
"vscode": {
19+
"extensions": ["ms-python.python", "editorconfig.editorconfig"],
20+
"settings": {
21+
"python.testing.pytestArgs": ["tests"],
22+
"python.testing.unittestEnabled": false,
23+
"python.testing.pytestEnabled": true,
24+
"python.defaultInterpreterPath": "/workspaces/python-package/.venv/bin/python",
25+
"python.testing.pytestPath": "/workspaces/python-package/.venv/bin/pytest"
26+
}
27+
}
28+
}
29+
}

.devcontainer/postCreateCommand.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /usr/bin/env bash
2+
3+
# Install uv
4+
curl -LsSf https://astral.sh/uv/install.sh | sh
5+
6+
# Install Dependencies
7+
uv sync
8+
9+
# Install pre-commit hooks
10+
uv run pre-commit install --install-hooks
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Setup Python Environment"
2+
description: "Set up Python environment for the given Python version"
3+
4+
inputs:
5+
python-version:
6+
description: "Python version to use"
7+
required: true
8+
default: "3.12"
9+
uv-version:
10+
description: "uv version to use"
11+
required: true
12+
default: "0.6.14"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ inputs.python-version }}
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
version: ${{ inputs.uv-version }}
25+
enable-cache: 'true'
26+
cache-suffix: ${{ matrix.python-version }}
27+
28+
- name: Install Python dependencies
29+
run: uv sync --frozen
30+
shell: bash

.github/workflows/labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
https://raw.githubusercontent.com/biocommons/.github/main/etc/labels.yml
2727
.github/labels.yml
2828
29-
delete-other-labels: false
29+
delete-other-labels: false

.github/workflows/main.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
quality:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out
15+
uses: actions/checkout@v4
16+
17+
- uses: actions/cache@v4
18+
with:
19+
path: ~/.cache/pre-commit
20+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21+
22+
- name: Set up the environment
23+
uses: ./.github/actions/setup-python-env
24+
25+
- name: Run checks
26+
run: make check
27+
28+
tests-and-type-check:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
33+
fail-fast: false
34+
defaults:
35+
run:
36+
shell: bash
37+
steps:
38+
- name: Check out
39+
uses: actions/checkout@v4
40+
41+
- name: Set up the environment
42+
uses: ./.github/actions/setup-python-env
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Run tests
47+
run: uv run python -m pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
48+
49+
- name: Check typing
50+
run: uv run ty check
51+
52+
53+
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
54+
uses: codecov/codecov-action@v4
55+
if: ${{ matrix.python-version == '3.11' }}
56+
env:
57+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
58+
59+
check-docs:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Check out
63+
uses: actions/checkout@v4
64+
65+
- name: Set up the environment
66+
uses: ./.github/actions/setup-python-env
67+
68+
- name: Check if documentation can be built
69+
run: uv run mkdocs build -s
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: release-main
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
set-version:
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Export tag
15+
id: vars
16+
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
17+
if: ${{ github.event_name == 'release' }}
18+
19+
- name: Update project version
20+
run: |
21+
sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" pyproject.toml
22+
env:
23+
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
24+
if: ${{ github.event_name == 'release' }}
25+
26+
- name: Upload updated pyproject.toml
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: pyproject-toml
30+
path: pyproject.toml
31+
32+
publish:
33+
runs-on: ubuntu-latest
34+
needs: [set-version]
35+
steps:
36+
- name: Check out
37+
uses: actions/checkout@v4
38+
39+
- name: Set up the environment
40+
uses: ./.github/actions/setup-python-env
41+
42+
- name: Download updated pyproject.toml
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: pyproject-toml
46+
47+
- name: Build package
48+
run: uv build
49+
50+
- name: Publish package
51+
run: uv publish
52+
env:
53+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
54+
55+
deploy-docs:
56+
needs: publish
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Check out
60+
uses: actions/checkout@v4
61+
62+
- name: Set up the environment
63+
uses: ./.github/actions/setup-python-env
64+
65+
- name: Deploy documentation
66+
run: uv run mkdocs gh-deploy --force
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: validate-codecov-config
2+
3+
on:
4+
pull_request:
5+
paths: [codecov.yaml]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
validate-codecov-config:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Validate codecov configuration
15+
run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate

0 commit comments

Comments
 (0)