Skip to content

Fix version resolution so uv can rebuild sdist + fix publish workflow#8

Merged
vavsab merged 1 commit into
mainfrom
fix-version-and-ci
Jul 7, 2026
Merged

Fix version resolution so uv can rebuild sdist + fix publish workflow#8
vavsab merged 1 commit into
mainfrom
fix-version-and-ci

Conversation

@vavsab

@vavsab vavsab commented Jul 7, 2026

Copy link
Copy Markdown

Background

PR #7 tried to fix an install-time metadata mismatch reported by uv (Package metadata version 'X' does not match given version 'Y') by making about.py fall back to reading PKG-INFO when packageVersion isn't set. It was broken for two reasons:

  1. about.py runs under exec(): setup.py reads about.py with exec(f.read(), package_info). In an exec'd namespace, __file__ is not defined. The _get_version() helper referenced os.path.dirname(__file__) outside its try/except, so any time packageVersion was unset it raised NameError — the exact case the fallback was supposed to handle.
  2. CI never actually published v1.0.22: setuptools ≥ 69 normalizes sdist filenames per PEP 625 (botbuilder_core_forked-1.0.22.tar.gz), but publish steps hard-coded the old hyphenated form (botbuilder-core-forked-1.0.22.tar.gz), so curl failed with exit 26. The run silently failed the whole workflow — see run 28876487468.

Net effect: v1.0.22 was tagged but never uploaded, and even if it had been, it would install as 4.15.0 in uv.

Fix

setup.py (all 4 packages) — add _resolve_version() that:

  1. Uses packageVersion env var (release build in CI).
  2. Falls back to PKG-INFO next to setup.py (uv/pip rebuild of extracted sdist). __file__ is defined in setup.py's module namespace.
  3. Falls back to 4.15.0 (unchanged final fallback).

about.py (all 4 packages) — reverted back to the v1.0.21 baseline; the version logic belongs where __file__ is available.

.github/workflows/ci.yaml:

  • Preflight check that FURY_PUSH_TOKEN is set with a clear ::error:: message pointing at the exact gh secret set command.
  • Glob dist/*.tar.gz for the sdist filename instead of the old hyphenated hard-code.
  • curl --fail-with-body so future upload/auth failures actually fail the job.

Verification

Downloaded live v1.0.21 sdist from fury and ran setup.py --version without packageVersion set:

  • Before this PR: prints 4.15.0 → uv sees metadata mismatch 1.0.21 != 4.15.0
  • After this PR (same sdist, patched setup.py): prints 1.0.21 → matches index

Also rebuilt a fresh sdist end-to-end (build with packageVersion=1.0.99, extract, rebuild wheel without env var): the wheel's METADATA reports Version: 1.0.99 matching PKG-INFO.

Follow-up

After this merges and publishes cleanly to fury, mappedgpt-bot's Dockerfile can drop the packageVersion=1.0.21 shim on the uv sync line, and its [[tool.uv.dependency-metadata]] overrides can be removed.

Previous attempt (PR #7) tried to make about.py fall back to reading
PKG-INFO when packageVersion isn't set, but about.py is exec()'d by
setup.py so __file__ is not defined in its namespace — it silently
raised NameError and fell through to '4.15.0'. That release (v1.0.22)
also never made it to fury because CI's curl was hard-coded to the
hyphenated sdist filename that setuptools >=69 no longer produces
(PEP 625 normalizes to underscores).

This change:
* Reverts the broken about.py edits back to the v1.0.21 baseline.
* Adds _resolve_version() in each setup.py (where __file__ is defined)
  that prefers packageVersion, then falls back to reading Version from
  the sdist's PKG-INFO, then to '4.15.0'. This makes 'uv sync' happy
  because the wheel it builds from the sdist reports the same version
  as the index entry (uv >=0.4 enforces this).
* Verified locally: extracted v1.0.21 currently rebuilds as 4.15.0;
  with the fix it correctly rebuilds as 1.0.21.
* Publish workflow: glob dist/*.tar.gz instead of hard-coding the
  hyphenated form, add a preflight FURY_PUSH_TOKEN check, and use
  curl --fail-with-body so future auth/upload failures actually
  fail the job.
@vavsab vavsab merged commit 6f8ccc1 into main Jul 7, 2026
1 check passed
@vavsab vavsab deleted the fix-version-and-ci branch July 7, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants