dls-deploy-tools 0.1__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.
Files changed (80) hide show
  1. dls_deploy_tools-0.1/.copier-answers.yml +16 -0
  2. dls_deploy_tools-0.1/.devcontainer/devcontainer.json +51 -0
  3. dls_deploy_tools-0.1/.github/CONTRIBUTING.md +27 -0
  4. dls_deploy_tools-0.1/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
  5. dls_deploy_tools-0.1/.github/ISSUE_TEMPLATE/issue.md +13 -0
  6. dls_deploy_tools-0.1/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +8 -0
  7. dls_deploy_tools-0.1/.github/actions/install_requirements/action.yml +34 -0
  8. dls_deploy_tools-0.1/.github/dependabot.yml +24 -0
  9. dls_deploy_tools-0.1/.github/pages/index.html +11 -0
  10. dls_deploy_tools-0.1/.github/pages/make_switcher.py +94 -0
  11. dls_deploy_tools-0.1/.github/workflows/_check.yml +27 -0
  12. dls_deploy_tools-0.1/.github/workflows/_dist.yml +36 -0
  13. dls_deploy_tools-0.1/.github/workflows/_pypi.yml +17 -0
  14. dls_deploy_tools-0.1/.github/workflows/_release.yml +32 -0
  15. dls_deploy_tools-0.1/.github/workflows/_test.yml +62 -0
  16. dls_deploy_tools-0.1/.github/workflows/_tox.yml +22 -0
  17. dls_deploy_tools-0.1/.github/workflows/ci.yml +54 -0
  18. dls_deploy_tools-0.1/.gitignore +73 -0
  19. dls_deploy_tools-0.1/.pre-commit-config.yaml +24 -0
  20. dls_deploy_tools-0.1/.vscode/extensions.json +5 -0
  21. dls_deploy_tools-0.1/.vscode/launch.json +82 -0
  22. dls_deploy_tools-0.1/.vscode/settings.json +15 -0
  23. dls_deploy_tools-0.1/.vscode/tasks.json +60 -0
  24. dls_deploy_tools-0.1/Dockerfile +16 -0
  25. dls_deploy_tools-0.1/LICENSE +201 -0
  26. dls_deploy_tools-0.1/PKG-INFO +274 -0
  27. dls_deploy_tools-0.1/README.md +44 -0
  28. dls_deploy_tools-0.1/catalog-info.yaml +10 -0
  29. dls_deploy_tools-0.1/pyproject.toml +117 -0
  30. dls_deploy_tools-0.1/setup.cfg +4 -0
  31. dls_deploy_tools-0.1/src/deploy_tools/__init__.py +3 -0
  32. dls_deploy_tools-0.1/src/deploy_tools/__main__.py +107 -0
  33. dls_deploy_tools-0.1/src/deploy_tools/_version.py +16 -0
  34. dls_deploy_tools-0.1/src/deploy_tools/apptainer.py +77 -0
  35. dls_deploy_tools-0.1/src/deploy_tools/command.py +32 -0
  36. dls_deploy_tools-0.1/src/deploy_tools/default_versions.py +30 -0
  37. dls_deploy_tools-0.1/src/deploy_tools/demo_configuration/dls-pmac-control/0.1.yaml +31 -0
  38. dls_deploy_tools-0.1/src/deploy_tools/demo_configuration/dls-pmac-control/0.2.yaml +31 -0
  39. dls_deploy_tools-0.1/src/deploy_tools/demo_configuration/example-module-apps/0.1.yaml +49 -0
  40. dls_deploy_tools-0.1/src/deploy_tools/demo_configuration/example-module-deps/0.2.yaml +14 -0
  41. dls_deploy_tools-0.1/src/deploy_tools/demo_configuration/settings.yaml +4 -0
  42. dls_deploy_tools-0.1/src/deploy_tools/deploy.py +54 -0
  43. dls_deploy_tools-0.1/src/deploy_tools/deprecate.py +40 -0
  44. dls_deploy_tools-0.1/src/deploy_tools/layout.py +46 -0
  45. dls_deploy_tools-0.1/src/deploy_tools/models/__init__.py +0 -0
  46. dls_deploy_tools-0.1/src/deploy_tools/models/application.py +12 -0
  47. dls_deploy_tools-0.1/src/deploy_tools/models/apptainer.py +41 -0
  48. dls_deploy_tools-0.1/src/deploy_tools/models/command.py +17 -0
  49. dls_deploy_tools-0.1/src/deploy_tools/models/deployment.py +19 -0
  50. dls_deploy_tools-0.1/src/deploy_tools/models/load.py +79 -0
  51. dls_deploy_tools-0.1/src/deploy_tools/models/module.py +34 -0
  52. dls_deploy_tools-0.1/src/deploy_tools/models/parent.py +5 -0
  53. dls_deploy_tools-0.1/src/deploy_tools/models/schema.py +23 -0
  54. dls_deploy_tools-0.1/src/deploy_tools/models/schemas/deployment-settings.json +15 -0
  55. dls_deploy_tools-0.1/src/deploy_tools/models/schemas/deployment.json +367 -0
  56. dls_deploy_tools-0.1/src/deploy_tools/models/schemas/module.json +327 -0
  57. dls_deploy_tools-0.1/src/deploy_tools/models/shell.py +16 -0
  58. dls_deploy_tools-0.1/src/deploy_tools/module.py +116 -0
  59. dls_deploy_tools-0.1/src/deploy_tools/remove.py +61 -0
  60. dls_deploy_tools-0.1/src/deploy_tools/remove_name_folders.py +37 -0
  61. dls_deploy_tools-0.1/src/deploy_tools/restore.py +34 -0
  62. dls_deploy_tools-0.1/src/deploy_tools/shell.py +32 -0
  63. dls_deploy_tools-0.1/src/deploy_tools/snapshot.py +29 -0
  64. dls_deploy_tools-0.1/src/deploy_tools/sync.py +49 -0
  65. dls_deploy_tools-0.1/src/deploy_tools/templater.py +54 -0
  66. dls_deploy_tools-0.1/src/deploy_tools/templates/apptainer_entrypoint +35 -0
  67. dls_deploy_tools-0.1/src/deploy_tools/templates/command_entrypoint +3 -0
  68. dls_deploy_tools-0.1/src/deploy_tools/templates/modulefile +19 -0
  69. dls_deploy_tools-0.1/src/deploy_tools/templates/modulefile_version +2 -0
  70. dls_deploy_tools-0.1/src/deploy_tools/templates/shell_entrypoint +5 -0
  71. dls_deploy_tools-0.1/src/deploy_tools/update.py +32 -0
  72. dls_deploy_tools-0.1/src/deploy_tools/validate.py +294 -0
  73. dls_deploy_tools-0.1/src/dls_deploy_tools.egg-info/PKG-INFO +274 -0
  74. dls_deploy_tools-0.1/src/dls_deploy_tools.egg-info/SOURCES.txt +78 -0
  75. dls_deploy_tools-0.1/src/dls_deploy_tools.egg-info/dependency_links.txt +1 -0
  76. dls_deploy_tools-0.1/src/dls_deploy_tools.egg-info/entry_points.txt +2 -0
  77. dls_deploy_tools-0.1/src/dls_deploy_tools.egg-info/requires.txt +15 -0
  78. dls_deploy_tools-0.1/src/dls_deploy_tools.egg-info/top_level.txt +1 -0
  79. dls_deploy_tools-0.1/tests/conftest.py +15 -0
  80. dls_deploy_tools-0.1/tests/test_cli.py +9 -0
@@ -0,0 +1,16 @@
1
+ # Changes here will be overwritten by Copier
2
+ _commit: 2.2.0
3
+ _src_path: gh:DiamondLightSource/python-copier-template
4
+ author_email: martin.gaughran@diamond.ac.uk
5
+ author_name: Martin Gaughran
6
+ component_owner: group:default/sscc
7
+ description: A set of tools used for deploying applications to a shared filesystem.
8
+ distribution_name: dls-deploy-tools
9
+ docker: false
10
+ docs_type: README
11
+ git_platform: github.com
12
+ github_org: DiamondLightSource
13
+ package_name: deploy_tools
14
+ pypi: true
15
+ repo_name: deploy-tools
16
+ type_checker: pyright
@@ -0,0 +1,51 @@
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
+ },
12
+ "customizations": {
13
+ "vscode": {
14
+ // Set *default* container specific settings.json values on container create.
15
+ "settings": {
16
+ "python.defaultInterpreterPath": "/venv/bin/python"
17
+ },
18
+ // Add the IDs of extensions you want installed when the container is created.
19
+ "extensions": [
20
+ "ms-python.python",
21
+ "github.vscode-github-actions",
22
+ "tamasfe.even-better-toml",
23
+ "redhat.vscode-yaml",
24
+ "ryanluker.vscode-coverage-gutters",
25
+ "charliermarsh.ruff",
26
+ "ms-azuretools.vscode-docker"
27
+ ]
28
+ }
29
+ },
30
+ "features": {
31
+ // Some default things like git config
32
+ "ghcr.io/devcontainers/features/common-utils:2": {
33
+ "upgradePackages": false
34
+ }
35
+ },
36
+ "runArgs": [
37
+ // Allow the container to access the host X11 display and EPICS CA
38
+ "--net=host",
39
+ // Make sure SELinux does not disable with access to host filesystems like tmp
40
+ "--security-opt=label=disable",
41
+ // Add fuse device for apptainer testing inside the dev container
42
+ "--device=/dev/fuse"
43
+ ],
44
+ "mounts": [
45
+ "source=/dls_sw/,target=/dls_sw,type=bind,consistency=cached"
46
+ ],
47
+ // Mount the parent as /workspaces so we can pip install peers as editable
48
+ "workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
49
+ // After the container is created, install the python project in editable form
50
+ "postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install"
51
+ }
@@ -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/deploy-tools/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/deploy-tools/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/2.2.0/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 behavior, 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,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,0 +1,34 @@
1
+ name: Install requirements
2
+ description: Install a version of python then call pip install and report what was installed
3
+ inputs:
4
+ python-version:
5
+ description: Python version to install, default is from Dockerfile
6
+ default: "dev"
7
+ pip-install:
8
+ description: Parameters to pass to pip install
9
+ default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]"
10
+
11
+ runs:
12
+ using: composite
13
+ steps:
14
+ - name: Get version of python
15
+ run: |
16
+ PYTHON_VERSION="${{ inputs.python-version }}"
17
+ if [ $PYTHON_VERSION == "dev" ]; then
18
+ PYTHON_VERSION=$(sed -n "s/ARG PYTHON_VERSION=//p" Dockerfile)
19
+ fi
20
+ echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV"
21
+ shell: bash
22
+
23
+ - name: Setup python
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: ${{ env.PYTHON_VERSION }}
27
+
28
+ - name: Install packages
29
+ run: pip install ${{ inputs.pip-install }}
30
+ shell: bash
31
+
32
+ - name: Report what was installed
33
+ run: pip freeze
34
+ shell: bash
@@ -0,0 +1,24 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "github-actions"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "weekly"
12
+ groups:
13
+ actions:
14
+ patterns:
15
+ - "*"
16
+
17
+ - package-ecosystem: "pip"
18
+ directory: "/"
19
+ schedule:
20
+ interval: "weekly"
21
+ groups:
22
+ dev-dependencies:
23
+ patterns:
24
+ - "*"
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title>Redirecting to main branch</title>
6
+ <meta charset="utf-8">
7
+ <meta http-equiv="refresh" content="0; url=./main/index.html">
8
+ <link rel="canonical" href="main/index.html">
9
+ </head>
10
+
11
+ </html>
@@ -0,0 +1,94 @@
1
+ import json
2
+ import logging
3
+ from argparse import ArgumentParser
4
+ from pathlib import Path
5
+ from subprocess import CalledProcessError, check_output
6
+
7
+
8
+ def report_output(stdout: bytes, label: str) -> list[str]:
9
+ ret = stdout.decode().strip().split("\n")
10
+ print(f"{label}: {ret}")
11
+ return ret
12
+
13
+
14
+ def get_branch_contents(ref: str) -> list[str]:
15
+ """Get the list of directories in a branch."""
16
+ stdout = check_output(["git", "ls-tree", "-d", "--name-only", ref])
17
+ return report_output(stdout, "Branch contents")
18
+
19
+
20
+ def get_sorted_tags_list() -> list[str]:
21
+ """Get a list of sorted tags in descending order from the repository."""
22
+ stdout = check_output(["git", "tag", "-l", "--sort=-v:refname"])
23
+ return report_output(stdout, "Tags list")
24
+
25
+
26
+ def get_versions(ref: str, add: str | None) -> list[str]:
27
+ """Generate the file containing the list of all GitHub Pages builds."""
28
+ # Get the directories (i.e. builds) from the GitHub Pages branch
29
+ try:
30
+ builds = set(get_branch_contents(ref))
31
+ except CalledProcessError:
32
+ builds = set()
33
+ logging.warning(f"Cannot get {ref} contents")
34
+
35
+ # Add and remove from the list of builds
36
+ if add:
37
+ builds.add(add)
38
+
39
+ # Get a sorted list of tags
40
+ tags = get_sorted_tags_list()
41
+
42
+ # Make the sorted versions list from main branches and tags
43
+ versions: list[str] = []
44
+ for version in ["master", "main"] + tags:
45
+ if version in builds:
46
+ versions.append(version)
47
+ builds.remove(version)
48
+
49
+ # Add in anything that is left to the bottom
50
+ versions += sorted(builds)
51
+ print(f"Sorted versions: {versions}")
52
+ return versions
53
+
54
+
55
+ def write_json(path: Path, repository: str, versions: str):
56
+ org, repo_name = repository.split("/")
57
+ pages_url = f"https://{org}.github.io"
58
+ if repo_name != f"{org}.github.io":
59
+ # Only add the repo name if it isn't the source for the org pages site
60
+ pages_url += f"/{repo_name}"
61
+ struct = [
62
+ {"version": version, "url": f"{pages_url}/{version}/"} for version in versions
63
+ ]
64
+ text = json.dumps(struct, indent=2)
65
+ print(f"JSON switcher:\n{text}")
66
+ path.write_text(text, encoding="utf-8")
67
+
68
+
69
+ def main(args=None):
70
+ parser = ArgumentParser(
71
+ description="Make a versions.json file from gh-pages directories"
72
+ )
73
+ parser.add_argument(
74
+ "--add",
75
+ help="Add this directory to the list of existing directories",
76
+ )
77
+ parser.add_argument(
78
+ "repository",
79
+ help="The GitHub org and repository name: ORG/REPO",
80
+ )
81
+ parser.add_argument(
82
+ "output",
83
+ type=Path,
84
+ help="Path of write switcher.json to",
85
+ )
86
+ args = parser.parse_args(args)
87
+
88
+ # Write the versions file
89
+ versions = get_versions("origin/gh-pages", args.add)
90
+ write_json(args.output, args.repository, versions)
91
+
92
+
93
+ if __name__ == "__main__":
94
+ main()
@@ -0,0 +1,27 @@
1
+ on:
2
+ workflow_call:
3
+ outputs:
4
+ branch-pr:
5
+ description: The PR number if the branch is in one
6
+ value: ${{ jobs.pr.outputs.branch-pr }}
7
+
8
+ jobs:
9
+ pr:
10
+ runs-on: "ubuntu-latest"
11
+ outputs:
12
+ branch-pr: ${{ steps.script.outputs.result }}
13
+ steps:
14
+ - uses: actions/github-script@v7
15
+ id: script
16
+ if: github.event_name == 'push'
17
+ with:
18
+ script: |
19
+ const prs = await github.rest.pulls.list({
20
+ owner: context.repo.owner,
21
+ repo: context.repo.repo,
22
+ head: context.repo.owner + ':${{ github.ref_name }}'
23
+ })
24
+ if (prs.data.length) {
25
+ console.log(`::notice ::Skipping CI on branch push as it is already run in PR #${prs.data[0]["number"]}`)
26
+ return prs.data[0]["number"]
27
+ }
@@ -0,0 +1,36 @@
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@v4
11
+ with:
12
+ # Need this to get version number from last tag
13
+ fetch-depth: 0
14
+
15
+ - name: Build sdist and wheel
16
+ run: >
17
+ export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
18
+ pipx run build
19
+
20
+ - name: Upload sdist and wheel as artifacts
21
+ uses: actions/upload-artifact@v4
22
+ with:
23
+ name: dist
24
+ path: dist
25
+
26
+ - name: Check for packaging errors
27
+ run: pipx run twine check --strict dist/*
28
+
29
+ - name: Install produced wheel
30
+ uses: ./.github/actions/install_requirements
31
+ with:
32
+ pip-install: dist/*.whl
33
+
34
+ - name: Test module --version works using the installed wheel
35
+ # If more than one module in src/ replace with module name to test
36
+ run: python -m $(ls --hide='*.egg-info' src | head -1) --version
@@ -0,0 +1,17 @@
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@v4
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
@@ -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@v4
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@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
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,62 @@
1
+ on:
2
+ workflow_call:
3
+ inputs:
4
+ python-version:
5
+ type: string
6
+ description: The version of python to install
7
+ required: true
8
+ runs-on:
9
+ type: string
10
+ description: The runner to run this job on
11
+ required: true
12
+ secrets:
13
+ CODECOV_TOKEN:
14
+ required: true
15
+
16
+ env:
17
+ # https://github.com/pytest-dev/pytest/issues/2042
18
+ PY_IGNORE_IMPORTMISMATCH: "1"
19
+
20
+ jobs:
21
+ run:
22
+ runs-on: ${{ inputs.runs-on }}
23
+
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v4
27
+ with:
28
+ # Need this to get version number from last tag
29
+ fetch-depth: 0
30
+
31
+ - if: inputs.python-version == 'dev'
32
+ name: Install dev versions of python packages
33
+ uses: ./.github/actions/install_requirements
34
+
35
+ - if: inputs.python-version == 'dev'
36
+ name: Write the requirements as an artifact
37
+ run: pip freeze --exclude-editable > /tmp/dev-requirements.txt
38
+
39
+ - if: inputs.python-version == 'dev'
40
+ name: Upload dev-requirements.txt
41
+ uses: actions/upload-artifact@v4
42
+ with:
43
+ name: dev-requirements
44
+ path: /tmp/dev-requirements.txt
45
+
46
+ - if: inputs.python-version != 'dev'
47
+ name: Install latest versions of python packages
48
+ uses: ./.github/actions/install_requirements
49
+ with:
50
+ python-version: ${{ inputs.python-version }}
51
+ pip-install: ".[dev]"
52
+
53
+ - name: Run tests
54
+ run: tox -e tests
55
+
56
+ - name: Upload coverage to Codecov
57
+ uses: codecov/codecov-action@v4
58
+ with:
59
+ name: ${{ inputs.python-version }}/${{ inputs.runs-on }}
60
+ files: cov.xml
61
+ env:
62
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -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@v4
17
+
18
+ - name: Install python packages
19
+ uses: ./.github/actions/install_requirements
20
+
21
+ - name: Run tox
22
+ run: tox -e ${{ inputs.tox }}
@@ -0,0 +1,54 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ check:
9
+ uses: ./.github/workflows/_check.yml
10
+
11
+ lint:
12
+ needs: check
13
+ if: needs.check.outputs.branch-pr == ''
14
+ uses: ./.github/workflows/_tox.yml
15
+ with:
16
+ tox: pre-commit,type-checking
17
+
18
+ test:
19
+ needs: check
20
+ if: needs.check.outputs.branch-pr == ''
21
+ strategy:
22
+ matrix:
23
+ runs-on: ["ubuntu-latest"] # can add windows-latest, macos-latest
24
+ python-version: ["3.11", "3.12"]
25
+ include:
26
+ # Include one that runs in the dev environment
27
+ - runs-on: "ubuntu-latest"
28
+ python-version: "dev"
29
+ fail-fast: false
30
+ uses: ./.github/workflows/_test.yml
31
+ with:
32
+ runs-on: ${{ matrix.runs-on }}
33
+ python-version: ${{ matrix.python-version }}
34
+ secrets:
35
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
36
+
37
+ dist:
38
+ needs: check
39
+ if: needs.check.outputs.branch-pr == ''
40
+ uses: ./.github/workflows/_dist.yml
41
+
42
+ pypi:
43
+ if: github.ref_type == 'tag'
44
+ needs: dist
45
+ uses: ./.github/workflows/_pypi.yml
46
+ permissions:
47
+ id-token: write
48
+
49
+ release:
50
+ if: github.ref_type == 'tag'
51
+ needs: [dist]
52
+ uses: ./.github/workflows/_release.yml
53
+ permissions:
54
+ contents: write
@@ -0,0 +1,73 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ env/
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+ **/_version.py
26
+
27
+ # PyInstaller
28
+ # Usually these files are written by a python script from a template
29
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ cov.xml
46
+ .pytest_cache/
47
+ .mypy_cache/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Django stuff:
54
+ *.log
55
+
56
+ # Sphinx documentation
57
+ docs/_build/
58
+
59
+ # PyBuilder
60
+ target/
61
+
62
+ # likely venv names
63
+ .venv*
64
+ venv*
65
+
66
+ # further build artifacts
67
+ lockfiles/
68
+
69
+ # ruff cache
70
+ .ruff_cache/
71
+
72
+ # Demo output path for vscode tasks
73
+ demo-output
@@ -0,0 +1,24 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: check-added-large-files
6
+ - id: check-yaml
7
+ - id: check-merge-conflict
8
+ - id: end-of-file-fixer
9
+
10
+ - repo: local
11
+ hooks:
12
+ - id: ruff
13
+ name: lint with ruff
14
+ language: system
15
+ entry: ruff check --force-exclude
16
+ types: [python]
17
+ require_serial: true
18
+
19
+ - id: ruff-format
20
+ name: format with ruff
21
+ language: system
22
+ entry: ruff format --force-exclude
23
+ types: [python]
24
+ require_serial: true
@@ -0,0 +1,5 @@
1
+ {
2
+ "recommendations": [
3
+ "ms-vscode-remote.remote-containers",
4
+ ]
5
+ }