Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Changes here will be overwritten by Copier
_commit: v0.0.5-57-g045b3f3
_commit: v0.0.6-6-g2b24a38
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
description: Copier template for creating Python libraries and executables
python_ci_versions:
- 3.12.7
- 3.13.1
- 3.13.2
python_version: 3.12.7
repo_name: copier-python-package-template
repo_org_name: LabAutomationAndScreening
ssh_port_number: 55874
template_uses_pulumi: false
template_uses_python: true
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/install-ci-tooling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# can pass in the full major.minor.patch version of python as an optional argument
set -ex

curl -LsSf https://astral.sh/uv/0.5.28/install.sh | sh
curl -LsSf https://astral.sh/uv/0.6.6/install.sh | sh
uv --version
# TODO: add uv autocompletion to the shell https://docs.astral.sh/uv/getting-started/installation/#shell-autocompletion

Expand All @@ -15,8 +15,8 @@ input="${1:-$default_version}"
export UV_PYTHON="$input"
export UV_PYTHON_PREFERENCE=only-system

uv tool install 'copier==9.4.1' --with 'copier-templates-extensions==0.3.0'
uv tool install 'copier==9.5.0' --with 'copier-templates-extensions==0.3.0'

uv tool install 'pre-commit==4.0.1'
uv tool install 'pre-commit==4.1.0'

uv tool list
2 changes: 1 addition & 1 deletion .github/actions/install_deps_uv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
shell: bash

- name: Setup python
uses: actions/setup-python@v5.3.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand Down
6 changes: 3 additions & 3 deletions .github/actions/install_deps_uv/install-ci-tooling.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

irm https://astral.sh/uv/0.5.28/install.ps1 | iex
irm https://astral.sh/uv/0.6.6/install.ps1 | iex

# Add uv to path (in github runner)
$env:Path = "C:\Users\runneradmin\.local\bin;$env:Path"
Expand All @@ -24,8 +24,8 @@ if ($args.Count -eq 0) {
$env:UV_PYTHON = "$input"
$env:UV_PYTHON_PREFERENCE="only-system"

& uv tool install 'copier==9.4.1' --with 'copier-templates-extensions==0.3.0'
& uv tool install 'copier==9.5.0' --with 'copier-templates-extensions==0.3.0'

& uv tool install 'pre-commit==4.0.1'
& uv tool install 'pre-commit==4.1.0'

& uv tool list
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: Set up mutex # Github concurrency management is horrible, things get arbitrarily cancelled if queued up. So using mutex until github fixes itself. When multiple jobs are modifying cache at once, weird things can happen. possible issue is https://github.com/actions/toolkit/issues/658
if: ${{ runner.os != 'Windows' }} # we're just gonna have to YOLO on Windows, because this action doesn't support it yet https://github.com/ben-z/gh-action-mutex/issues/14
uses: ben-z/gh-action-mutex@d3d5b354d460d4b6a1e3ee5b7951678658327812 # v1.0.0-alpha.9
uses: ben-z/gh-action-mutex@1ebad517141198e08d47cf72f3c0975316620a65 # v1.0.0-alpha.10
with:
branch: mutex-venv-${{ matrix.os }}-${{ matrix.python-version }}
timeout-minutes: 30 # this is the amount of time this action will wait to attempt to acquire the mutex lock before failing, e.g. if other jobs are queued up in front of it
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:

- 3.12.7

- 3.13.1
- 3.13.2

copier: [
'--data-file tests/copier_data/data1.yaml',
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:

- name: Set up mutex # Github concurrency management is horrible, things get arbitrarily cancelled if queued up. So using mutex until github fixes itself. When multiple jobs are modifying cache at once, weird things can happen. possible issue is https://github.com/actions/toolkit/issues/658
if: ${{ runner.os != 'Windows' }} # we're just gonna have to YOLO on Windows, because this action doesn't support it yet https://github.com/ben-z/gh-action-mutex/issues/14
uses: ben-z/gh-action-mutex@d3d5b354d460d4b6a1e3ee5b7951678658327812 # v1.0.0-alpha.9
uses: ben-z/gh-action-mutex@1ebad517141198e08d47cf72f3c0975316620a65 # v1.0.0-alpha.10
with:
branch: mutex-venv-${{ matrix.os }}-${{ matrix.python-version }}
timeout-minutes: 30 # this is the amount of time this action will wait to attempt to acquire the mutex lock before failing, e.g. if other jobs are queued up in front of it
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:

# Reformatting (should generally come before any file format or other checks, because reformatting can change things)
- repo: https://github.com/crate-ci/typos
rev: e59f226fadcb05a1440bd8b35ee994a9d21bf03b # frozen: typos-dict-v0.12.4
rev: 2300ad1b6b5c37da54bcafb1a06211196503eac9 # frozen: v1
hooks:
- id: typos
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -162,7 +162,7 @@ repos:
description: Runs hadolint to lint Dockerfiles

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 871f3bcae4fe473cd7109c3a068db975dc035e3b # frozen: v0.9.4
rev: 41d2daf392fbf43341a77f24a9c6481a4b66af98 # frozen: v0.9.10
hooks:
- id: ruff
name: ruff-src
Expand All @@ -175,7 +175,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pylint-dev/pylint
rev: c2b01c3d0b6410d4c93eb1f32fb28f2116b1e68f # frozen: v3.3.4
rev: aaab3ccb541532d2bcdf0410ab93ff4fafc266f5 # frozen: v3.3.5
hooks:
- id: pylint
name: pylint
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-black.json)](https://github.com/copier-org/copier)
[![Actions status](https://www.github.com/LabAutomationAndScreening/copier-python-package-template/actions/workflows/ci.yaml/badge.svg?branch=main)](https://www.github.com/LabAutomationAndScreening/copier-python-package-template/actions)
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://www.github.com/LabAutomationAndScreening/copier-python-package-template)


# Usage
To create a new repository using this template:
1. Install `copier` and `copier-templates-extensions`. An easy way to do that is to copy the `.devcontainer/install-ci-tooling.sh` script in this repository into your new repo and then run it.
2. Run copier to instantiate the template: `copier copy --trust gh:LabAutomationAndScreening/copier-python-package-template.git`
3. Run `uv lock` to generate the lock file
4. Commit the changes
5. Rebuild your new devcontainer





# Development


## Updating from the template
Expand Down
7 changes: 6 additions & 1 deletion copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ python_ci_versions:
multiselect: true
choices:
- "3.12.7"
- "3.13.1"
- "3.13.2"



Expand Down Expand Up @@ -67,6 +67,11 @@ use_windows_in_exe_ci:
default: no
when: is_frozen_executable

use_codecov:
type: bool
help: Upload code coverage results to CodeCov?
default: no


# Additional Settings
_min_copier_version: "9.4"
Expand Down
19 changes: 10 additions & 9 deletions extensions/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,35 @@ class ContextUpdater(ContextHook):

@override
def hook(self, context: dict[Any, Any]) -> dict[Any, Any]:
context["uv_version"] = "0.5.28"
context["pre_commit_version"] = "4.0.1"
context["pyright_version"] = "1.1.394"
context["uv_version"] = "0.6.6"
context["pre_commit_version"] = "4.1.0"
context["pyright_version"] = "1.1.396"
context["pytest_version"] = "8.3.4"
context["pytest_randomly_version"] = "3.16.0"
context["pytest_cov_version"] = "6.0.0"
context["copier_version"] = "9.4.1"
context["copier_version"] = "9.5.0"
context["copier_templates_extension_version"] = "0.3.0"
context["sphinx_version"] = "8.1.3"
context["pulumi_version"] = "3.149.0"
context["pulumi_version"] = "3.155.0"
context["pulumi_aws_version"] = "6.67.0"
context["pulumi_aws_native_version"] = "1.25.0"
context["pulumi_command_version"] = "1.0.1"
context["boto3_version"] = "1.36.3"
context["pulumi_github"] = ""
context["boto3_version"] = "1.37.11"
context["ephemeral_pulumi_deploy_version"] = "0.0.2"
context["pydantic_version"] = "2.10.6"
context["pyinstaller_version"] = "6.12.0"

context["gha_checkout"] = "v4.2.2"
context["gha_setup_python"] = "v5.3.0"
context["gha_setup_python"] = "v5.4.0"
context["gha_cache"] = "v4.2.0"
context["gha_upload_artifact"] = "v4.4.3"
context["gha_configure_aws_credentials"] = "v4.0.2"
context["gha_mutex"] = "d3d5b354d460d4b6a1e3ee5b7951678658327812 # v1.0.0-alpha.9"
context["gha_mutex"] = "1ebad517141198e08d47cf72f3c0975316620a65 # v1.0.0-alpha.10"
context["gha_linux_runner"] = "ubuntu-24.04"
context["gha_windows_runner"] = "windows-2022"

context["py311_version"] = ""
context["py312_version"] = "3.12.7"
context["py313_version"] = "3.13.1"
context["py313_version"] = "3.13.2"
return context
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dependencies = [
"pytest>=8.3.4",
"pytest-cov>=6.0.0",
"pytest-randomly>=3.16.0",
"pyright[nodejs]>=1.1.394",
"copier>=9.4.1",
"pyright[nodejs]>=1.1.396",
"copier>=9.5.0",
"copier-templates-extensions>=0.3.0"

# Specific to this template
Expand Down
2 changes: 1 addition & 1 deletion template/.github/actions/install_deps_uv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
shell: bash

- name: Setup python
uses: actions/setup-python@v5.3.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ env.PYTHON_VERSION }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

irm https://astral.sh/uv/0.5.28/install.ps1 | iex
irm https://astral.sh/uv/0.6.6/install.ps1 | iex

# Add uv to path (in github runner)
$env:Path = "C:\Users\runneradmin\.local\bin;$env:Path"
Expand All @@ -24,8 +24,8 @@ if ($args.Count -eq 0) {
$env:UV_PYTHON = "$input"
$env:UV_PYTHON_PREFERENCE="only-system"

& uv tool install 'copier==9.4.1' --with 'copier-templates-extensions==0.3.0'
& uv tool install 'copier==9.5.0' --with 'copier-templates-extensions==0.3.0'

& uv tool install 'pre-commit==4.0.1'
& uv tool install 'pre-commit==4.1.0'

& uv tool list
4 changes: 2 additions & 2 deletions template/.github/workflows/ci.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Unit test
run: uv run pytest tests/unit --cov-report=xml --durations=5

- name: Upload coverage to Codecov
{% endraw %}{% if use_codecov %}{% raw %} - name: Upload coverage to Codecov
# only upload coverage from fastest job
if: matrix.JOB_MATCHING_DEV_ENV == true
uses: codecov/codecov-action@v5.1.1
Expand All @@ -88,7 +88,7 @@ jobs:
name: codecov-umbrella
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: {% endraw %}{{ full_repo_url | replace("https://github.com/", "") }}{% raw %}
slug: {% endraw %}{{ full_repo_url | replace("https://github.com/", "") }}{% raw %}{% endraw %}{% endif %}{% raw %}

{% endraw %}{% if is_frozen_executable %}{% raw %} executable:
needs: [ test ]
Expand Down
6 changes: 3 additions & 3 deletions template/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:

# Reformatting (should generally come before any file format or other checks, because reformatting can change things)
- repo: https://github.com/crate-ci/typos
rev: e59f226fadcb05a1440bd8b35ee994a9d21bf03b # frozen: typos-dict-v0.12.4
rev: 2300ad1b6b5c37da54bcafb1a06211196503eac9 # frozen: v1
hooks:
- id: typos
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -162,7 +162,7 @@ repos:
description: Runs hadolint to lint Dockerfiles

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 871f3bcae4fe473cd7109c3a068db975dc035e3b # frozen: v0.9.4
rev: 41d2daf392fbf43341a77f24a9c6481a4b66af98 # frozen: v0.9.10
hooks:
- id: ruff
name: ruff-src
Expand All @@ -175,7 +175,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pylint-dev/pylint
rev: c2b01c3d0b6410d4c93eb1f32fb28f2116b1e68f # frozen: v3.3.4
rev: aaab3ccb541532d2bcdf0410ab93ff4fafc266f5 # frozen: v3.3.5
hooks:
- id: pylint
name: pylint
Expand Down
4 changes: 2 additions & 2 deletions template/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
[![PyPI Version](https://img.shields.io/pypi/v/{% endraw %}{{ package_name }}{% raw %}.svg)](https://pypi.org/project/{% endraw %}{{ package_name }}{% raw %}/)
[![Downloads](https://pepy.tech/badge/{% endraw %}{{ package_name }}{% raw %})](https://pepy.tech/project/{% endraw %}{{ package_name }}{% raw %})
[![Python Versions](https://img.shields.io/pypi/pyversions/{% endraw %}{{ package_name }}{% raw %}.svg)](https://pypi.org/project/{% endraw %}{{ package_name }}{% raw %}/)
{% endraw %}{% endif %}{% raw %}[![Codecov](https://codecov.io/gh/{% endraw %}{{ full_repo_url | replace("https://github.com/", "") }}{% raw %}/branch/main/graph/badge.svg)](https://codecov.io/gh/{% endraw %}{{ full_repo_url | replace("https://github.com/", "") }}{% raw %})
[![Documentation Status](https://readthedocs.org/projects/{% endraw %}{{ package_name }}{% raw %}/badge/?version=latest)](https://{% endraw %}{{ package_name }}{% raw %}.readthedocs.io/en/latest/?badge=latest)
{% endraw %}{% endif %}{% raw %}[![Codecov](https://codecov.io/gh/{% endraw %}{{ full_repo_url | replace("https://github.com/", "") }}{% raw %}/branch/main/graph/badge.svg)](https://codecov.io/gh/{% endraw %}{{ full_repo_url | replace("https://github.com/", "") }}{% raw %}){% endraw %}{% if create_docs %}{% raw %}
[![Documentation Status](https://readthedocs.org/projects/{% endraw %}{{ package_name }}{% raw %}/badge/?version=latest)](https://{% endraw %}{{ package_name }}{% raw %}.readthedocs.io/en/latest/?badge=latest){% endraw %}{% endif %}{% raw %}

# Usage
Documentation is hosted on [ReadTheDocs](https://{% endraw %}{{ package_name }}{% raw %}.readthedocs.io/en/latest/?badge=latest).
Expand Down
1 change: 1 addition & 0 deletions tests/copier_data/data1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ full_repo_url: https://www.github.com/foobar
create_docs: no
is_frozen_executable: yes
use_windows_in_exe_ci: yes
use_codecov: yes
3 changes: 2 additions & 1 deletion tests/copier_data/data2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ aws_region_for_stack: us-west-1

python_ci_versions:
- "3.12.7"
- "3.13.1"
- "3.13.2"
package_name: the-amazing-library
primary_author: John Williams
full_repo_url: https://www.github.com/baz
create_docs: yes
is_frozen_executable: no
use_windows_in_exe_ci: no
use_codecov: yes
1 change: 1 addition & 0 deletions tests/copier_data/data3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ full_repo_url: https://www.github.com/foobar
create_docs: no
is_frozen_executable: yes
use_windows_in_exe_ci: no
use_codecov: no
Loading
Loading