Commit f8d689e
authored
feat!: migrate publish_provider to wheel-based provider-versions endpoint (PRA-376) (#40)
* feat!: migrate publish_provider to wheel-based provider-versions endpoint (PRA-376)
The pragma-os Phase 11 cleanup deleted the legacy multipart
``POST /providers/{org}/{name}/publish`` route along with the
in-API CloudBuildService/LocalBuildService stack. Publishing now
flows through ``POST /provider-versions``, which accepts a JSON
metadata payload pointing at a wheel hosted in GCP Artifact
Registry.
This rewires the SDK to the new contract:
- ``publish_provider`` now takes a provider directory, builds the
wheel locally with ``uv build --wheel``, runs schema extraction
via :func:`pragma_sdk.provider.extract_schemas`, uploads the
wheel to Artifact Registry via ``twine`` (relies on
``keyrings.google-artifactregistry-auth`` for ADC), and POSTs
the JSON body the new route expects.
- Drop ``get_publish_status`` and ``stream_publish_logs``: the
new route persists synchronously, so the API never returns a
``build_id`` to poll. Callers should treat the response as
PUBLISHED on success.
- ``ProviderVersion`` gains ``wheel_url``, ``runtime_image`` and
``entrypoint`` fields to match the response shape.
- Add ``pragma_sdk.provider.prepare_wheel_publish`` so consumers
who need direct access to the build/extract/upload pipeline can
reuse it without going through the HTTP client.
- Add async ``get_me`` to mirror the sync client; required by
the new async publish path.
BREAKING CHANGE: ``PragmaClient.publish_provider`` /
``AsyncPragmaClient.publish_provider`` now take ``provider_dir``
instead of a ``tarball`` and namespaced ``provider_name``.
``get_publish_status`` and ``stream_publish_logs`` are removed.
* test: drop publish_provider tests for now
The wheel-publish unit tests will land in a follow-up alongside the
matching pragma-cli rewiring.
* chore: drop tests/ tree and forbid unit tests in CLAUDE.md
The SDK is verified through pragma-os e2e suites and downstream
consumers; carrying a parallel pytest tree just rots. Remove the
folder and document the rule so future work doesn't regrow it.
* chore: strip test target, deps, and ruff/ty test ignores
Now that tests/ is gone, drop the matching scaffolding:
- Remove the 'task test' target from Taskfile.yaml.
- Remove the [dependency-groups].test block (pytest, respx, etc.)
and the orphan respx entry under dev from pyproject.toml.
- Remove [tool.pytest.ini_options] and the tests/-scoped overrides
in [tool.ruff.lint.per-file-ignores] / [tool.ty.src].
- Drop the now-unused 'PT' (pytest) ruff lint selector.
* fix: address PR #40 review feedback
- Swap twine for `uv publish` so credential prompts can never block
(uses --keyring-provider subprocess with the GAR keyring backend).
- Drop the `version=` override from `publish_provider` and
`prepare_wheel_publish`; the wheel filename is derived from
[project].version, so make pyproject the single source of truth and
refuse to publish when it is missing.
- Drop the unused `config_schema`/`outputs_schema` fields from
`WheelPublishPayload` — there is no code path that populates them.
- Clarify `_provider_on_sys_path` docstring: only sys.path is restored,
sys.modules entries from the import are left in place.
- Tighten `prepare_wheel_publish` Raises block (add TypeError, drop the
spurious RuntimeError on the helper that doesn't raise it).
- Document `DEFAULT_ARTIFACT_REPO` as the Pragmatiks-prod default that
callers can override per-publish.
* docs: drop `uv pip install` reference from upload helper docstring
The wheel URL is the contract; how the runtime resolves it isn't
something to prescribe in the SDK docs — and `uv pip install` is the
pip-compatible escape hatch we don't want to encourage.
* refactor: dedupe pyproject helpers and resolve uv binary once
Findings from /simplify pass:
- Reuse: `provider/publish.py` was forking `_load_pyproject` and
`_detect_provider_package` from `extract_schemas.py`. Generalised
the originals to accept an optional path / pre-parsed dict and made
`publish.py` delegate. Resolution rules now live in one place.
- Quality: `shutil.which("uv")` ran twice per publish (build + upload).
Hoisted to a single `_resolve_uv()` call at the top of
`prepare_wheel_publish` and threaded the path through the helpers,
so missing-`uv` fails fast instead of after the build succeeds.
- Quality: `"oauth2accesstoken"` and `"subprocess"` are documented
GAR / uv keyring contracts, not arbitrary values — promoted to
module-level constants.
- Quality: collapsed the async `publish_provider` org-id branch into a
one-liner matching the sync style.1 parent 5bf6001 commit f8d689e
11 files changed
Lines changed: 711 additions & 400 deletions
File tree
- src/pragma_sdk
- models
- provider
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
49 | | - | |
| 47 | + | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 22 | | |
31 | 23 | | |
32 | 24 | | |
33 | | - | |
34 | 25 | | |
35 | 26 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 27 | | |
41 | 28 | | |
42 | 29 | | |
| |||
52 | 39 | | |
53 | 40 | | |
54 | 41 | | |
55 | | - | |
56 | 42 | | |
57 | 43 | | |
58 | 44 | | |
| |||
62 | 48 | | |
63 | 49 | | |
64 | 50 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 51 | | |
81 | 52 | | |
82 | 53 | | |
| |||
85 | 56 | | |
86 | 57 | | |
87 | 58 | | |
88 | | - | |
| 59 | + | |
89 | 60 | | |
90 | 61 | | |
91 | 62 | | |
| |||
0 commit comments