Skip to content

Commit 209369e

Browse files
committed
Make the default PyPI surface resolve to the supported 2.0 line
1 parent 5571802 commit 209369e

8 files changed

Lines changed: 325 additions & 65 deletions

‎.github/workflows/pypi-project-surface.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@ jobs:
5656
--source-ref "$source_ref"
5757
--attempts 3
5858
--interval-seconds 10
59+
--evidence pypi-project-surface-evidence.json
60+
- name: Upload project-surface evidence
61+
if: github.event_name != 'push'
62+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
63+
with:
64+
name: pypi-project-surface-evidence
65+
path: pypi-project-surface-evidence.json

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ Python workers execute server-routed query tasks after the Server advertises the
1313
## Install
1414

1515
```bash
16-
pip install --pre 'durable-workflow~=2.0.0rc0'
16+
pip install 'durable-workflow~=2.0.0rc0'
1717
```
1818

19-
The prerelease flag and compatible-release constraint select the newest
20-
published 2.0 prerelease without implying that stable 2.0 has shipped. The
19+
The compatible-release constraint selects the newest published 2.0 prerelease
20+
without allowing prereleases of unrelated dependencies or implying that stable
21+
2.0 has shipped. The
2122
[API reference](https://python.durable-workflow.com/) shows the exact supported
2223
SDK and Server versions.
2324

‎docs/index.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ API reference for [`durable-workflow`](https://pypi.org/project/durable-workflow
55
## Install
66

77
```bash
8-
pip install durable-workflow=={{ durable_workflow_sdk_version }}
8+
pip install 'durable-workflow~=2.0.0rc0'
99
```
1010

1111
With the optional Prometheus metrics recorder:
1212

1313
```bash
14-
pip install 'durable-workflow[prometheus]=={{ durable_workflow_sdk_version }}'
14+
pip install 'durable-workflow[prometheus]~=2.0.0rc0'
1515
```
1616

1717
## Quick links
@@ -32,8 +32,8 @@ pip install 'durable-workflow[prometheus]=={{ durable_workflow_sdk_version }}'
3232

3333
This reference is generated from the `main` branch of [`durable-workflow/sdk-python`](https://github.com/durable-workflow/sdk-python) on every push. For the version installed in your project, check `durable_workflow.__version__`.
3434

35-
The install commands above select SDK prerelease
36-
`{{ durable_workflow_sdk_version }}`, which is qualified with
35+
The install commands above select the newest supported SDK prerelease. This
36+
reference currently qualifies SDK `{{ durable_workflow_sdk_version }}` with
3737
`durableworkflow/server:{{ durable_workflow_server_version }}`. The SDK and
3838
Server release identities advance independently; use the versions shown here
3939
together.

‎scripts/api_reference_release.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ class ReleaseIdentity:
2929

3030
@property
3131
def requirement(self) -> str:
32-
return f"{self.package}=={self.version}"
32+
return f"{self.package}~=2.0.0rc0"
33+
34+
@property
35+
def exact_requirement(self) -> str:
36+
return f"{self.package}=={self.registry_version}"
3337

3438
@property
3539
def install_command(self) -> str:
36-
return f"pip install {self.requirement}"
40+
return f"pip install '{self.requirement}'"
3741

3842

3943
def normalize_registry_version(version: str) -> str:

‎scripts/check_api_reference_install.py‎

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,12 @@ def validate_source_templates(repo_root: Path, identity: ReleaseIdentity) -> Non
9595
if re.search(r"\b[0-9]+\.[0-9]+\.[0-9]+-(?:alpha|beta|rc)\.[0-9]+\b", reference, re.IGNORECASE):
9696
raise ValueError("docs/index.md must derive exact prerelease identities from pyproject.toml")
9797

98+
reference_command = markdown_install_command(repo_root / "docs" / "index.md")
99+
if shlex.split(reference_command) != shlex.split(identity.install_command):
100+
raise ValueError("docs/index.md first install command must select the supported 2.0 prerelease line")
101+
98102
readme = repo_root / "README.md"
99-
expected = ["pip", "install", "--pre", "durable-workflow~=2.0.0rc0"]
103+
expected = ["pip", "install", "durable-workflow~=2.0.0rc0"]
100104
command = markdown_install_command(readme)
101105
if shlex.split(command) != expected:
102106
raise ValueError(f"README first install command must select the 2.0 prerelease line, got {command!r}")
@@ -139,7 +143,7 @@ def validate_rendered_site(site: Path, identity: ReleaseIdentity) -> str:
139143

140144

141145
class PublicRequirementUnavailable(subprocess.CalledProcessError):
142-
"""The exact requirement could not be installed from the public channel."""
146+
"""A required package version could not be installed from the public channel."""
143147

144148

145149
def install_public_requirement(
@@ -150,7 +154,7 @@ def install_public_requirement(
150154
attempts: int,
151155
retry_sleep: float,
152156
) -> None:
153-
"""Install an exact requirement from public PyPI, retrying propagation delays."""
157+
"""Install the supported prerelease requirement from public PyPI."""
154158
if attempts < 1:
155159
raise ValueError("Public PyPI install attempts must be at least 1")
156160
if retry_sleep < 0:
@@ -187,10 +191,10 @@ def install_public_requirement(
187191
raise PublicRequirementUnavailable(result.returncode, command)
188192

189193

190-
def run_clean_install(
194+
def _run_clean_requirement(
191195
requirement: str,
192-
identity: ReleaseIdentity,
193196
*,
197+
expected_version: str | None,
194198
install_attempts: int = 6,
195199
install_retry_sleep: float = 20,
196200
) -> None:
@@ -212,22 +216,44 @@ def run_clean_install(
212216
213217
import durable_workflow
214218
215-
expected = os.environ["EXPECTED_DURABLE_WORKFLOW_VERSION"]
219+
expected = os.environ.get("EXPECTED_DURABLE_WORKFLOW_VERSION")
216220
installed = importlib.metadata.version("durable-workflow")
217-
if installed != expected:
221+
if expected and installed != expected:
218222
raise SystemExit(f"installed durable-workflow {installed}, expected {expected}")
219-
if durable_workflow.__version__ != expected:
220-
raise SystemExit(f"imported durable-workflow {durable_workflow.__version__}, expected {expected}")
223+
if durable_workflow.__version__ != installed:
224+
raise SystemExit(f"imported durable-workflow {durable_workflow.__version__}, installed {installed}")
221225
print(f"clean API-reference install imported durable-workflow {installed}")
222226
"""
223227
env = {
224228
**os.environ,
225-
"EXPECTED_DURABLE_WORKFLOW_VERSION": identity.registry_version,
229+
"EXPECTED_DURABLE_WORKFLOW_VERSION": expected_version or "",
226230
"PYTHONPATH": "",
227231
}
228232
subprocess.run([str(python), "-c", check], cwd=clean_root, env=env, check=True)
229233

230234

235+
def run_clean_install(
236+
requirement: str,
237+
identity: ReleaseIdentity,
238+
*,
239+
install_attempts: int = 6,
240+
install_retry_sleep: float = 20,
241+
) -> None:
242+
"""Exercise the documented range and independently require the exact release."""
243+
_run_clean_requirement(
244+
requirement,
245+
expected_version=None,
246+
install_attempts=install_attempts,
247+
install_retry_sleep=install_retry_sleep,
248+
)
249+
_run_clean_requirement(
250+
identity.exact_requirement,
251+
expected_version=identity.registry_version,
252+
install_attempts=install_attempts,
253+
install_retry_sleep=install_retry_sleep,
254+
)
255+
256+
231257
def verify_public_deployment(
232258
url: str,
233259
identity: ReleaseIdentity,
@@ -289,7 +315,7 @@ def main() -> int:
289315
parser.add_argument(
290316
"--unavailable-exit-code",
291317
type=int,
292-
help="Return this distinct code only when public PyPI cannot install the exact requirement.",
318+
help="Return this distinct code only when public PyPI cannot install the documented or exact requirement.",
293319
)
294320
parser.add_argument(
295321
"--source-revision",

0 commit comments

Comments
 (0)