Skip to content

Commit b874b57

Browse files
committed
feat(copy): adds copier template
1 parent b0bb15c commit b874b57

44 files changed

Lines changed: 3195 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/_dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434

3535
- name: Test module --version works using the installed wheel
3636
# If more than one module in src/ replace with module name to test
37-
run: python -m $(ls --hide='*.egg-info' src | head -1) --version
37+
run: python -m $(ls --hide='*.egg-info' --hide='copier_template' src | head -1) --version

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ lockfiles/
7272

7373
# environment variables file
7474
*.env
75+
76+
# Python version
77+
.python-version

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ repos:
1616
entry: ruff check --force-exclude --fix
1717
types: [python]
1818
require_serial: true
19+
exclude: ^src/copier_template/src/\{\{ project_name \}\}/
1920

2021
- id: create-workflow-templates
2122
name: creates workflow templates

catalog-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Component
33
metadata:
44
name: python-interface-to-workflows
55
title: python-interface-to-workflows
6-
description: Python alternative to creating and running argo workflows in the Data Analysis Platform
6+
description: Python alternative to creating and running argo workflows in the Data Analysis Platform
77
spec:
88
type: service
99
lifecycle: experimental

copier.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# questions
2+
project_name:
3+
type: str
4+
help: What is the name for your project?
5+
validator: >-
6+
{% if not (project_name | regex_search('^[a-z_][a-z0-9_]*$')) %}
7+
{{project_name}} is not a valid ruff-compatible python package name
8+
{% endif %}
9+
10+
repo_name:
11+
type: str
12+
help: |
13+
What is the name for your new repo?
14+
Generally, use the package name with underscores replaced by dashes.
15+
default: "{{ project_name | replace('_', '-') }}"
16+
validator: >-
17+
{% if not (repo_name | regex_search('^[a-zA-Z0-9](?:[a-zA-Z0-9_.-]*[a-zA-Z0-9])?$')) %}
18+
{{ repo_name }} is not a valid repo name
19+
{% endif %}
20+
description:
21+
type: str
22+
help: Please provide a description of your project
23+
placeholder: One line description of your module
24+
25+
github_org:
26+
type: str
27+
help: What is your github organisation?
28+
default: DiamondLightSource
29+
30+
author_name:
31+
type: str
32+
help: What is your full name?
33+
placeholder: FirstName LastName
34+
35+
author_email:
36+
type: str
37+
help: What is your email address?
38+
placeholder: email@diamond.ac.uk
39+
40+
_subdirectory: "src/copier_template"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// For format details, see https://containers.dev/implementors/json_reference/
2+
{
3+
"name": "Python 3 Developer Container",
4+
"build": {
5+
"dockerfile": "../Dockerfile",
6+
"target": "developer"
7+
},
8+
"remoteEnv": {
9+
// Allow X11 apps to run inside the container
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}"
20+
},
21+
"customizations": {
22+
"vscode": {
23+
// Set *default* container specific settings.json values on container create.
24+
"settings": {
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
33+
},
34+
// Add the IDs of extensions you want installed when the container is created.
35+
"extensions": [
36+
"ms-python.python",
37+
"github.vscode-github-actions",
38+
"tamasfe.even-better-toml",
39+
"redhat.vscode-yaml",
40+
"ryanluker.vscode-coverage-gutters",
41+
"charliermarsh.ruff",
42+
"ms-azuretools.vscode-docker"
43+
]
44+
}
45+
},
46+
// Create the config folder for the bash-config feature and uv cache
47+
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/terminal-config",
48+
"runArgs": [
49+
// Allow the container to access the host X11 display and EPICS CA
50+
// "--net=host",
51+
// Make sure SELinux does not disable with access to host filesystems like tmp
52+
"--security-opt=label=disable"
53+
],
54+
"forwardPorts": [
55+
5173
56+
],
57+
"mounts": [
58+
// Mount in the user terminal config folder so it can be edited
59+
{
60+
"source": "${localEnv:HOME}/.config/terminal-config",
61+
"target": "/user-terminal-config",
62+
"type": "bind"
63+
},
64+
// Keep a persistent cross container cache for uv, pre-commit, and the venvs
65+
{
66+
"source": "devcontainer-shared-cache",
67+
"target": "/cache",
68+
"type": "volume"
69+
}
70+
],
71+
// Mount the parent as /workspaces so we can pip install peers as editable
72+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
73+
// After the container is created, recreate the venv then make pre-commit first run faster
74+
"postCreateCommand": "uv venv --clear && uv sync && pre-commit install --install-hooks"
75+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contribute to the project
2+
3+
Contributions and issues are most welcome! All issues and pull requests are
4+
handled through [GitHub](https://github.com/{{github_org}}/{{repo_name}}/issues). Also, please check for any existing issues before
5+
filing a new one. If you have a great idea but it involves big changes, please
6+
file a ticket before making a pull request! We want to make sure you don't spend
7+
your time coding something that might not fit the scope of the project.
8+
9+
## Issue or Discussion?
10+
11+
Github also offers [discussions](https://github.com/{{github_org}}/{{repo_name}}/discussions) as a place to ask questions and share ideas. If
12+
your issue is open ended and it is not obvious when it can be "closed", please
13+
raise it as a discussion instead.
14+
15+
## Code Coverage
16+
17+
While 100% code coverage does not make a library bug-free, it significantly
18+
reduces the number of easily caught bugs! Please make sure coverage remains the
19+
same or is improved by a pull request!
20+
21+
## Developer Information
22+
23+
It is recommended that developers use a [vscode devcontainer](https://code.visualstudio.com/docs/devcontainers/containers). This repository contains configuration to set up a containerized development environment that suits its own needs.
24+
25+
This project was created using the [Diamond Light Source Workflow Copier Template](https://github.com/DiamondLightSource/python-interface-to-workflows) for Python projects.
26+
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.1.0/how-to.html).
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Bug Report
3+
about: The template to use for reporting bugs and usability issues
4+
title: " "
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
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).
11+
12+
## Steps To Reproduce
13+
Steps to reproduce the behavior:
14+
1. Go to '...'
15+
2. Click on '....'
16+
3. Scroll down to '....'
17+
4. See error
18+
19+
20+
## Acceptance Criteria
21+
- Specific criteria that will be used to judge if the issue is fixed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Issue
3+
about: The standard template to use for feature requests, design discussions and tasks
4+
title: " "
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
A brief description of the issue, including specific stakeholders and the business case where appropriate
11+
12+
## Acceptance Criteria
13+
- Specific criteria that will be used to judge if the issue is fixed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Fixes #ISSUE
2+
3+
### Instructions to reviewer on how to test:
4+
1. Do thing x
5+
2. Confirm thing y happens
6+
7+
### Checks for reviewer
8+
- [ ] Would the PR title make sense to a user on a set of release notes

0 commit comments

Comments
 (0)