ToolR 0.1.0__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.

Potentially problematic release.


This version of ToolR might be problematic. Click here for more details.

Files changed (152) hide show
  1. ToolR-0.1.0/.codespell.words.ignore +1 -0
  2. ToolR-0.1.0/.coveragerc +37 -0
  3. ToolR-0.1.0/.github/actions/apply-release-patch/action.yml +23 -0
  4. ToolR-0.1.0/.github/actions/configure-git/action.yml +12 -0
  5. ToolR-0.1.0/.github/actions/prepare-release-patch/action.yml +127 -0
  6. ToolR-0.1.0/.github/actions/setup-pre-commit/action.yml +54 -0
  7. ToolR-0.1.0/.github/actions/setup-virtualenv/action.yml +79 -0
  8. ToolR-0.1.0/.github/dependabot.yml +26 -0
  9. ToolR-0.1.0/.github/workflows/build.yml +76 -0
  10. ToolR-0.1.0/.github/workflows/ci.yml +247 -0
  11. ToolR-0.1.0/.github/workflows/release.yml +243 -0
  12. ToolR-0.1.0/.github/workflows/test.yml +108 -0
  13. ToolR-0.1.0/.gitignore +236 -0
  14. ToolR-0.1.0/.markdownlint.yaml +147 -0
  15. ToolR-0.1.0/.mise-tasks/cargo-test.sh +4 -0
  16. ToolR-0.1.0/.mise-tasks/pytest-test.sh +6 -0
  17. ToolR-0.1.0/.pre-commit-config.yaml +105 -0
  18. ToolR-0.1.0/.pre-commit-hooks/ref-doc-stubs.py +101 -0
  19. ToolR-0.1.0/.readthedocs.yaml +24 -0
  20. ToolR-0.1.0/CHANGELOG.md +0 -0
  21. ToolR-0.1.0/Cargo.lock +590 -0
  22. ToolR-0.1.0/Cargo.toml +38 -0
  23. ToolR-0.1.0/LICENSE +201 -0
  24. ToolR-0.1.0/PKG-INFO +107 -0
  25. ToolR-0.1.0/README.md +83 -0
  26. ToolR-0.1.0/action.yml +33 -0
  27. ToolR-0.1.0/cliff.toml +104 -0
  28. ToolR-0.1.0/docs/.nav.yml +6 -0
  29. ToolR-0.1.0/docs/examples/files/calculator.py +19 -0
  30. ToolR-0.1.0/docs/examples/files/example.py +24 -0
  31. ToolR-0.1.0/docs/examples/files/files-star-args.py +17 -0
  32. ToolR-0.1.0/docs/examples/files/files.py +17 -0
  33. ToolR-0.1.0/docs/examples/files/function_name_conversion.py +49 -0
  34. ToolR-0.1.0/docs/examples/files/hello.py +16 -0
  35. ToolR-0.1.0/docs/examples/files/system.py +64 -0
  36. ToolR-0.1.0/docs/examples/index.md +113 -0
  37. ToolR-0.1.0/docs/imgs/toolr.png +0 -0
  38. ToolR-0.1.0/docs/index.md +5 -0
  39. ToolR-0.1.0/docs/installation/index.md +89 -0
  40. ToolR-0.1.0/docs/reference/toolr/_context.md +3 -0
  41. ToolR-0.1.0/docs/reference/toolr/_exc.md +3 -0
  42. ToolR-0.1.0/docs/reference/toolr/_parser.md +3 -0
  43. ToolR-0.1.0/docs/reference/toolr/_registry.md +3 -0
  44. ToolR-0.1.0/docs/reference/toolr/testing.md +3 -0
  45. ToolR-0.1.0/docs/reference/toolr/utils/_console.md +3 -0
  46. ToolR-0.1.0/docs/reference/toolr/utils/_docstrings.md +3 -0
  47. ToolR-0.1.0/docs/reference/toolr/utils/_logs.md +3 -0
  48. ToolR-0.1.0/docs/reference/toolr/utils/_signature.md +3 -0
  49. ToolR-0.1.0/docs/reference/toolr/utils/command.md +3 -0
  50. ToolR-0.1.0/docs/usage/files/example1.py +19 -0
  51. ToolR-0.1.0/docs/usage/files/example2.py +127 -0
  52. ToolR-0.1.0/docs/usage/files/mutually-exclusive-1.py +29 -0
  53. ToolR-0.1.0/docs/usage/files/mutually-exclusive-2.py +53 -0
  54. ToolR-0.1.0/docs/usage/index.md +239 -0
  55. ToolR-0.1.0/mise.toml +12 -0
  56. ToolR-0.1.0/mkdocs.yml +89 -0
  57. ToolR-0.1.0/pyproject.toml +283 -0
  58. ToolR-0.1.0/python/toolr/__init__.py +14 -0
  59. ToolR-0.1.0/python/toolr/__main__.py +45 -0
  60. ToolR-0.1.0/python/toolr/_context.py +250 -0
  61. ToolR-0.1.0/python/toolr/_context.pyi +198 -0
  62. ToolR-0.1.0/python/toolr/_exc.py +24 -0
  63. ToolR-0.1.0/python/toolr/_parser.py +188 -0
  64. ToolR-0.1.0/python/toolr/_registry.py +312 -0
  65. ToolR-0.1.0/python/toolr/py.typed +0 -0
  66. ToolR-0.1.0/python/toolr/testing.py +97 -0
  67. ToolR-0.1.0/python/toolr/utils/__init__.py +0 -0
  68. ToolR-0.1.0/python/toolr/utils/_command.pyi +23 -0
  69. ToolR-0.1.0/python/toolr/utils/_console.py +67 -0
  70. ToolR-0.1.0/python/toolr/utils/_docstrings.py +31 -0
  71. ToolR-0.1.0/python/toolr/utils/_logs.py +148 -0
  72. ToolR-0.1.0/python/toolr/utils/_signature.py +506 -0
  73. ToolR-0.1.0/python/toolr/utils/command.py +184 -0
  74. ToolR-0.1.0/src/command/command_test.rs +694 -0
  75. ToolR-0.1.0/src/command/tests.rs +2 -0
  76. ToolR-0.1.0/src/command.rs +481 -0
  77. ToolR-0.1.0/src/lib.rs +15 -0
  78. ToolR-0.1.0/src/python_bindings.rs +137 -0
  79. ToolR-0.1.0/tests/__init__.py +0 -0
  80. ToolR-0.1.0/tests/cli/__init__.py +1 -0
  81. ToolR-0.1.0/tests/cli/conftest.py +37 -0
  82. ToolR-0.1.0/tests/cli/test_boolean_arguments.py +151 -0
  83. ToolR-0.1.0/tests/cli/test_enum_arguments.py +234 -0
  84. ToolR-0.1.0/tests/cli/test_integer_arguments.py +143 -0
  85. ToolR-0.1.0/tests/cli/test_list_arguments.py +277 -0
  86. ToolR-0.1.0/tests/cli/test_mutually_exclusive_groups.py +55 -0
  87. ToolR-0.1.0/tests/cli/test_nargs.py +139 -0
  88. ToolR-0.1.0/tests/cli/test_string_arguments.py +87 -0
  89. ToolR-0.1.0/tests/conftest.py +23 -0
  90. ToolR-0.1.0/tests/context/__init__.py +1 -0
  91. ToolR-0.1.0/tests/context/conftest.py +76 -0
  92. ToolR-0.1.0/tests/context/test_core.py +117 -0
  93. ToolR-0.1.0/tests/context/test_exit.py +54 -0
  94. ToolR-0.1.0/tests/context/test_output.py +150 -0
  95. ToolR-0.1.0/tests/context/test_prompt.py +200 -0
  96. ToolR-0.1.0/tests/context/test_run.py +50 -0
  97. ToolR-0.1.0/tests/context/test_verbosity.py +20 -0
  98. ToolR-0.1.0/tests/parser/__init__.py +0 -0
  99. ToolR-0.1.0/tests/parser/test_logging.py +78 -0
  100. ToolR-0.1.0/tests/parser/test_parser_errors.py +50 -0
  101. ToolR-0.1.0/tests/registry/__init__.py +1 -0
  102. ToolR-0.1.0/tests/registry/cases/mixed/tools/__init__.py +1 -0
  103. ToolR-0.1.0/tests/registry/cases/mixed/tools/deployment.py +53 -0
  104. ToolR-0.1.0/tests/registry/cases/mixed/tools/utils.py +27 -0
  105. ToolR-0.1.0/tests/registry/cases/nested/tools/__init__.py +1 -0
  106. ToolR-0.1.0/tests/registry/cases/nested/tools/docker/__init__.py +8 -0
  107. ToolR-0.1.0/tests/registry/cases/nested/tools/docker/build.py +50 -0
  108. ToolR-0.1.0/tests/registry/cases/nested/tools/docker/compose.py +31 -0
  109. ToolR-0.1.0/tests/registry/cases/simple/tools/__init__.py +1 -0
  110. ToolR-0.1.0/tests/registry/cases/simple/tools/docker.py +21 -0
  111. ToolR-0.1.0/tests/registry/cases/simple/tools/git.py +21 -0
  112. ToolR-0.1.0/tests/registry/test_command_group_errors.py +43 -0
  113. ToolR-0.1.0/tests/registry/test_command_override.py +394 -0
  114. ToolR-0.1.0/tests/registry/test_discovery.py +98 -0
  115. ToolR-0.1.0/tests/registry/test_discovery_errors.py +91 -0
  116. ToolR-0.1.0/tests/registry/test_entry_points.py +36 -0
  117. ToolR-0.1.0/tests/registry/test_integration.py +187 -0
  118. ToolR-0.1.0/tests/registry/test_registry_basic.py +229 -0
  119. ToolR-0.1.0/tests/registry/test_registry_errors.py +45 -0
  120. ToolR-0.1.0/tests/support/3rd-party-pkg/README.md +28 -0
  121. ToolR-0.1.0/tests/support/3rd-party-pkg/pyproject.toml +22 -0
  122. ToolR-0.1.0/tests/support/3rd-party-pkg/thirdparty/__init__.py +1 -0
  123. ToolR-0.1.0/tests/support/3rd-party-pkg/thirdparty/commands.py +57 -0
  124. ToolR-0.1.0/tests/support/coverage/sitecustomize.py +8 -0
  125. ToolR-0.1.0/tests/test_main.py +84 -0
  126. ToolR-0.1.0/tests/test_parser.py +65 -0
  127. ToolR-0.1.0/tests/utils/__init__.py +0 -0
  128. ToolR-0.1.0/tests/utils/command/__init__.py +0 -0
  129. ToolR-0.1.0/tests/utils/command/conftest.py +89 -0
  130. ToolR-0.1.0/tests/utils/command/test_command.py +386 -0
  131. ToolR-0.1.0/tests/utils/logs/__init__.py +1 -0
  132. ToolR-0.1.0/tests/utils/logs/test_duplicate_times_formatter.py +73 -0
  133. ToolR-0.1.0/tests/utils/logs/test_include_timestamps.py +35 -0
  134. ToolR-0.1.0/tests/utils/logs/test_level_filter.py +74 -0
  135. ToolR-0.1.0/tests/utils/logs/test_setup.py +138 -0
  136. ToolR-0.1.0/tests/utils/signature/__init__.py +1 -0
  137. ToolR-0.1.0/tests/utils/signature/test_arg.py +88 -0
  138. ToolR-0.1.0/tests/utils/signature/test_argument_annotation.py +97 -0
  139. ToolR-0.1.0/tests/utils/signature/test_get_signature.py +245 -0
  140. ToolR-0.1.0/tests/utils/signature/test_integration.py +135 -0
  141. ToolR-0.1.0/tests/utils/signature/test_kwarg.py +51 -0
  142. ToolR-0.1.0/tests/utils/signature/test_signature.py +277 -0
  143. ToolR-0.1.0/tests/utils/test_console.py +43 -0
  144. ToolR-0.1.0/tools/__init__.py +1 -0
  145. ToolR-0.1.0/tools/ci.py +45 -0
  146. ToolR-0.1.0/tools/example.py +127 -0
  147. ToolR-0.1.0/tools/example2.py.bak +110 -0
  148. ToolR-0.1.0/tools/names.py +49 -0
  149. ToolR-0.1.0/tools/test_commands.py +124 -0
  150. ToolR-0.1.0/tools/version.py +142 -0
  151. ToolR-0.1.0/tools/version2.py +114 -0
  152. ToolR-0.1.0/uv.lock +1010 -0
@@ -0,0 +1 @@
1
+ thirdparty
@@ -0,0 +1,37 @@
1
+ [run]
2
+ branch = True
3
+ cover_pylib = False
4
+ parallel = True
5
+ concurrency = multiprocessing
6
+
7
+ source =
8
+ python/
9
+ tests/
10
+
11
+ omit =
12
+ setup.py
13
+
14
+ [report]
15
+ # Regexes for lines to exclude from consideration
16
+ exclude_lines =
17
+ # Have to re-enable the standard pragma
18
+ pragma: no cover
19
+
20
+ # Don't complain about missing debug-only code:
21
+ def __repr__
22
+
23
+ # Don't complain if tests don't hit defensive assertion code:
24
+ raise AssertionError
25
+ raise NotImplementedError
26
+
27
+ # Don't complain if non-runnable code isn't run:
28
+ if 0:
29
+ if False:
30
+ if __name__ == .__main__.:
31
+ if TYPE_CHECKING:
32
+
33
+ omit =
34
+ setup.py
35
+
36
+
37
+ ignore_errors = True
@@ -0,0 +1,23 @@
1
+ name: Apply Release Patch
2
+ description: Prepare a release of ToolR
3
+
4
+ inputs:
5
+ release-patch-name:
6
+ required: true
7
+ description: 'Release patch to apply'
8
+
9
+
10
+ runs:
11
+ using: composite
12
+
13
+ steps:
14
+
15
+ - name: Download Release Patch Artifact
16
+ uses: actions/download-artifact@v4
17
+ with:
18
+ name: ${{ inputs.release-patch-name }}
19
+
20
+ - name: Apply The Release Patch
21
+ shell: bash
22
+ run: |
23
+ git am --committer-date-is-author-date ${{ inputs.release-patch-name }}
@@ -0,0 +1,12 @@
1
+ name: Configure Git
2
+ description: Configure git
3
+
4
+ runs:
5
+ using: composite
6
+
7
+ steps:
8
+ - name: Configure Git
9
+ shell: bash
10
+ run: |
11
+ git config user.name "github-actions[bot]"
12
+ git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -0,0 +1,127 @@
1
+ name: Prepare Release
2
+ description: Prepare a release of ToolR
3
+
4
+ inputs:
5
+ release-version:
6
+ required: false
7
+ description: 'Release version to prepare'
8
+
9
+ release-type:
10
+ required: false
11
+ description: 'Release type to prepare'
12
+ default: 'dev'
13
+ choices:
14
+ - 'major'
15
+ - 'minor'
16
+ - 'patch'
17
+ - 'dev'
18
+
19
+ outputs:
20
+ release-version:
21
+ description: 'Prepared release version'
22
+ value: ${{ steps.bump-version.outputs.release-version }}
23
+
24
+ release-patch-name:
25
+ description: 'Name of the release patch'
26
+ value: ${{ steps.bump-version.outputs.release-patch-name }}
27
+
28
+ runs:
29
+ using: composite
30
+
31
+ steps:
32
+
33
+ - name: Setup Virtual Environment
34
+ uses: ./.github/actions/setup-virtualenv
35
+ with:
36
+ cache-prefix: prepare-release
37
+ python-version: "3.11"
38
+ uv-sync-args: "--group docs"
39
+
40
+ - name: Bump Version
41
+ id: bump-version
42
+ shell: bash
43
+ run: |
44
+ if [ -z "${{ inputs.release-version }}" ]; then
45
+ echo "No release version provided, bumping version based on release type: ${{ inputs.release-type }}"
46
+ RELEASE_VERSION=$(uv run toolr version bump --${{ inputs.release-type }} --write --check-existing-tag)
47
+ else
48
+ echo "Using provided release version: ${{ inputs.release-version }}"
49
+ RELEASE_VERSION=$(uv run toolr version bump ${{ inputs.release-version }} --write --check-existing-tag)
50
+ fi
51
+
52
+ - name: Generate changelog for GH release
53
+ id: git-cliff
54
+ uses: orhun/git-cliff-action@v4
55
+ with:
56
+ config: cliff.toml
57
+ args: --unreleased --strip all
58
+ env:
59
+ OUTPUT: .release-changes.md
60
+ GITHUB_REPO: ${{ github.repository }}
61
+
62
+ - name: Prepare GH Release changelog
63
+ shell: bash
64
+ run: |
65
+ tail -n +3 .release-changes.md > final-release-notes.md
66
+
67
+ - name: Upload Release Notes Artifact
68
+ id: upload-release-notes
69
+ uses: actions/upload-artifact@v4
70
+ with:
71
+ name: toolr-${{ env.RELEASE_VERSION }}-release-notes.md
72
+ path: final-release-notes.md
73
+ retention-days: 7
74
+ if-no-files-found: error
75
+
76
+ - name: Attest release notes artifact
77
+ uses: actions/attest-build-provenance@v3
78
+ with:
79
+ subject-name: toolr-${{ env.RELEASE_VERSION }}-release-notes.md
80
+ subject-digest: sha256:${{ steps.upload-release-notes.outputs.artifact-digest }}
81
+
82
+ - name: Update CHANGELOG.md
83
+ uses: orhun/git-cliff-action@v4
84
+ with:
85
+ config: cliff.toml
86
+ args: --verbose --unreleased --tag '${{ env.RELEASE_VERSION }}' --prepend CHANGELOG.md
87
+ env:
88
+ GITHUB_REPO: ${{ github.repository }}
89
+
90
+ - name: Show Changes Diff
91
+ shell: bash
92
+ run: |
93
+ git diff --color
94
+
95
+ - name: Commit changes
96
+ shell: bash
97
+ run: |
98
+ # Add the CHANGELOG.md file to the commit
99
+ git add CHANGELOG.md
100
+ # Run it twice so that pre-commit can fix anything that can be automatically fixed.
101
+ git commit -am "chore(release): Prepare for ${{ env.RELEASE_VERSION }} release" || \
102
+ git commit -am "chore(release): Prepare for ${{ env.RELEASE_VERSION }} release"
103
+
104
+ - name: Tag the release
105
+ shell: bash
106
+ run: |
107
+ git tag -a "${{ env.RELEASE_VERSION }}" -m "Release ${{ env.RELEASE_VERSION }}"
108
+
109
+ - name: Create Release Patch
110
+ shell: bash
111
+ run: |
112
+ git format-patch --keep-subject --binary --stdout HEAD^ > toolr-${{ env.RELEASE_VERSION }}.patch
113
+
114
+ - name: Upload Changes Diff Artifact
115
+ id: upload-release-patch
116
+ uses: actions/upload-artifact@v4
117
+ with:
118
+ name: toolr-${{ env.RELEASE_VERSION }}.patch
119
+ path: toolr-${{ env.RELEASE_VERSION }}.patch
120
+ retention-days: 7
121
+ if-no-files-found: error
122
+
123
+ - name: Attest release patch artifact
124
+ uses: actions/attest-build-provenance@v3
125
+ with:
126
+ subject-name: toolr-${{ env.RELEASE_VERSION }}.patch
127
+ subject-digest: sha256:${{ steps.upload-release-patch.outputs.artifact-digest }}
@@ -0,0 +1,54 @@
1
+ name: setup-pre-commit
2
+ description: Setup 'pre-commit'
3
+
4
+ inputs:
5
+ version:
6
+ description: Pre-commit version to install
7
+ required: true
8
+ default: 3.0.3
9
+ cache-seed:
10
+ required: true
11
+ description: Seed used to invalidate caches
12
+ python-version:
13
+ required: true
14
+ description: Python version to install
15
+ default: 3.11
16
+ rust-toolchain:
17
+ required: true
18
+ description: Rust toolchain to install
19
+ default: stable
20
+
21
+
22
+ runs:
23
+ using: composite
24
+
25
+ steps:
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ inputs.python-version }}
29
+
30
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
31
+ with:
32
+ toolchain: ${{ inputs.rust-toolchain }}
33
+ components: ${{ inputs.rust-components }}
34
+
35
+ - run: pip install pre-commit
36
+ shell: bash
37
+
38
+ - id: python-version-checksum
39
+ run: echo "version-sha256sum=$(python --version --version | sha256sum | cut -d ' ' -f1)" >> "$GITHUB_OUTPUT"
40
+ shell: bash
41
+
42
+ - id: pre-commit-version-checksum
43
+ run: echo "version-sha256sum=$(pre-commit --version | sha256sum | cut -d ' ' -f1)" >> "$GITHUB_OUTPUT"
44
+ shell: bash
45
+
46
+ - uses: actions/cache@v4
47
+ with:
48
+ path: ${{ env.PRE_COMMIT_HOME }}
49
+ key: >-
50
+ precommit|${{ inputs.cache-seed }}|${{ runner.os }}|${{ steps.python-version-checksum.outputs.version-sha256sum }}|${{ steps.pre-commit-version-checksum.outputs.version-sha256sum }}|${{ hashFiles('**/uv.lock') }}
51
+ shell: bash
52
+
53
+ - run: pre-commit install --install-hooks
54
+ shell: bash
@@ -0,0 +1,79 @@
1
+ name: Setup UV
2
+ description: Setup UV for a given Python version
3
+
4
+ inputs:
5
+ python-version:
6
+ required: true
7
+ description: 'Python version to use'
8
+
9
+ cache-prefix:
10
+ required: true
11
+ description: "The prefix to use for the cache key"
12
+
13
+ uv-version:
14
+ default: ""
15
+ description: "The version of uv to install e.g., `0.5.0` Defaults to the version in pyproject.toml or 'latest'."
16
+
17
+ uv-sync-args:
18
+ default: "--all-extras --dev"
19
+ description: "The arguments to pass to the uv sync command. e.g., `--group docs` or `--dev`"
20
+
21
+ outputs:
22
+ uv-version:
23
+ description: "The version of uv installed"
24
+ value: ${{ steps.install-uv.outputs.uv-version }}
25
+
26
+ python-version-checksum:
27
+ description: "The checksum of the Python version"
28
+ value: ${{ steps.python-version-checksum.outputs.version-sha256sum }}
29
+
30
+ uv-version-checksum:
31
+ description: "The checksum of the UV version"
32
+ value: ${{ steps.uv-version-checksum.outputs.version-sha256sum }}
33
+
34
+ runs:
35
+ using: composite
36
+ steps:
37
+ - name: Install Python
38
+ uses: actions/setup-python@v5
39
+ with:
40
+ python-version: ${{ inputs.python-version }}
41
+
42
+ - name: Get Python version checksum
43
+ id: python-version-checksum
44
+ shell: bash
45
+ run: |
46
+ VERSION_SHA256SUM=$(python --version --version | sha256sum | cut -d ' ' -f 1)
47
+ echo "VERSION_SHA256SUM=$VERSION_SHA256SUM"
48
+ echo "version-sha256sum=$VERSION_SHA256SUM" >> "$GITHUB_OUTPUT"
49
+
50
+ - name: Install uv
51
+ id: install-uv
52
+ uses: astral-sh/setup-uv@v6
53
+ with:
54
+ version: ${{ inputs.uv-version }}
55
+
56
+ - name: Get UV version checksum
57
+ id: uv-version-checksum
58
+ shell: bash
59
+ run: |
60
+ VERSION_SHA256SUM=$(uv --version | sha256sum | cut -d ' ' -f 1)
61
+ echo "VERSION_SHA256SUM=$VERSION_SHA256SUM"
62
+ echo "version-sha256sum=$VERSION_SHA256SUM" >> "$GITHUB_OUTPUT"
63
+
64
+ - name: Set up cache
65
+ uses: actions/cache@v4
66
+ with:
67
+ path: .venv
68
+ key: >-
69
+ venv|
70
+ ${{ runner.os }}|
71
+ ${{ inputs.cache-prefix }}|
72
+ ${{ steps.python-version-checksum.outputs.version-sha256sum }}|
73
+ ${{ steps.uv-version-checksum.outputs.version-sha256sum }}|
74
+ ${{ hashFiles('**/uv.lock') }}
75
+
76
+ - name: Install Python Dependencies
77
+ shell: bash
78
+ run: |
79
+ uv sync ${{ inputs.uv-sync-args }}
@@ -0,0 +1,26 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ labels:
8
+ - dependencies:github-actions
9
+ assignees:
10
+ - s0undt3ch
11
+ - package-ecosystem: "cargo"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
15
+ labels:
16
+ - dependencies:rust
17
+ assignees:
18
+ - s0undt3ch
19
+ - package-ecosystem: "uv"
20
+ directory: "/"
21
+ schedule:
22
+ interval: "weekly"
23
+ labels:
24
+ - dependencies:python
25
+ assignees:
26
+ - s0undt3ch
@@ -0,0 +1,76 @@
1
+ name: Build
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ display-name:
7
+ required: true
8
+ type: string
9
+ description: 'Display name for the build job'
10
+ release-patch-name:
11
+ required: true
12
+ type: string
13
+ description: 'Release patch to apply'
14
+ platform-matrix:
15
+ required: true
16
+ type: string
17
+ description: 'Platform matrix as JSON string'
18
+
19
+ jobs:
20
+ build:
21
+ name: ${{ inputs.display-name }} (${{ matrix.python }}, ${{ matrix.platform.name }})
22
+ runs-on: ${{ matrix.platform.os }}
23
+ permissions:
24
+ id-token: write
25
+ contents: read
26
+ attestations: write
27
+ strategy:
28
+ fail-fast: false
29
+ matrix:
30
+ platform: ${{ fromJson(inputs.platform-matrix) }}
31
+ python:
32
+ - "cp311"
33
+ - "cp312"
34
+ - "cp313"
35
+
36
+ defaults:
37
+ run:
38
+ shell: bash
39
+
40
+ steps:
41
+ - uses: actions/checkout@v5
42
+
43
+ - name: Apply Release Patch
44
+ uses: ./.github/actions/apply-release-patch
45
+ with:
46
+ release-patch-name: ${{ inputs.release-patch-name }}
47
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
48
+ with:
49
+ toolchain: stable
50
+ cache-key: ${{ runner.os }}|${{ matrix.python }}|${{ matrix.platform.name }}|${{ hashFiles('**/Cargo.lock') }}
51
+ cache-directories: |
52
+ ~/.cargo/registry
53
+ ~/.cargo/git
54
+ target
55
+
56
+ - name: Set up QEMU
57
+ uses: docker/setup-qemu-action@v3
58
+ if: ${{ matrix.platform.emulation }}
59
+ with:
60
+ platforms: all
61
+
62
+ - name: Build wheels
63
+ uses: pypa/cibuildwheel@v3.1.4
64
+ env:
65
+ CIBW_ARCHS_LINUX: all
66
+ CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.name }}
67
+
68
+ - name: Attest build provenance
69
+ uses: actions/attest-build-provenance@v3
70
+ with:
71
+ subject-path: wheelhouse/*.whl
72
+
73
+ - uses: actions/upload-artifact@v4
74
+ with:
75
+ name: cibw-wheel-${{ matrix.python }}-${{ matrix.platform.name }}
76
+ path: wheelhouse/*.whl
@@ -0,0 +1,247 @@
1
+ name: CI Workflow
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ concurrency:
8
+ # Concurrency is defined in a way that concurrent builds against branches do
9
+ # not cancel previous builds.
10
+ # However, for every new build against the same pull request source branch,
11
+ # all older builds against that same branch get canceled.
12
+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.repository }}-${{ github.head_ref || github.run_id }}
13
+ cancel-in-progress: true
14
+
15
+ permissions:
16
+ contents: read
17
+ id-token: write
18
+ attestations: write
19
+
20
+ env:
21
+ FORCE_COLOR: "1"
22
+ PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit
23
+
24
+ jobs:
25
+ prepare-ci:
26
+ name: Prepare CI
27
+ runs-on: ubuntu-latest
28
+ outputs:
29
+ platform-matrix: ${{ steps.generate-build-matrix.outputs.platform-matrix }}
30
+ steps:
31
+ - uses: actions/checkout@v5
32
+
33
+ - name: Setup Virtual Environment
34
+ uses: ./.github/actions/setup-virtualenv
35
+ with:
36
+ cache-prefix: prepare-ci
37
+ python-version: "3.11"
38
+
39
+ - name: Generate Build Matrix
40
+ id: generate-build-matrix
41
+ run: |
42
+ uv run toolr ci generate-build-matrix
43
+
44
+ pre-commit:
45
+ name: Pre-commit
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@v5
49
+
50
+ - uses: actions/setup-python@v6
51
+ with:
52
+ python-version: 3.11
53
+
54
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
55
+ with:
56
+ toolchain: stable
57
+ components: clippy,rustfmt
58
+
59
+ - run: pip install pre-commit
60
+
61
+ - id: python-version-checksum
62
+ run: echo "version-sha256sum=$(python --version --version | sha256sum | cut -d ' ' -f1)" >> "$GITHUB_OUTPUT"
63
+
64
+ - id: pre-commit-version-checksum
65
+ run: echo "version-sha256sum=$(pre-commit --version | sha256sum | cut -d ' ' -f1)" >> "$GITHUB_OUTPUT"
66
+
67
+ - uses: actions/cache@v4
68
+ with:
69
+ path: ${{ env.PRE_COMMIT_HOME }}
70
+ key: >-
71
+ precommit|${{ runner.os }}|${{ steps.python-version-checksum.outputs.version-sha256sum }}|${{ steps.pre-commit-version-checksum.outputs.version-sha256sum }}|${{ hashFiles('**/uv.lock') }}
72
+
73
+ - run: pre-commit install --install-hooks
74
+ - run: pre-commit run --all-files --show-diff-on-failure --color=always
75
+
76
+ prepare-release:
77
+ name: Prepare Release
78
+ runs-on: ubuntu-latest
79
+ needs:
80
+ - pre-commit
81
+ outputs:
82
+ release-version: ${{ steps.prepare-release.outputs.release-version }}
83
+ release-patch-name: ${{ steps.prepare-release.outputs.release-patch-name }}
84
+ steps:
85
+ - uses: actions/checkout@v5
86
+ with:
87
+ fetch-depth: 0
88
+
89
+ - uses: actions/setup-python@v6
90
+ with:
91
+ python-version: 3.11
92
+
93
+ - uses: ./.github/actions/configure-git
94
+ - uses: ./.github/actions/prepare-release-patch
95
+ id: prepare-release
96
+ with:
97
+ release-type: dev
98
+
99
+ test-linux:
100
+ name: Test
101
+ needs:
102
+ - pre-commit
103
+ uses: ./.github/workflows/test.yml
104
+ with:
105
+ os: ubuntu-latest
106
+ display-name: Linux
107
+
108
+ test-windows:
109
+ name: Test
110
+ needs:
111
+ - pre-commit
112
+ uses: ./.github/workflows/test.yml
113
+ with:
114
+ os: windows-latest
115
+ display-name: Windows
116
+ test-macos:
117
+ name: Test
118
+ needs:
119
+ - pre-commit
120
+ uses: ./.github/workflows/test.yml
121
+ with:
122
+ os: macos-latest
123
+ display-name: macOS
124
+
125
+ build-linux:
126
+ name: Build
127
+ needs:
128
+ - prepare-ci
129
+ - test-linux
130
+ - prepare-release
131
+ uses: ./.github/workflows/build.yml
132
+ with:
133
+ display-name: Linux
134
+ release-patch-name: ${{ needs.prepare-release.outputs.release-patch-name }}
135
+ platform-matrix: ${{ toJSON(fromJSON(needs.prepare-ci.outputs.platform-matrix)['linux']) }}
136
+
137
+ build-windows:
138
+ name: Build
139
+ needs:
140
+ - prepare-ci
141
+ - test-windows
142
+ - prepare-release
143
+ uses: ./.github/workflows/build.yml
144
+ with:
145
+ display-name: Windows
146
+ release-patch-name: ${{ needs.prepare-release.outputs.release-patch-name }}
147
+ platform-matrix: ${{ toJSON(fromJSON(needs.prepare-ci.outputs.platform-matrix)['windows']) }}
148
+
149
+ build-macos:
150
+ name: Build
151
+ needs:
152
+ - prepare-ci
153
+ - test-macos
154
+ - prepare-release
155
+ uses: ./.github/workflows/build.yml
156
+ with:
157
+ display-name: macOS
158
+ release-patch-name: ${{ needs.prepare-release.outputs.release-patch-name }}
159
+ platform-matrix: ${{ toJSON(fromJSON(needs.prepare-ci.outputs.platform-matrix)['macos']) }}
160
+
161
+ docs:
162
+ name: Publish Docs
163
+ runs-on: ubuntu-latest
164
+
165
+ needs:
166
+ - pre-commit
167
+ - prepare-release
168
+
169
+ permissions:
170
+ contents: write
171
+
172
+ steps:
173
+ - name: Checkout code
174
+ uses: actions/checkout@v5
175
+
176
+ - name: Setup Virtual Environment
177
+ uses: ./.github/actions/setup-virtualenv
178
+ with:
179
+ cache-prefix: docs
180
+ python-version: "3.11"
181
+ uv-sync-args: "--group docs"
182
+
183
+ - name: Apply Release Patch
184
+ uses: ./.github/actions/apply-release-patch
185
+ with:
186
+ release-patch-name: ${{ needs.prepare-release.outputs.release-patch-name }}
187
+
188
+ - name: Build MkDocs site
189
+ run: uv run mkdocs build
190
+
191
+ - name: Deploy to GitHub Pages
192
+ uses: peaceiris/actions-gh-pages@v4
193
+ if: github.ref == 'refs/heads/main'
194
+ with:
195
+ github_token: ${{ secrets.GITHUB_TOKEN }}
196
+ publish_dir: ./site
197
+
198
+ publish:
199
+ name: Publish to Test PyPI
200
+ needs:
201
+ - build-linux
202
+ - build-windows
203
+ - build-macos
204
+ runs-on: ubuntu-latest
205
+
206
+ steps:
207
+ - uses: actions/download-artifact@v5
208
+ with:
209
+ pattern: cibw-wheel-*
210
+ path: dist
211
+ merge-multiple: true
212
+
213
+ - name: Flatten dist/ directory
214
+ run: |
215
+ ls -lah dist/
216
+
217
+ - name: Publish to Test PyPI (Trusted Publisher)
218
+ if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
219
+ uses: pypa/gh-action-pypi-publish@release/v1
220
+ with:
221
+ repository-url: https://test.pypi.org/legacy/
222
+ packages-dir: dist/
223
+ skip-existing: true
224
+ verbose: true
225
+
226
+ set-pipeline-exit-status:
227
+ permissions:
228
+ actions: read
229
+ # This step is just so we can make github require this step, to pass checks
230
+ # on a pull request instead of requiring all
231
+ name: Set the ${{ github.workflow }} Pipeline Exit Status
232
+ if: always()
233
+ runs-on: ubuntu-latest
234
+ needs:
235
+ - pre-commit
236
+ - prepare-release
237
+ - docs
238
+ - publish
239
+ steps:
240
+ - uses: martialonline/workflow-status@v4
241
+ id: check
242
+ - run: echo "Workflow failed"
243
+ if: steps.check.outputs.status == 'failure'
244
+ - run: echo "Workflow was cancelled"
245
+ if: steps.check.outputs.status == 'cancelled'
246
+ - run: echo "Workflow was successful"
247
+ if: steps.check.outputs.status == 'success'