Query Azure Artifacts Feed for Existing Version when Determining Built Version#761
Open
ScottCarda-MS wants to merge 6 commits into
Open
Query Azure Artifacts Feed for Existing Version when Determining Built Version#761ScottCarda-MS wants to merge 6 commits into
ScottCarda-MS wants to merge 6 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
ScottCarda-MS
marked this pull request as ready for review
July 24, 2026 21:16
Contributor
Author
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates set_version.py to derive the next package version from a PEP 503 “simple” index (preferring PIP_INDEX_URL for CI/Azure Artifacts) instead of calling the PyPI JSON API, and adds sorting/guards to make version selection more robust.
Changes:
- Switch version discovery from PyPI JSON (
/pypi/<pkg>/json) to parsing a PEP 503 simple index page, with support for basic-auth embedded inPIP_INDEX_URL. - Add a custom version sort key for
major.minor.patch[.devN|.rcN]and additional guards (empty index / duplicate computed version). - Add diagnostic logging about the selected index host and retrieved versions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
masenol
approved these changes
Jul 24, 2026
kikomiss
approved these changes
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
set_version.pycomputes the next package version on every publish build byquerying the list of already-published versions. Previously it made a raw call
to public PyPI (
https://pypi.python.org/pypi/azure-quantum/json). With thenetwork-isolation / CFS policy now enforced on the build agents, direct
connections to public registries are blocked, so that call fails
(
PermissionError: [WinError 10013]).This PR reworks the version logic to read the published version history from the
allowed Azure Artifacts feed (via the credentialed
PIP_INDEX_URLthatPipAuthenticate@1already provides) instead of contacting PyPI directly, whilepreserving the existing version-numbering behavior on the release path.
What changed
Source of version data: PyPI JSON API → PEP 503 simple index
PIP_INDEX_URL(set byPipAuthenticate@1to the Azure Artifacts feed in CI). The feed's simpleindex proxies its PyPI upstream live, so it returns the full published
history.
https://pypi.org/simpleonly for local runs wherePIP_INDEX_URLis not set.consuming a JSON payload. Removes the
jsonimport.Credential handling (feed auth)
PIP_INDEX_URLis moved out of the URL and into a
BasicAuthorizationheader (urllib doesnot use URL userinfo directly).
stripped, so the token is never printed.
Version parsing
azure[-_]quantum-<version>+ archive/wheel-tag boundary)captures only this package's own versions and never a version-like token
appearing elsewhere on the index page.
0.11.2004.2825, or alpha/beta like...b1) are skipped, not truncated into fabricated 3-part versions._version_sort_keyfor the supported subset(
major.minor.patchoptionally.devN/.rcN), wheredev < rc < final.Error handling
HTTPError(non-2xx responses) andURLError(connection problems) fromurlopenare caught and re-raised as aRuntimeErrorwith the sanitized URLand the status/reason, for a clear and consistent failure message.
Safety guards (fail loud, never publish a wrong number)
silently computing a low version that would collide with an existing release.
the published list, to avoid republishing an existing version.
Diagnostics
most recent version, to make it easy to confirm the index returned a sane
published history.
Tests
test_set_version.pyadds coverage (8 tests total, all passing):.zip, name normalization, and.dev/.rc.b1, other packages, downloadpaths).
get_build_versionsorts before selecting; empty list and already-existingcomputed version each raise
RuntimeError.Verification
python -m pytest test_set_version.py -q→ 8 passed.get_build_version("patch", "dev")returns the expected nextversion from the full published history.
version list is returned under the enforced network-isolation policy.
Notes for reviewers
PipAuthenticate@1,PIP_INDEX_URL, network-isolation settings)is already in place from the prior isolation-policy merge; no YAML changes are
included here.
works without feed credentials during development.