Skip to content

fix: scatter connect colours and the conda-feedstock tracking issue - #534

Merged
blalterman merged 7 commits into
masterfrom
fix/connect-color-and-feedstock
Nov 5, 2026
Merged

blalterman merged 7 commits into
masterfrom
fix/connect-color-and-feedstock

Conversation

@blalterman

Copy link
Copy Markdown
Owner

Two fixes.

Scatter connect=True colours (6d783539). With a varying z, a colour in connect_kwargs replaced the segments' z colouring, so they no longer matched the colorbar. The segments now keep the colormap, and the colour key is dropped with a UserWarning naming it. Without a varying z, every spelling of the colour (color, c, colors, edgecolor, edgecolors, ec) now sets the segments' colour; before, c raised AttributeError and the others were overridden. Giving two raises TypeError.

Conda-feedstock tracking issue (e60a3692, 98fdb53d, 44b5997c). The 0.5.0 publish job failed to open its tracking issue until a manual retry, because the sdist download from files.pythonhosted.org returned a cached 404 right after upload.

  • The SHA256 now comes from PyPI's JSON API, retried with a 15 s backoff doubling to 120 s, for at most 600 s. Nothing is downloaded.
  • The issue body was a plain string, so its version, checksum, commands and dependency comparison went out as literal placeholders. It is now filled in.
  • The Git Commit line named the annotated tag object; it now names the released commit.
  • requests joins the test and dev extras, since the new tests import it.

Tests landed first as xfail(strict=True) in 98fdb53d; 44b5997c removes the markers.

Verification

  • --dry-run for 0.5.0 against live PyPI: SHA256 e42ced…41da (matches the feedstock recipe), commit 7a4a2e48, full issue body.
  • The annotated-tag test builds a git repo in tmp_path. It clears every GIT_* variable first: an earlier version, run by the pre-commit hook from a linked worktree, inherited GIT_DIR and re-initialised the real repository as bare. That was reproduced in a throwaway repo, and the patched test was run inside the same linked-worktree hook without touching it.
  • Full suite via the pre-commit hook on every commit; ruff; import-linter (2 kept, 0 broken).

🤖 Generated with Claude Code

blalterman and others added 4 commits November 5, 2026 13:19
…olour key

With a varying z, a colour in connect_kwargs replaced the segments' z
colouring, so they no longer read off the colorbar. The segments now keep
the points' colormap and norm, and the colour is dropped with a
UserWarning naming the key. Without a varying z, every spelling of the
colour (color, c, colors, edgecolor, edgecolors, ec) sets the segments'
colour; before, c raised AttributeError and the others were overridden by
the points' colour. Two colour keys raise TypeError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… commit

The issue body was a plain string, so its version, checksum, commands and
dependency comparison went out as literal placeholders; it is now built by
build_issue_body as an f-string. The Git Commit line read the annotated tag
object's ID; it now resolves the tag to the commit it names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… read

Target tests, xfail(strict=True) until the script change lands: a 404 or a
release listed before its sdist is retried with a bounded backoff, and the
sdist SHA256 comes from PyPI's JSON API without downloading the file. The
pre-release refusal already holds and guards. requests joins the test and dev
extras because the tests import it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed wait

Right after an upload, files.pythonhosted.org returned a cached 404 for the
sdist, so the publish job's tracking issue failed until a manual retry. The
script now reads the digest PyPI lists in its JSON API, retrying a 404, a
release listed before its sdist, or a network error with a 15 s backoff that
doubles to a 120 s cap, for at most 600 s. calculate_sha256 and its download
are removed; validate_pypi_release shares the same retrying fetch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Claude finished @blalterman's task in 20s —— View job


Review of PR #534

I read the diff for src/, scripts/ and pyproject.toml. I did not run the test suite or read the test files.

Verdict: No blocking issues. The changes follow the CLAUDE.md conventions: tests landed first as xfail(strict=True), nothing was renamed, and the _warn helper and import layering are respected.

Scatter connect colours (scatter.py)

  • Popping the colour key before normalize_kwargs and passing color= explicitly is clean. It fixes the c → AttributeError case and the old setdefault override.
  • _warn exists in tools and defaults to UserWarning, so the warning matches the PR description.
  • Raising TypeError when two spellings are given is a sensible choice.
  • Minor: facecolor or facecolors in connect_kwargs is not in _COLOR_KEYS. It passes through to LineCollection and has no visible effect on lines. That is fine, but you could mention it in the docstring.

Feedstock script (update_conda_feedstock.py)

  • Reading the SHA256 from the JSON API with bounded backoff is a good fix. It avoids the CDN's cached 404.
  • Backoff sums to exactly 600 s. pause = min(delay, max_wait - waited) keeps it bounded, and the loop terminates.
  • The ^{commit} peel is correct for annotated tags.
  • Making body += f""" an f-string fixes the literal placeholders. Check that the template has no stray {/} (for example in shell snippets). The dry-run you describe suggests it is fine.
  • Suggestion: validate_pypi_release and get_sdist_sha256 each call fetch_release_json. That means two sequential fetches, and when PyPI hasn't listed the release, two independent 600 s waits (up to 20 minutes). Fetching once and passing the data on would avoid both. This is the CLAUDE.md "extract at the second copy" case. If PyPI is slow, the second wait can only start after the first succeeds, so it is cheap in practice. Still, caching the result on the instance would be simple.
  • Minor: validate_pypi_release no longer has a broad except. fetch_release_json catches RequestException and ValueError. A KeyError or AttributeError from an unexpected JSON shape, such as urls being null, would now propagate. That is arguably better, and data.get("urls", []) would still fail on an explicit null. data.get("urls") or [] is more defensive.
  • Minor: a version that was never published waits the full 600 s before failing. That is inherent to the retry design, but a --no-wait flag or env override might help local runs.
  • requests is now in the test and dev extras, which matches the new tests.

Tests

The PR description is thorough about the GIT_* environment hazard in the annotated-tag test. Clearing those variables is the right fix.

blalterman and others added 3 commits November 5, 2026 15:07
…x-wait

Target tests from the PR review, xfail(strict=True) until the script change
lands. The version-mismatch check moves to its own test, since a shared
fetch answers a second validation from the first response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… CLI

Validation and the checksum read now share one PyPI response, kept per
version, so a run asks PyPI once and cannot wait twice. A null urls list
counts as a release without its sdist. --max-wait sets the wait, so a local
run on a mistyped version need not sit out ten minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Claude finished @blalterman's task in 20s —— View job


Review of PR #534

I read the diff of src/, scripts/ and pyproject.toml for HEAD (94c27b1). I did not run the test suite or read the test files. I couldn't diff against origin/master: this checkout has no merge base with it, so I diffed against HEAD~7.

Verdict: No blocking issues. The suggestions from the earlier review are already in this revision:

  • The release JSON is now fetched once and cached per version in _release_json.
  • A null urls is handled by _sdist_entry through data.get("urls") or [].
  • --max-wait is added.
  • The facecolor note is in the docstring.

Scatter connect colours (scatter.py)

  • Popping the colour key before normalize_kwargs and passing color= explicitly fixes both the c → AttributeError case and the old setdefault override.
  • _COLOR_KEYS covers the spellings listed in the PR, and TypeError on two spellings is clear.
  • The UserWarning names the key that was dropped.
  • Minor: _warn is called with no stacklevel argument. If _warn doesn't set it, the warning will point inside the library rather than at the user's call. Check that this is acceptable.

Feedstock script (update_conda_feedstock.py)

  • The backoff is bounded: pause = min(delay, max_wait - waited) makes the waits sum to max_wait, and the loop terminates. With --max-wait 0 there is a single attempt.
  • Only successful fetches are cached, so a failed fetch is retried on the next call.
  • requests.RequestException and ValueError cover transport errors and malformed JSON, because JSONDecodeError subclasses ValueError.
  • Minor: if PyPI returns a 200 whose JSON is not an object (a list, say), _sdist_entry raises AttributeError. This is unlikely from PyPI, so a guard is optional.
  • Minor: get_sdist_sha256 assumes _sdist_entry is non-None. That holds because the cache is only filled when an sdist entry exists, but the coupling is implicit. A short comment would help.
  • ^{commit} correctly peels annotated tags. The f-string fix for the issue body and the build_issue_body split make the body testable.
  • requests is added to the test and dev extras, which matches the new tests.

Tests

The GIT_* clearing in the annotated-tag test is the right fix. I did not review the tests.

@blalterman
blalterman merged commit a33e62a into master Nov 5, 2026
12 checks passed
@blalterman
blalterman deleted the fix/connect-color-and-feedstock branch November 5, 2026 21:30
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.

1 participant