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
17 changes: 10 additions & 7 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Changes here will be overwritten by Copier
_commit: 2.1.0
_commit: 3.0.0
_src_path: gh:DiamondLightSource/python-copier-template
author_email: [email protected]
author_name: David Perl
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry @d-perl 😢

Copy link
Contributor

@d-perl d-perl May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About time ;)

I'm happy to see that this is getting some use, even if you're basically tearing the whole thing up

component_owner: group:default/sscc
description: A service to put and get your config values from
author_email: [email protected]
author_name: Oliver Silvester
component_lifecycle: experimental
component_owner: group:default/data-acquisition
component_type: service
description: A service to read files on dls_sw from a blueapi container
distribution_name: daq-config-server
docker: false
docs_type: README
docker: true
docs_type: sphinx
git_platform: github.com
github_org: DiamondLightSource
package_name: daq_config_server
pypi: true
repo_name: daq-config-server
strict_typing: true
type_checker: pyright
10 changes: 5 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
}
},
"features": {
// Some default things like git config
"ghcr.io/devcontainers/features/common-utils:2": {
"upgradePackages": false
}
// add in eternal history and other bash features
"ghcr.io/diamondlightsource/devcontainer-features/bash-config:1": {}
},
// Create the config folder for the bash-config feature
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/bash-config",
"runArgs": [
// Allow the container to access the host X11 display and EPICS CA
"--net=host",
Expand All @@ -43,4 +43,4 @@
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
// After the container is created, install the python project in editable form
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
}
}
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua

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

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.1.0/how-to.html).
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/3.0.0/how-to.html).
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug Report
about: The template to use for reporting bugs and usability issues
title: " "
labels: 'bug'
assignees: ''

---

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).

## Steps To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error


## Acceptance Criteria
- Specific criteria that will be used to judge if the issue is fixed
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Issue
about: The standard template to use for feature requests, design discussions and tasks
title: " "
labels: ''
assignees: ''

---

A brief description of the issue, including specific stakeholders and the business case where appropriate

## Acceptance Criteria
- Specific criteria that will be used to judge if the issue is fixed
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Fixes #ISSUE

### Instructions to reviewer on how to test:
1. Do thing x
2. Confirm thing y happens

### Checks for reviewer
- [ ] Would the PR title make sense to a user on a set of release notes
2 changes: 1 addition & 1 deletion .github/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<link rel="canonical" href="main/index.html">
</head>

</html>
</html>
14 changes: 8 additions & 6 deletions .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Make switcher.json to allow docs to switch between different versions."""

import json
import logging
from argparse import ArgumentParser
Expand All @@ -6,6 +8,7 @@


def report_output(stdout: bytes, label: str) -> list[str]:
"""Print and return something received frm stdout."""
ret = stdout.decode().strip().split("\n")
print(f"{label}: {ret}")
return ret
Expand Down Expand Up @@ -52,21 +55,20 @@ def get_versions(ref: str, add: str | None) -> list[str]:
return versions


def write_json(path: Path, repository: str, versions: str):
def write_json(path: Path, repository: str, versions: list[str]):
"""Write the JSON switcher to path."""
org, repo_name = repository.split("/")
pages_url = f"https://{org}.github.io"
if repo_name != f"{org}.github.io":
# Only add the repo name if it isn't the source for the org pages site
pages_url += f"/{repo_name}"
struct = [
{"version": version, "url": f"{pages_url}/{version}/"} for version in versions
{"version": version, "url": f"https://{org}.github.io/{repo_name}/{version}/"}
for version in versions
]
text = json.dumps(struct, indent=2)
print(f"JSON switcher:\n{text}")
path.write_text(text, encoding="utf-8")


def main(args=None):
"""Parse args and write switcher."""
parser = ArgumentParser(
description="Make a versions.json file from gh-pages directories"
)
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and export to Docker local cache
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
# Need load and tags so we can test it below
load: true
tags: tag_for_testing

- name: Test cli works in cached runtime image
run: docker run --rm tag_for_testing --version

- name: Create tags for publishing image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest

- name: Push cached image to container registry
if: github.ref_type == 'tag'
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
# This does not build the image again, it will find the image in the
# Docker cache and publish it
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
54 changes: 54 additions & 0 deletions .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Avoid git conflicts when tag and branch pushed at same time
if: github.ref_type == 'tag'
run: sleep 60

- name: Checkout
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0

- name: Install system packages
run: sudo apt-get install graphviz

- name: Install python packages
uses: ./.github/actions/install_requirements

- name: Build docs
run: tox -e docs

- name: Remove environment.pickle
run: rm build/html/.doctrees/environment.pickle

- name: Upload built docs artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: build

- name: Sanitize ref name for docs version
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV

- name: Move to versioned directory
run: mv build/html .github/pages/$DOCS_VERSION

- name: Write switcher.json
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json

- name: Publish Docs to gh-pages
if: github.ref_type == 'tag' || github.ref_name == 'main'
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .github/pages
keep_files: true
2 changes: 2 additions & 0 deletions .github/workflows/_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:

- name: Publish to PyPI using trusted publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: false
2 changes: 1 addition & 1 deletion .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Create GitHub Release
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
with:
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
files: "*"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: tox -e unit_tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
name: ${{ inputs.python-version }}/${{ inputs.runs-on }}
files: cov.xml
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
runs-on: ["ubuntu-latest"] # can add windows-latest, macos-latest
python-version: ["3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13"]
include:
# Include one that runs in the dev environment
- runs-on: "ubuntu-latest"
Expand All @@ -34,6 +34,19 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

container:
needs: check
if: needs.check.outputs.branch-pr == ''
uses: ./.github/workflows/_container.yml
permissions:
contents: read
packages: write

docs:
needs: check
if: needs.check.outputs.branch-pr == ''
uses: ./.github/workflows/_docs.yml

dist:
needs: check
if: needs.check.outputs.branch-pr == ''
Expand All @@ -48,7 +61,7 @@ jobs:

release:
if: github.ref_type == 'tag'
needs: [dist]
needs: [dist, docs]
uses: ./.github/workflows/_release.yml
permissions:
contents: write
13 changes: 13 additions & 0 deletions .github/workflows/periodic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Periodic

on:
workflow_dispatch:
schedule:
# Run weekly to check URL links still resolve
- cron: "0 8 * * WED"

jobs:
linkcheck:
uses: ./.github/workflows/_tox.yml
with:
tox: docs build -- -b linkcheck
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cov.xml

# Sphinx documentation
docs/_build/
docs/_api

# PyBuilder
target/
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ repos:
args: [--allow-multiple-documents]
exclude: ^helmchart/
- id: check-merge-conflict
- id: end-of-file-fixer

- repo: local
hooks:
- id: ruff
name: lint with ruff
language: system
entry: ruff check --force-exclude
entry: ruff check --force-exclude --fix
types: [python]
exclude: ^.github/pages
require_serial: true
Expand All @@ -38,4 +39,4 @@ repos:
language: system
entry: npx eslint gui/config-server-gui/src
types: [javascript,jsx,ts,tsx]
require_serial: true
require_serial: true
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"recommendations": [
"ms-vscode-remote.remote-containers",
]
}
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"files.insertFinalNewline": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
},
Expand All @@ -25,4 +26,4 @@
"[yaml]": {
"editor.defaultFormatter": "ms-kubernetes-tools.vscode-kubernetes-tools",
}
}
}
Loading
Loading