heliotrapi 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- heliotrapi-0.1.2/.copier-answers.yml +20 -0
- heliotrapi-0.1.2/.devcontainer/devcontainer.json +72 -0
- heliotrapi-0.1.2/.github/CONTRIBUTING.md +27 -0
- heliotrapi-0.1.2/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
- heliotrapi-0.1.2/.github/ISSUE_TEMPLATE/issue.md +13 -0
- heliotrapi-0.1.2/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +8 -0
- heliotrapi-0.1.2/.github/pages/index.html +11 -0
- heliotrapi-0.1.2/.github/pages/make_switcher.py +96 -0
- heliotrapi-0.1.2/.github/workflows/_container.yml +64 -0
- heliotrapi-0.1.2/.github/workflows/_dist.yml +37 -0
- heliotrapi-0.1.2/.github/workflows/_pypi.yml +19 -0
- heliotrapi-0.1.2/.github/workflows/_release.yml +32 -0
- heliotrapi-0.1.2/.github/workflows/_test.yml +39 -0
- heliotrapi-0.1.2/.github/workflows/_tox.yml +22 -0
- heliotrapi-0.1.2/.github/workflows/ci.yml +54 -0
- heliotrapi-0.1.2/.gitignore +74 -0
- heliotrapi-0.1.2/.gitleaks.toml +19 -0
- heliotrapi-0.1.2/.pre-commit-config.yaml +38 -0
- heliotrapi-0.1.2/.python-version +1 -0
- heliotrapi-0.1.2/.vscode/extensions.json +5 -0
- heliotrapi-0.1.2/.vscode/launch.json +19 -0
- heliotrapi-0.1.2/.vscode/settings.json +12 -0
- heliotrapi-0.1.2/.vscode/tasks.json +16 -0
- heliotrapi-0.1.2/Dockerfile +107 -0
- heliotrapi-0.1.2/FRONTEND.md +65 -0
- heliotrapi-0.1.2/LICENSE +201 -0
- heliotrapi-0.1.2/PKG-INFO +407 -0
- heliotrapi-0.1.2/README.md +178 -0
- heliotrapi-0.1.2/catalog-info.yaml +10 -0
- heliotrapi-0.1.2/config.yaml +33 -0
- heliotrapi-0.1.2/helm/heliotrapi/.helmignore +23 -0
- heliotrapi-0.1.2/helm/heliotrapi/Chart.yaml +7 -0
- heliotrapi-0.1.2/helm/heliotrapi/templates/_helpers.tpl +60 -0
- heliotrapi-0.1.2/helm/heliotrapi/templates/configmap.yaml +7 -0
- heliotrapi-0.1.2/helm/heliotrapi/templates/deployment.yaml +96 -0
- heliotrapi-0.1.2/helm/heliotrapi/templates/ingress.yaml +43 -0
- heliotrapi-0.1.2/helm/heliotrapi/templates/service.yaml +13 -0
- heliotrapi-0.1.2/helm/heliotrapi/values.yaml +92 -0
- heliotrapi-0.1.2/images/webui.png +0 -0
- heliotrapi-0.1.2/pyproject.toml +151 -0
- heliotrapi-0.1.2/renovate.json +40 -0
- heliotrapi-0.1.2/setup.cfg +4 -0
- heliotrapi-0.1.2/src/heliotrapi/__init__.py +17 -0
- heliotrapi-0.1.2/src/heliotrapi/__main__.py +115 -0
- heliotrapi-0.1.2/src/heliotrapi/_version.py +24 -0
- heliotrapi-0.1.2/src/heliotrapi/analyses/__init__.py +1 -0
- heliotrapi-0.1.2/src/heliotrapi/analyses/delay.py +11 -0
- heliotrapi-0.1.2/src/heliotrapi/analyses/peak_fitting.py +33 -0
- heliotrapi-0.1.2/src/heliotrapi/analyses/simple_maths.py +17 -0
- heliotrapi-0.1.2/src/heliotrapi/analyses/workflows.py +5 -0
- heliotrapi-0.1.2/src/heliotrapi/analysis_core/__init__.py +41 -0
- heliotrapi-0.1.2/src/heliotrapi/analysis_core/decorator.py +24 -0
- heliotrapi-0.1.2/src/heliotrapi/analysis_core/loader.py +132 -0
- heliotrapi-0.1.2/src/heliotrapi/analysis_core/registry.py +30 -0
- heliotrapi-0.1.2/src/heliotrapi/api/__init__.py +0 -0
- heliotrapi-0.1.2/src/heliotrapi/api/routes.py +110 -0
- heliotrapi-0.1.2/src/heliotrapi/client.py +191 -0
- heliotrapi-0.1.2/src/heliotrapi/config.py +96 -0
- heliotrapi-0.1.2/src/heliotrapi/models.py +50 -0
- heliotrapi-0.1.2/src/heliotrapi/server.py +128 -0
- heliotrapi-0.1.2/src/heliotrapi/static/app.js +778 -0
- heliotrapi-0.1.2/src/heliotrapi/static/style.css +457 -0
- heliotrapi-0.1.2/src/heliotrapi/task_queue/__init__.py +5 -0
- heliotrapi-0.1.2/src/heliotrapi/task_queue/cleanup.py +25 -0
- heliotrapi-0.1.2/src/heliotrapi/task_queue/manager.py +177 -0
- heliotrapi-0.1.2/src/heliotrapi/task_queue/rabbitmq.py +191 -0
- heliotrapi-0.1.2/src/heliotrapi/templates/index.html +52 -0
- heliotrapi-0.1.2/src/heliotrapi/utils/serialisers.py +95 -0
- heliotrapi-0.1.2/src/heliotrapi.egg-info/PKG-INFO +407 -0
- heliotrapi-0.1.2/src/heliotrapi.egg-info/SOURCES.txt +94 -0
- heliotrapi-0.1.2/src/heliotrapi.egg-info/dependency_links.txt +1 -0
- heliotrapi-0.1.2/src/heliotrapi.egg-info/entry_points.txt +2 -0
- heliotrapi-0.1.2/src/heliotrapi.egg-info/requires.txt +11 -0
- heliotrapi-0.1.2/src/heliotrapi.egg-info/top_level.txt +1 -0
- heliotrapi-0.1.2/tests/conftest.py +8 -0
- heliotrapi-0.1.2/tests/test_api.py +63 -0
- heliotrapi-0.1.2/tests/test_api_routes.py +71 -0
- heliotrapi-0.1.2/tests/test_cleanup.py +47 -0
- heliotrapi-0.1.2/tests/test_cli.py +57 -0
- heliotrapi-0.1.2/tests/test_client.py +372 -0
- heliotrapi-0.1.2/tests/test_config.py +32 -0
- heliotrapi-0.1.2/tests/test_extra.py +3 -0
- heliotrapi-0.1.2/tests/test_gaussian_fit.py +59 -0
- heliotrapi-0.1.2/tests/test_loader.py +75 -0
- heliotrapi-0.1.2/tests/test_loader_extra.py +76 -0
- heliotrapi-0.1.2/tests/test_main.py +40 -0
- heliotrapi-0.1.2/tests/test_models.py +45 -0
- heliotrapi-0.1.2/tests/test_peak_fitting.py +17 -0
- heliotrapi-0.1.2/tests/test_plugins.py +81 -0
- heliotrapi-0.1.2/tests/test_queue_manager.py +158 -0
- heliotrapi-0.1.2/tests/test_rabbitmq_listener.py +147 -0
- heliotrapi-0.1.2/tests/test_registry.py +39 -0
- heliotrapi-0.1.2/tests/test_serialisers.py +56 -0
- heliotrapi-0.1.2/tests/test_server.py +30 -0
- heliotrapi-0.1.2/tests/test_workflows.py +8 -0
- heliotrapi-0.1.2/uv.lock +3520 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier
|
|
2
|
+
_commit: 5.0.2
|
|
3
|
+
_src_path: https://github.com/DiamondLightSource/python-copier-template.git
|
|
4
|
+
author_email: Richard.Dixey@Diamond.ac.uk
|
|
5
|
+
author_name: Richard Dixey
|
|
6
|
+
component_lifecycle: experimental
|
|
7
|
+
component_owner: group:default/data_analysis
|
|
8
|
+
component_type: service
|
|
9
|
+
description: An API for small fast data analysis jobs at Diamond Light Source
|
|
10
|
+
distribution_name: heliotrapi
|
|
11
|
+
docker: true
|
|
12
|
+
docker_debug: false
|
|
13
|
+
docs_type: README
|
|
14
|
+
git_platform: github.com
|
|
15
|
+
github_org: DiamondLightSource
|
|
16
|
+
package_name: heliotrapi
|
|
17
|
+
pypi: true
|
|
18
|
+
repo_name: heliotrapi
|
|
19
|
+
strict_typing: false
|
|
20
|
+
type_checker: pyright
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
"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
|
+
],
|
|
68
|
+
// Mount the parent as /workspaces so we can pip install peers as editable
|
|
69
|
+
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
|
|
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"
|
|
72
|
+
}
|
|
@@ -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/DiamondLightSource/heliotrapi/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/DiamondLightSource/heliotrapi/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 Copier Template](https://github.com/DiamondLightSource/python-copier-template) 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.0.2/how-to.html).
|
|
@@ -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
|
|
@@ -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
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Make switcher.json to allow docs to switch between different versions."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import logging
|
|
5
|
+
from argparse import ArgumentParser
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from subprocess import CalledProcessError, check_output
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def report_output(stdout: bytes, label: str) -> list[str]:
|
|
11
|
+
"""Print and return something received frm stdout."""
|
|
12
|
+
ret = stdout.decode().strip().split("\n")
|
|
13
|
+
print(f"{label}: {ret}")
|
|
14
|
+
return ret
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_branch_contents(ref: str) -> list[str]:
|
|
18
|
+
"""Get the list of directories in a branch."""
|
|
19
|
+
stdout = check_output(["git", "ls-tree", "-d", "--name-only", ref])
|
|
20
|
+
return report_output(stdout, "Branch contents")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_sorted_tags_list() -> list[str]:
|
|
24
|
+
"""Get a list of sorted tags in descending order from the repository."""
|
|
25
|
+
stdout = check_output(["git", "tag", "-l", "--sort=-v:refname"])
|
|
26
|
+
return report_output(stdout, "Tags list")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_versions(ref: str, add: str | None) -> list[str]:
|
|
30
|
+
"""Generate the file containing the list of all GitHub Pages builds."""
|
|
31
|
+
# Get the directories (i.e. builds) from the GitHub Pages branch
|
|
32
|
+
try:
|
|
33
|
+
builds = set(get_branch_contents(ref))
|
|
34
|
+
except CalledProcessError:
|
|
35
|
+
builds = set()
|
|
36
|
+
logging.warning(f"Cannot get {ref} contents")
|
|
37
|
+
|
|
38
|
+
# Add and remove from the list of builds
|
|
39
|
+
if add:
|
|
40
|
+
builds.add(add)
|
|
41
|
+
|
|
42
|
+
# Get a sorted list of tags
|
|
43
|
+
tags = get_sorted_tags_list()
|
|
44
|
+
|
|
45
|
+
# Make the sorted versions list from main branches and tags
|
|
46
|
+
versions: list[str] = []
|
|
47
|
+
for version in ["master", "main"] + tags:
|
|
48
|
+
if version in builds:
|
|
49
|
+
versions.append(version)
|
|
50
|
+
builds.remove(version)
|
|
51
|
+
|
|
52
|
+
# Add in anything that is left to the bottom
|
|
53
|
+
versions += sorted(builds)
|
|
54
|
+
print(f"Sorted versions: {versions}")
|
|
55
|
+
return versions
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write_json(path: Path, repository: str, versions: list[str]):
|
|
59
|
+
"""Write the JSON switcher to path."""
|
|
60
|
+
org, repo_name = repository.split("/")
|
|
61
|
+
struct = [
|
|
62
|
+
{"version": version, "url": f"https://{org}.github.io/{repo_name}/{version}/"}
|
|
63
|
+
for version in versions
|
|
64
|
+
]
|
|
65
|
+
text = json.dumps(struct, indent=2)
|
|
66
|
+
print(f"JSON switcher:\n{text}")
|
|
67
|
+
path.write_text(text, encoding="utf-8")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def main(args=None):
|
|
71
|
+
"""Parse args and write switcher."""
|
|
72
|
+
parser = ArgumentParser(
|
|
73
|
+
description="Make a versions.json file from gh-pages directories"
|
|
74
|
+
)
|
|
75
|
+
parser.add_argument(
|
|
76
|
+
"--add",
|
|
77
|
+
help="Add this directory to the list of existing directories",
|
|
78
|
+
)
|
|
79
|
+
parser.add_argument(
|
|
80
|
+
"repository",
|
|
81
|
+
help="The GitHub org and repository name: ORG/REPO",
|
|
82
|
+
)
|
|
83
|
+
parser.add_argument(
|
|
84
|
+
"output",
|
|
85
|
+
type=Path,
|
|
86
|
+
help="Path of write switcher.json to",
|
|
87
|
+
)
|
|
88
|
+
args = parser.parse_args(args)
|
|
89
|
+
|
|
90
|
+
# Write the versions file
|
|
91
|
+
versions = get_versions("origin/gh-pages", args.add)
|
|
92
|
+
write_json(args.output, args.repository, versions)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
main()
|
|
@@ -0,0 +1,64 @@
|
|
|
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@v5
|
|
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: Build and export to Docker local cache
|
|
32
|
+
uses: docker/build-push-action@v6
|
|
33
|
+
env:
|
|
34
|
+
DOCKER_BUILD_RECORD_UPLOAD: false
|
|
35
|
+
with:
|
|
36
|
+
context: .
|
|
37
|
+
# Need load and tags so we can test it below
|
|
38
|
+
load: true
|
|
39
|
+
tags: tag_for_testing
|
|
40
|
+
|
|
41
|
+
- name: Test cli works in cached runtime image
|
|
42
|
+
run: docker run --rm tag_for_testing --version
|
|
43
|
+
|
|
44
|
+
- name: Create tags for publishing image
|
|
45
|
+
id: meta
|
|
46
|
+
uses: docker/metadata-action@v5
|
|
47
|
+
with:
|
|
48
|
+
images: ghcr.io/${{ github.repository }}
|
|
49
|
+
tags: |
|
|
50
|
+
type=ref,event=tag
|
|
51
|
+
type=raw,value=latest
|
|
52
|
+
|
|
53
|
+
- name: Push cached image to container registry
|
|
54
|
+
if: inputs.publish && github.ref_type == 'tag'
|
|
55
|
+
uses: docker/build-push-action@v6
|
|
56
|
+
env:
|
|
57
|
+
DOCKER_BUILD_RECORD_UPLOAD: false
|
|
58
|
+
# This does not build the image again, it will find the image in the
|
|
59
|
+
# Docker cache and publish it
|
|
60
|
+
with:
|
|
61
|
+
context: .
|
|
62
|
+
push: true
|
|
63
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
64
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
build:
|
|
6
|
+
runs-on: "ubuntu-latest"
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
- name: Checkout
|
|
10
|
+
uses: actions/checkout@v5
|
|
11
|
+
with:
|
|
12
|
+
# Need this to get version number from last tag
|
|
13
|
+
fetch-depth: 0
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v7
|
|
17
|
+
|
|
18
|
+
- name: Build sdist and wheel
|
|
19
|
+
run: >
|
|
20
|
+
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
|
|
21
|
+
uvx --from build pyproject-build
|
|
22
|
+
|
|
23
|
+
- name: Upload sdist and wheel as artifacts
|
|
24
|
+
uses: actions/upload-artifact@v4
|
|
25
|
+
with:
|
|
26
|
+
name: dist
|
|
27
|
+
path: dist
|
|
28
|
+
|
|
29
|
+
- name: Check for packaging errors
|
|
30
|
+
run: uvx twine check --strict dist/*
|
|
31
|
+
|
|
32
|
+
- name: Install produced wheel
|
|
33
|
+
run: python -m pip install dist/*.whl
|
|
34
|
+
|
|
35
|
+
- name: Test module --version works using the installed wheel
|
|
36
|
+
# 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
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
upload:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
environment: release
|
|
8
|
+
|
|
9
|
+
steps:
|
|
10
|
+
- name: Download dist artifact
|
|
11
|
+
uses: actions/download-artifact@v5
|
|
12
|
+
with:
|
|
13
|
+
name: dist
|
|
14
|
+
path: dist
|
|
15
|
+
|
|
16
|
+
- name: Publish to PyPI using trusted publishing
|
|
17
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
18
|
+
with:
|
|
19
|
+
attestations: false
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
artifacts:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
- name: Download artifacts
|
|
10
|
+
uses: actions/download-artifact@v5
|
|
11
|
+
with:
|
|
12
|
+
merge-multiple: true
|
|
13
|
+
|
|
14
|
+
- name: Zip up docs
|
|
15
|
+
run: |
|
|
16
|
+
set -vxeuo pipefail
|
|
17
|
+
if [ -d html ]; then
|
|
18
|
+
mv html $GITHUB_REF_NAME
|
|
19
|
+
zip -r docs.zip $GITHUB_REF_NAME
|
|
20
|
+
rm -rf $GITHUB_REF_NAME
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
- name: Create GitHub Release
|
|
24
|
+
# We pin to the SHA, not the tag, for security reasons.
|
|
25
|
+
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
|
|
26
|
+
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
|
|
27
|
+
with:
|
|
28
|
+
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
|
|
29
|
+
files: "*"
|
|
30
|
+
generate_release_notes: true
|
|
31
|
+
env:
|
|
32
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
inputs:
|
|
4
|
+
python-version:
|
|
5
|
+
type: string
|
|
6
|
+
description: The version of python to install, default is from .python-version file
|
|
7
|
+
default: ""
|
|
8
|
+
runs-on:
|
|
9
|
+
type: string
|
|
10
|
+
description: The runner to run this job on
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
# https://github.com/pytest-dev/pytest/issues/2042
|
|
15
|
+
PY_IGNORE_IMPORTMISMATCH: "1"
|
|
16
|
+
UV_PYTHON: ${{ inputs.python-version }}
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
run:
|
|
20
|
+
runs-on: ${{ inputs.runs-on }}
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@v5
|
|
25
|
+
with:
|
|
26
|
+
# Need this to get version number from last tag
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- name: Install uv
|
|
30
|
+
uses: astral-sh/setup-uv@v7
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: uv run --locked tox -e tests
|
|
34
|
+
|
|
35
|
+
- name: Upload coverage to Codecov
|
|
36
|
+
uses: codecov/codecov-action@v5
|
|
37
|
+
with:
|
|
38
|
+
name: ${{ inputs.python-version }}/${{ inputs.runs-on }}
|
|
39
|
+
files: cov.xml
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
inputs:
|
|
4
|
+
tox:
|
|
5
|
+
type: string
|
|
6
|
+
description: What to run under tox
|
|
7
|
+
required: true
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
run:
|
|
12
|
+
runs-on: "ubuntu-latest"
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v5
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v7
|
|
20
|
+
|
|
21
|
+
- name: Run tox
|
|
22
|
+
run: uv run --locked tox -e ${{ inputs.tox }}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- '*'
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
|
|
13
|
+
lint:
|
|
14
|
+
uses: ./.github/workflows/_tox.yml
|
|
15
|
+
with:
|
|
16
|
+
tox: pre-commit,type-checking
|
|
17
|
+
|
|
18
|
+
test:
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
runs-on: ["ubuntu-latest"] # can add windows-latest, macos-latest
|
|
22
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
23
|
+
fail-fast: false
|
|
24
|
+
uses: ./.github/workflows/_test.yml
|
|
25
|
+
with:
|
|
26
|
+
runs-on: ${{ matrix.runs-on }}
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
container:
|
|
30
|
+
needs: test
|
|
31
|
+
if: always()
|
|
32
|
+
uses: ./.github/workflows/_container.yml
|
|
33
|
+
with:
|
|
34
|
+
publish: ${{ needs.test.result == 'success' }}
|
|
35
|
+
permissions:
|
|
36
|
+
contents: read
|
|
37
|
+
packages: write
|
|
38
|
+
|
|
39
|
+
dist:
|
|
40
|
+
uses: ./.github/workflows/_dist.yml
|
|
41
|
+
|
|
42
|
+
pypi:
|
|
43
|
+
needs: [dist, test]
|
|
44
|
+
if: github.ref_type == 'tag'
|
|
45
|
+
uses: ./.github/workflows/_pypi.yml
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write
|
|
48
|
+
|
|
49
|
+
release:
|
|
50
|
+
needs: [dist, test]
|
|
51
|
+
if: github.ref_type == 'tag'
|
|
52
|
+
uses: ./.github/workflows/_release.yml
|
|
53
|
+
permissions:
|
|
54
|
+
contents: write
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
# C extensions
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
**/_version.py
|
|
27
|
+
*.DS_Store
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
cov.xml
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
.mypy_cache/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
|
|
58
|
+
# Sphinx documentation
|
|
59
|
+
docs/_build/
|
|
60
|
+
docs/_api
|
|
61
|
+
plugins/
|
|
62
|
+
|
|
63
|
+
# PyBuilder
|
|
64
|
+
target/
|
|
65
|
+
|
|
66
|
+
# likely venv names
|
|
67
|
+
.venv*
|
|
68
|
+
venv*
|
|
69
|
+
|
|
70
|
+
# further build artifacts
|
|
71
|
+
lockfiles/
|
|
72
|
+
|
|
73
|
+
# ruff cache
|
|
74
|
+
.ruff_cache/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This allow-list is limited to YAML/YML files to cut down SealedSecrets false positives.
|
|
2
|
+
# All gitleaks default rules still apply everywhere (useDefault = true).
|
|
3
|
+
# To broaden this allow-list to all files, comment out the 'paths' line below.
|
|
4
|
+
|
|
5
|
+
[extend]
|
|
6
|
+
useDefault = true
|
|
7
|
+
|
|
8
|
+
[[rules]]
|
|
9
|
+
id = "generic-api-key"
|
|
10
|
+
|
|
11
|
+
# Pattern-only allowlist for long Ag… tokens in YAML
|
|
12
|
+
[[rules.allowlists]]
|
|
13
|
+
condition = "AND"
|
|
14
|
+
regexes = [
|
|
15
|
+
# Boundary-safe Ag… token without lookarounds (RE2-safe)
|
|
16
|
+
'''(?:^|[^A-Za-z0-9+/=])(Ag[A-Za-z0-9+/]{500,}={0,2})(?:[^A-Za-z0-9+/=]|$)''',
|
|
17
|
+
]
|
|
18
|
+
# Limit to YAML only for now. Comment this out if you want it to apply everywhere.
|
|
19
|
+
paths = ['''(?i).*\.ya?ml$''']
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-added-large-files
|
|
6
|
+
exclude: ^uv.lock
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
exclude: ^helm/
|
|
9
|
+
- id: check-merge-conflict
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
|
|
12
|
+
- repo: local
|
|
13
|
+
hooks:
|
|
14
|
+
- id: ruff
|
|
15
|
+
name: lint with ruff
|
|
16
|
+
language: system
|
|
17
|
+
entry: ruff check --force-exclude --fix
|
|
18
|
+
types: [python]
|
|
19
|
+
require_serial: true
|
|
20
|
+
|
|
21
|
+
- id: ruff-format
|
|
22
|
+
name: format with ruff
|
|
23
|
+
language: system
|
|
24
|
+
entry: ruff format --force-exclude
|
|
25
|
+
types: [python]
|
|
26
|
+
require_serial: true
|
|
27
|
+
|
|
28
|
+
- id: uv-sync
|
|
29
|
+
name: update uv.lock and venv
|
|
30
|
+
pass_filenames: false
|
|
31
|
+
language: system
|
|
32
|
+
entry: uv sync
|
|
33
|
+
files: ^(uv\.lock|pyproject\.toml)$
|
|
34
|
+
|
|
35
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
36
|
+
rev: v8.28.0
|
|
37
|
+
hooks:
|
|
38
|
+
- id: gitleaks
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|