Skip to content

Commit ba1289f

Browse files
authored
Update to copier 5.0.2 (#91)
1 parent fd1c146 commit ba1289f

26 files changed

Lines changed: 4165 additions & 237 deletions

.copier-answers.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 2.5.0
2+
_commit: 5.0.2
33
_src_path: gh:DiamondLightSource/python-copier-template
44
author_email: gary.yendell@diamond.ac.uk
55
author_name: Gary Yendell
@@ -9,10 +9,12 @@ component_type: service
99
description: Eiger control system integration with FastCS
1010
distribution_name: fastcs-eiger
1111
docker: true
12+
docker_debug: true
1213
docs_type: sphinx
1314
git_platform: github.com
1415
github_org: DiamondLightSource
1516
package_name: fastcs_eiger
1617
pypi: true
1718
repo_name: fastcs-eiger
19+
strict_typing: false
1820
type_checker: pyright

.devcontainer/devcontainer.json

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,29 @@
77
},
88
"remoteEnv": {
99
// Allow X11 apps to run inside the container
10-
"DISPLAY": "${localEnv:DISPLAY}"
10+
"DISPLAY": "${localEnv:DISPLAY}",
11+
// Put things that allow it in the persistent cache
12+
"PRE_COMMIT_HOME": "/cache/pre-commit",
13+
"UV_CACHE_DIR": "/cache/uv",
14+
"UV_PYTHON_CACHE_DIR": "/cache/uv-python",
15+
// Make a venv that is specific for this workspace path as the cache is shared
16+
"UV_PROJECT_ENVIRONMENT": "/cache/venv-for${localWorkspaceFolder}",
17+
// Do the equivalent of "activate" the venv so we don't have to "uv run" everything
18+
"VIRTUAL_ENV": "/cache/venv-for${localWorkspaceFolder}",
19+
"PATH": "/cache/venv-for${localWorkspaceFolder}/bin:${containerEnv:PATH}"
1120
},
1221
"customizations": {
1322
"vscode": {
1423
// Set *default* container specific settings.json values on container create.
1524
"settings": {
16-
"python.defaultInterpreterPath": "/venv/bin/python"
25+
// Use the container's python by default
26+
"python.defaultInterpreterPath": "/cache/venv-for${localWorkspaceFolder}/bin/python",
27+
// Don't activate the venv as it is already in the PATH
28+
"python.terminal.activateEnvInCurrentTerminal": false,
29+
"python.terminal.activateEnvironment": false,
30+
// Workaround to prevent garbled python REPL in the terminal
31+
// https://github.com/microsoft/vscode-python/issues/25505
32+
"python.terminal.shellIntegration.enabled": false
1733
},
1834
// Add the IDs of extensions you want installed when the container is created.
1935
"extensions": [
@@ -27,20 +43,30 @@
2743
]
2844
}
2945
},
30-
"features": {
31-
// Some default things like git config
32-
"ghcr.io/devcontainers/features/common-utils:2": {
33-
"upgradePackages": false
34-
}
35-
},
46+
// Create the config folder for the bash-config feature and uv cache
47+
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/terminal-config",
3648
"runArgs": [
3749
// Allow the container to access the host X11 display and EPICS CA
3850
"--net=host",
3951
// Make sure SELinux does not disable with access to host filesystems like tmp
4052
"--security-opt=label=disable"
4153
],
54+
"mounts": [
55+
// Mount in the user terminal config folder so it can be edited
56+
{
57+
"source": "${localEnv:HOME}/.config/terminal-config",
58+
"target": "/user-terminal-config",
59+
"type": "bind"
60+
},
61+
// Keep a persistent cross container cache for uv, pre-commit, and the venvs
62+
{
63+
"source": "devcontainer-shared-cache",
64+
"target": "/cache",
65+
"type": "volume"
66+
}
67+
],
4268
// Mount the parent as /workspaces so we can pip install peers as editable
4369
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
44-
// After the container is created, install the python project in editable form
45-
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
70+
// After the container is created, recreate the venv then make pre-commit first run faster
71+
"postCreateCommand": "uv venv --clear && uv sync && pre-commit install --install-hooks"
4672
}

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua
2424

2525
This project was created using the [Diamond Light Source Copier Template](https://github.com/DiamondLightSource/python-copier-template) for Python projects.
2626

27-
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/2.5.0/how-to.html).
27+
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/5.0.2/how-to.html).

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assignees: ''
77

88
---
99

10-
Describe the bug, including a clear and concise description of the expected behavior, the actual behavior and the context in which you encountered it (ideally include details of your environment).
10+
Describe the bug, including a clear and concise description of the expected behaviour, the actual behavior and the context in which you encountered it (ideally include details of your environment).
1111

1212
## Steps To Reproduce
1313
Steps to reproduce the behavior:

.github/actions/install_requirements/action.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/_check.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/_container.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
on:
22
workflow_call:
3+
inputs:
4+
publish:
5+
type: boolean
6+
description: If true, pushes image to container registry
37

48
jobs:
59
build:
610
runs-on: ubuntu-latest
711

812
steps:
913
- name: Checkout
10-
uses: actions/checkout@v4
14+
uses: actions/checkout@v5
1115
with:
1216
# Need this to get version number from last tag
1317
fetch-depth: 0
@@ -47,7 +51,7 @@ jobs:
4751
type=raw,value=latest
4852
4953
- name: Push cached image to container registry
50-
if: github.ref_type == 'tag'
54+
if: inputs.publish && github.ref_type == 'tag'
5155
uses: docker/build-push-action@v6
5256
env:
5357
DOCKER_BUILD_RECORD_UPLOAD: false
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
publish:
5+
type: boolean
6+
description: If true, pushes image to container registry
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
# Need this to get version number from last tag
17+
fetch-depth: 0
18+
19+
- name: Set up Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to GitHub Docker Registry
24+
if: github.event_name != 'pull_request'
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Create tags for publishing debug image
32+
id: debug-meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ghcr.io/${{ github.repository }}
36+
tags: |
37+
type=ref,event=tag,suffix=-debug
38+
type=raw,value=latest-debug
39+
40+
- name: Build and publish debug image to container registry
41+
if: github.ref_type == 'tag'
42+
uses: docker/build-push-action@v6
43+
env:
44+
DOCKER_BUILD_RECORD_UPLOAD: false
45+
with:
46+
context: .
47+
push: true
48+
target: debug
49+
tags: ${{ steps.debug-meta.outputs.tags }}

.github/workflows/_dist.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ jobs:
77

88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v4
10+
uses: actions/checkout@v5
1111
with:
1212
# Need this to get version number from last tag
1313
fetch-depth: 0
1414

15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v7
17+
1518
- name: Build sdist and wheel
1619
run: >
1720
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
18-
pipx run build
21+
uvx --from build pyproject-build
1922
2023
- name: Upload sdist and wheel as artifacts
2124
uses: actions/upload-artifact@v4
@@ -24,12 +27,10 @@ jobs:
2427
path: dist
2528

2629
- name: Check for packaging errors
27-
run: pipx run twine check --strict dist/*
30+
run: uvx twine check --strict dist/*
2831

2932
- name: Install produced wheel
30-
uses: ./.github/actions/install_requirements
31-
with:
32-
pip-install: dist/*.whl
33+
run: python -m pip install dist/*.whl
3334

3435
- name: Test module --version works using the installed wheel
3536
# If more than one module in src/ replace with module name to test

0 commit comments

Comments
 (0)