Skip to content

Commit c4cccfb

Browse files
loispostulaolblak
andauthored
docs: add PyPI resource and pyproject autodiscovery documentation (#2769)
Add documentation for two new plugins: - pypi resource: PyPI registry interaction (source, condition) - pyproject autodiscovery: Python dependency updates via pyproject.toml + uv Signed-off-by: Loïs Postula <lois@postu.la> Co-authored-by: Olivier Vernin <olivier@vernin.me>
1 parent 66ed9a2 commit c4cccfb

File tree

3 files changed

+152
-0
lines changed

3 files changed

+152
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PyPI resource example
2+
sources:
3+
requests:
4+
name: Get latest requests version from PyPI
5+
kind: pypi
6+
spec:
7+
name: requests
8+
flask:
9+
name: Get latest flask version matching >=3.0
10+
kind: pypi
11+
spec:
12+
name: flask
13+
versionfilter:
14+
kind: semver
15+
pattern: ">=3.0.0"
16+
conditions:
17+
requests:
18+
name: Test that requests version 2.31.0 exists on PyPI
19+
kind: pypi
20+
disablesourceinput: true
21+
spec:
22+
name: requests
23+
version: 2.31.0
24+
targets:
25+
# Targets are not supported
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: "Pyproject"
3+
description: "Discover Python dependency updates from pyproject.toml"
4+
lead: "kind: pyproject"
5+
draft: false
6+
images: []
7+
menu:
8+
docs:
9+
parent: "plugin-autodiscovery"
10+
weight: 131
11+
toc: true
12+
plugins:
13+
- autodiscovery
14+
---
15+
16+
== Description
17+
18+
The pyproject crawler looks recursively for all Python dependencies from `pyproject.toml` files.
19+
It detects the package manager in use via lock files (currently `uv.lock` is supported) and generates manifests to update dependencies using the appropriate tool.
20+
21+
Dependencies are discovered from both `[project.dependencies]` and `[project.optional-dependencies]` sections. PEP 508 dependency strings are parsed to extract package names and version constraints. Environment markers are stripped.
22+
23+
Generated manifests use the `pypi` resource as a source and `uv add` as a shell target, which atomically updates both `pyproject.toml` and `uv.lock`.
24+
25+
== Manifest
26+
=== Parameters
27+
28+
{{< autodiscoveryparameters "pyproject" >}}
29+
30+
==== Example
31+
32+
===== Basic Example
33+
34+
[source,yaml]
35+
----
36+
# updatecli.d/pyproject.yaml
37+
autodiscovery:
38+
crawlers:
39+
pyproject:
40+
rootdir: "."
41+
versionfilter:
42+
kind: semver
43+
pattern: minor
44+
----
45+
46+
===== Filter to Specific Packages
47+
48+
[source,yaml]
49+
----
50+
# updatecli.d/pyproject-only.yaml
51+
autodiscovery:
52+
crawlers:
53+
pyproject:
54+
only:
55+
- packages:
56+
"requests": ""
57+
"flask": ""
58+
----
59+
60+
===== Private PyPI Registry
61+
62+
[source,yaml]
63+
----
64+
# updatecli.d/pyproject-private.yaml
65+
autodiscovery:
66+
crawlers:
67+
pyproject:
68+
rootdir: "."
69+
# Custom PyPI index URL propagated to all generated pypi source specs
70+
indexurl: "https://pypi.example.com/"
71+
versionfilter:
72+
kind: semver
73+
pattern: ">=1.0.0"
74+
----
75+
76+
NOTE: The `indexurl` parameter is propagated to all generated pypi resource specs, allowing consistent registry configuration across all discovered dependencies. For private registry authentication, the `pypi` resource supports a `token` field for Bearer token auth.
77+
78+
NOTE: The alias `python/uv` can also be used instead of `pyproject`.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "PyPI"
3+
description: "Interact with the PyPI registry"
4+
lead: "kind: pypi"
5+
date: 2026-03-25T00:00:00+00:00
6+
draft: false
7+
images: []
8+
menu:
9+
docs:
10+
parent: "plugin-resource"
11+
toc: true
12+
plugins:
13+
- source
14+
- condition
15+
---
16+
// <!-- Required for asciidoctor -->
17+
:toc:
18+
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
19+
:toclevels: 4
20+
21+
[cols="1^,1^,1^",options=header]
22+
|===
23+
| source | condition | target
24+
| &#10004; | &#10004; | &#10007;
25+
|===
26+
27+
**source**
28+
29+
The PyPI "source" retrieves the latest version of a Python package from a PyPI-compatible registry matching a specific version filter. PEP 440 pre-release versions (alpha, beta, rc) are automatically normalized to semver for filtering.
30+
31+
**condition**
32+
33+
The PyPI "condition" tests that a specific version exists on a PyPI-compatible registry.
34+
35+
**target**
36+
37+
The PyPI "target" is not supported.
38+
39+
== Parameter
40+
41+
{{< resourceparameters "sources" "pypi" >}}
42+
43+
== Example
44+
45+
[source,yaml]
46+
----
47+
# updatecli.yaml
48+
{{<include "assets/code_example/docs/plugins/resources/pypi/updatecli.d/default.yaml">}}
49+
----

0 commit comments

Comments
 (0)