python-devkit 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.
- python_devkit-0.1.0/.github/workflows/ci.yml +30 -0
- python_devkit-0.1.0/.github/workflows/release.yml +25 -0
- python_devkit-0.1.0/.gitignore +12 -0
- python_devkit-0.1.0/.python-version +1 -0
- python_devkit-0.1.0/AGENTS.md +31 -0
- python_devkit-0.1.0/CLAUDE.md +1 -0
- python_devkit-0.1.0/LICENSE +201 -0
- python_devkit-0.1.0/NOTICE +1 -0
- python_devkit-0.1.0/PKG-INFO +10 -0
- python_devkit-0.1.0/README.md +34 -0
- python_devkit-0.1.0/publish-config.json +11 -0
- python_devkit-0.1.0/pyproject.toml +29 -0
- python_devkit-0.1.0/ruff.toml +95 -0
- python_devkit-0.1.0/src/python_devkit/__init__.py +0 -0
- python_devkit-0.1.0/src/python_devkit/ci_step.py +52 -0
- python_devkit-0.1.0/src/python_devkit/py.typed +0 -0
- python_devkit-0.1.0/src/python_devkit/setup.py +127 -0
- python_devkit-0.1.0/src/python_devkit/setup_oras.py +51 -0
- python_devkit-0.1.0/src/python_devkit/third-party/README.md +9 -0
- python_devkit-0.1.0/src/python_devkit/third-party/dotnet-install.sh +1887 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
check:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v7
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Lint
|
|
24
|
+
run: uv run ruff check .
|
|
25
|
+
|
|
26
|
+
- name: Format
|
|
27
|
+
run: uv run ruff format --check .
|
|
28
|
+
|
|
29
|
+
- name: Type check
|
|
30
|
+
run: uv run basedpyright
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [CI]
|
|
6
|
+
types: [completed]
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main'
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
# Workaround: fetch-tags is broken with shallow clones
|
|
20
|
+
- run: git fetch --tags origin
|
|
21
|
+
|
|
22
|
+
- uses: astral-sh/setup-uv@v7
|
|
23
|
+
|
|
24
|
+
- name: Publish
|
|
25
|
+
run: uvx --from release-devkit==0.1.0 publish-packages --config publish-config.json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# python-devkit
|
|
2
|
+
|
|
3
|
+
## What this is
|
|
4
|
+
|
|
5
|
+
The python repo-lifecycle devkit — the `-devkit` family's home for tooling every Python repo needs at dev/CI time: the GitHub Actions step wrapper, CI runner provisioning, and (per the tooling-consolidation program) the generalized `lock-python`, the preflight check runner, the canonical ruff configuration with its sync verb and drift gate, and the reusable python check workflow. The org's one dedicated Python-domain devkit: runtime libraries stay standalone (`logger-conf`, `bashrun`), and registry-specific machinery lives in `release-devkit`.
|
|
6
|
+
|
|
7
|
+
The package is `python_devkit` (src-layout under `src/python_devkit/`); all dependencies resolve from PyPI (`bashrun`, `pydantic`, `pydantic-settings`; git-source pins only in scratch branches testing unreleased changes). Born 2026-09-21 from unity-devkit's `ci_step` + runner-setup cohort moving out (release-devkit's unity dependency dropped to zero in the same change).
|
|
8
|
+
|
|
9
|
+
## Release flow
|
|
10
|
+
|
|
11
|
+
Publishing rides `release.yml`, triggered by a successful CI run on a `main` push: the machinery — release-devkit, invoked uvx-isolated, never a project dependency — computes the plan from the tag ledger and path-diff, patches the version ephemerally, and publishes to PyPI under OIDC trusted publishing (publisher bound to `release.yml`, no environment). The committed `pyproject.toml` version is permanently the `0.0.0.dev0` sentinel; the `python-devkit-v*` tags are the version ledger (first release `0.1.0`, patch-auto thereafter). API-breaking changes ship with a manually bumped version — patch-auto assumes additive changes.
|
|
12
|
+
|
|
13
|
+
## Shape
|
|
14
|
+
|
|
15
|
+
| Module | Role |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `ci_step.py` | `ci_step(label)` context manager — wraps a step in `::group::`/`::endgroup::`, times it, and appends a duration row to `$GITHUB_STEP_SUMMARY` (failure-marked on exception). |
|
|
18
|
+
| `setup.py` | CI runner provisioning: `configure_git` (re-sets checkout's `safe.directory` in the real HOME), `free_disk_space` (strips preinstalled toolchains; container/bare-linux/Windows paths), `install_dotnet` (via the vendored `third-party/dotnet-install.sh`, PATH + `$GITHUB_PATH` wiring), `install_node` (nodejs.org tarball, npm registry override). |
|
|
19
|
+
| `setup_oras.py` | `install_oras` — installs the ORAS CLI (zstd dependency included) and logs into ghcr.io with the job token. |
|
|
20
|
+
| `third-party/` | Vendored `dotnet-install.sh` (curl-downloading it inside CI containers is unreliable — the same reason `actions/setup-dotnet` bundles it); resolved `__file__`-relative, so it works in editable installs, wheels, and git checkouts alike. |
|
|
21
|
+
|
|
22
|
+
## Constraints
|
|
23
|
+
|
|
24
|
+
- **The module surface is cross-repo Python API.** `ci_step`, the `setup` functions, and `install_oras` are imported by release-devkit, unity-devkit, and consumer repos' CI commands — the import paths and signatures are contract, not internals. This package must stay dependency-light: anything with a heavyweight or domain-specific dep graph (Unity, docker, registry feeds) belongs in its sibling devkit, not here.
|
|
25
|
+
- **No Unity- or registry-specific code.** Unity build tooling lives in `unity-devkit`; compose-stack lifecycle in `docker-devkit`; publication machinery in `release-devkit`. When a module grows a domain, it moves out — this repo is the domainless floor.
|
|
26
|
+
- **CI tooling prints to stdout by design** — step output is the operator interface; the `print` ignore rides the org-wide PLE-336 deferral like the sibling devkits and will never convert to structured logging here.
|
|
27
|
+
|
|
28
|
+
## See also
|
|
29
|
+
|
|
30
|
+
- `README.md` — human-facing setup and consumer install snippet.
|
|
31
|
+
- [`bashrun`](https://github.com/outernet-foundation/bashrun) — the shell-exec helpers the provisioning functions use.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright 2026 Tyler Hatch
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: python-devkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python repo-lifecycle tooling: CI step wrapper, runner provisioning, workspace locking, preflight checks
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
License-File: NOTICE
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Requires-Dist: bashrun>=0.1.0
|
|
9
|
+
Requires-Dist: pydantic-settings>=2.9.1
|
|
10
|
+
Requires-Dist: pydantic>=2.11.7
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# python-devkit
|
|
2
|
+
|
|
3
|
+
Python repo-lifecycle tooling shared across outernet-foundation repos: the CI step wrapper (`ci_step`), CI runner provisioning (`configure_git`, `free_disk_space`, `install_dotnet`, `install_node`, `install_oras`), and — as the program progresses — workspace locking, the preflight check runner, and the canonical ruff configuration. Sibling of `unity-devkit`, `docker-devkit`, and `release-devkit` in the `-devkit` family; `bashrun` and `logger-conf` stay standalone.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv sync
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Consuming from another repo
|
|
14
|
+
|
|
15
|
+
```toml
|
|
16
|
+
[project]
|
|
17
|
+
dependencies = ["python-devkit>=0.1.0"]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from python_devkit.ci_step import ci_step
|
|
22
|
+
from python_devkit.setup import configure_git, free_disk_space, install_dotnet, install_node
|
|
23
|
+
from python_devkit.setup_oras import install_oras
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To test an unreleased change, pin the repo at a git ref in a scratch branch instead (`python-devkit = { git = "…", rev = "<sha>" }` under `[tool.uv.sources]`) and drop the pin when the release lands.
|
|
27
|
+
|
|
28
|
+
## Development
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv run ruff check .
|
|
32
|
+
uv run ruff format --check .
|
|
33
|
+
uv run basedpyright
|
|
34
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "python-devkit"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python repo-lifecycle tooling: CI step wrapper, runner provisioning, workspace locking, preflight checks"
|
|
5
|
+
requires-python = ">=3.13"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"bashrun>=0.1.0",
|
|
8
|
+
"pydantic>=2.11.7",
|
|
9
|
+
"pydantic-settings>=2.9.1",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[dependency-groups]
|
|
13
|
+
dev = ["basedpyright>=1.39.10", "ruff>=0.14.11"]
|
|
14
|
+
|
|
15
|
+
[build-system]
|
|
16
|
+
requires = ["hatchling"]
|
|
17
|
+
build-backend = "hatchling.build"
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build.targets.wheel]
|
|
20
|
+
packages = ["src/python_devkit"]
|
|
21
|
+
include = ["src/python_devkit/py.typed", "src/python_devkit/third-party/**"]
|
|
22
|
+
|
|
23
|
+
[tool.uv.sources]
|
|
24
|
+
|
|
25
|
+
[tool.basedpyright]
|
|
26
|
+
venvPath = "."
|
|
27
|
+
venv = ".venv"
|
|
28
|
+
typeCheckingMode = "strict"
|
|
29
|
+
include = ["src"]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
target-version = "py313"
|
|
2
|
+
line-length = 120
|
|
3
|
+
preview = true
|
|
4
|
+
|
|
5
|
+
[lint]
|
|
6
|
+
select = ["ALL"]
|
|
7
|
+
ignore = [
|
|
8
|
+
# ── Permanent ─────────────────────────────────────────────────────────
|
|
9
|
+
# Type annotations — basedpyright strict mode handles this
|
|
10
|
+
"ANN",
|
|
11
|
+
# No docstrings, no copyright headers
|
|
12
|
+
"D",
|
|
13
|
+
"DOC",
|
|
14
|
+
"CPY",
|
|
15
|
+
# TODO/FIXME comment formatting
|
|
16
|
+
"TD",
|
|
17
|
+
"FIX",
|
|
18
|
+
# Exception message ergonomics — literal-indirection and custom-class churn without benefit
|
|
19
|
+
"raw-string-in-exception",
|
|
20
|
+
"f-string-in-exception",
|
|
21
|
+
"raise-vanilla-args",
|
|
22
|
+
# Class attribute names never conflict with builtins via self.x
|
|
23
|
+
"builtin-attribute-shadowing",
|
|
24
|
+
# Function-size counters — C901 already covers structural complexity
|
|
25
|
+
"too-many-return-statements",
|
|
26
|
+
"too-many-branches",
|
|
27
|
+
"too-many-arguments",
|
|
28
|
+
"too-many-locals",
|
|
29
|
+
"too-many-statements",
|
|
30
|
+
"too-many-positional-arguments",
|
|
31
|
+
# Typer's Option/Argument in argument defaults is typer's standard API pattern
|
|
32
|
+
"function-call-in-default-argument",
|
|
33
|
+
# Boolean parameters read fine as keyword-only flags here
|
|
34
|
+
"boolean-type-hint-positional-argument",
|
|
35
|
+
"boolean-default-value-positional-argument",
|
|
36
|
+
"boolean-positional-value-in-call",
|
|
37
|
+
# Relative imports are the intra-package convention
|
|
38
|
+
"relative-imports",
|
|
39
|
+
# Formatter-owned; enforced by `ruff format`
|
|
40
|
+
"missing-trailing-comma",
|
|
41
|
+
"unsorted-imports",
|
|
42
|
+
# Magic values in comparisons are readable in this CLI
|
|
43
|
+
"magic-value-comparison",
|
|
44
|
+
# The formatter owns wrapping; long string literals and URLs stay on one line
|
|
45
|
+
"line-too-long",
|
|
46
|
+
# src-layout tests need no __init__.py
|
|
47
|
+
"implicit-namespace-package",
|
|
48
|
+
# Runtime-used typing imports stay at module level
|
|
49
|
+
"typing-only-first-party-import",
|
|
50
|
+
"typing-only-third-party-import",
|
|
51
|
+
"typing-only-standard-library-import",
|
|
52
|
+
# Small literal tuples read fine in membership tests
|
|
53
|
+
"literal-membership",
|
|
54
|
+
|
|
55
|
+
# ── Deferred to PLE-248 — Enforce the deferred ruff rules
|
|
56
|
+
# https://linear.app/plerionplatforms/issue/PLE-248
|
|
57
|
+
# Mirrors placeframe's root ruff.toml transitional Ticket-N blocks; lifting
|
|
58
|
+
# a rule here should happen alongside lifting it from placeframe's ruff.toml.
|
|
59
|
+
"runtime-cast-value", # move import into TYPE_CHECKING block (quoted annotation) — Ticket 1
|
|
60
|
+
"redundant-open-modes", # unnecessary open mode parameters — Ticket 1
|
|
61
|
+
"read-whole-file", # read-text can replace open+read — Ticket 2
|
|
62
|
+
"write-whole-file", # write-text can replace open+write — Ticket 2
|
|
63
|
+
"repeated-append", # use list.extend instead of repeated append — Ticket 2
|
|
64
|
+
"unspecified-encoding", # open/read_text without explicit encoding — Ticket 2
|
|
65
|
+
"os-chmod", # os.chmod → Path.chmod — Ticket 2
|
|
66
|
+
"os-path-isdir", # os.path.isdir → Path.is_dir — Ticket 2
|
|
67
|
+
"os-path-join", # os.path.join → Path / — Ticket 2
|
|
68
|
+
"builtin-open", # open() → Path.open() — Ticket 2
|
|
69
|
+
"unnecessary-assign", # unnecessary assignment before return — Ticket 2
|
|
70
|
+
"superfluous-else-return", # unnecessary else after return — Ticket 2
|
|
71
|
+
"collection-literal-concatenation", # consider spread operator instead of concatenation — Ticket 2
|
|
72
|
+
"collapsible-if", # collapsible if statements — Ticket 2
|
|
73
|
+
"open-file-with-context-handler", # use context manager for opening files — Ticket 2
|
|
74
|
+
"multiple-with-statements", # use single with statement for multiple context managers — Ticket 2
|
|
75
|
+
"raise-without-from-inside-except", # raise ... from inside except — Ticket 8
|
|
76
|
+
"blind-except", # blind except Exception — Ticket 8
|
|
77
|
+
"try-consider-else", # try/except/return — move return into else — Ticket 8
|
|
78
|
+
"complex-structure", # function too complex — Ticket 9
|
|
79
|
+
"import-outside-top-level", # import not at top level — Ticket 9
|
|
80
|
+
"global-statement", # global statement — Ticket 9
|
|
81
|
+
"redefined-loop-name", # loop variable overwritten — Ticket 9
|
|
82
|
+
"path-constructor-current-directory", # do not pass "." explicitly to Path — Ticket 2
|
|
83
|
+
"bad-file-permissions", # bad-file-permissions (0o755 on executable) — Ticket 9
|
|
84
|
+
"hardcoded-temp-file", # hardcoded temp file / directory — Ticket 9
|
|
85
|
+
"suspicious-subprocess-import", # suspicious subprocess import — Ticket 9
|
|
86
|
+
"subprocess-without-shell-equals-true", # subprocess call with non-literal — Ticket 9
|
|
87
|
+
"start-process-with-partial-path", # start-process-with-partial-path — Ticket 9
|
|
88
|
+
|
|
89
|
+
# ── Deferred to PLE-336 — Replace print() with structured logging
|
|
90
|
+
# https://linear.app/plerionplatforms/issue/PLE-336
|
|
91
|
+
"print", # print found
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
[lint.flake8-builtins]
|
|
95
|
+
ignorelist = ["id", "map"]
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
from collections.abc import Generator
|
|
5
|
+
from contextlib import contextmanager
|
|
6
|
+
|
|
7
|
+
from pydantic_settings import BaseSettings
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Settings(BaseSettings):
|
|
11
|
+
github_step_summary: str | None = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
settings = Settings.model_validate({})
|
|
15
|
+
_summary_initialized = False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _format_duration(seconds: float) -> str:
|
|
19
|
+
if seconds < 60:
|
|
20
|
+
return f"{seconds:.1f}s"
|
|
21
|
+
minutes = int(seconds // 60)
|
|
22
|
+
remaining = seconds % 60
|
|
23
|
+
return f"{minutes}m {remaining:.0f}s"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _write_summary(label: str, duration: float, *, failed: bool) -> None:
|
|
27
|
+
global _summary_initialized
|
|
28
|
+
summary_path = settings.github_step_summary
|
|
29
|
+
if not summary_path:
|
|
30
|
+
return
|
|
31
|
+
with open(summary_path, "a") as file:
|
|
32
|
+
if not _summary_initialized:
|
|
33
|
+
file.write("| Step | Duration |\n|---|---|\n")
|
|
34
|
+
_summary_initialized = True
|
|
35
|
+
status = " :x:" if failed else ""
|
|
36
|
+
file.write(f"| {label}{status} | {_format_duration(duration)} |\n")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@contextmanager
|
|
40
|
+
def ci_step(label: str) -> Generator[None]:
|
|
41
|
+
print(f"::group::{label}", flush=True)
|
|
42
|
+
start = time.monotonic()
|
|
43
|
+
failed = False
|
|
44
|
+
try:
|
|
45
|
+
yield
|
|
46
|
+
except BaseException:
|
|
47
|
+
failed = True
|
|
48
|
+
raise
|
|
49
|
+
finally:
|
|
50
|
+
duration = time.monotonic() - start
|
|
51
|
+
print("::endgroup::", flush=True)
|
|
52
|
+
_write_summary(label, duration, failed=failed)
|
|
File without changes
|