Repository navigation
marker/extras: port pypa conformance tables + uv-pep508 carets (rstudio/package-manager#19392) - #62
Merged
Merged
Conversation
Ports test_canonicalize_name and the non-validating half of test_canonicalize_name_invalid from pypa/packaging (rstudio/package-manager#19392). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ports TestOperatorEvaluation, the parse/evaluate tables, PEP 345 and setuptools-legacy variable coverage, extra normalization, and the module-level and/or evaluation tests from pypa/packaging (rstudio/package-manager#19392). All rows pass unchanged; no fixes needed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ports the error_* inputs and caret spans from uv-pep508 (rstudio/package-manager#19392), asserting our own Start/End offsets and message text, never uv's prose. 34 rows pass or are annotated divergences (point vs span convention); 10 are documented skips (different error anchor, an oracle conflict with uv, or version validity deferred to package requirement). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adds three paragraphs for the marker/, extras/ and internal/pep508 conformance tests added for rstudio/package-manager#19392. Appended after the existing rapid paragraph so it merges cleanly with #60, which is rewriting NOTICE elsewhere; needs the same licensing review. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Independent review caught the header's self-reported split (5+28+7+4=44) undercounting by one: the table has 45 rows (5 pass, 30 divergence, 10 skip), not 44. No table or test logic changed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Ports pypa/packaging's marker/extras conformance tables and uv-pep508's error caret positions into three new table-driven test files. No production code changes: every mutation below was reverted before commit, and no case needed a fix.
Test-only change; no CHANGELOG entry (see "CHANGELOG" below).
Scope
Per the issue's own correction:
test_utils.pyyields one portable case (canonicalize_name), not eleven — the rest arewheelname/'s concern or have no Go counterpart at all. Scoped to that, plustest_markers.py's marker tables and uv-pep508's error-position snapshots (inputs and offsets only, never uv's message text).Upstream pins
pypa/packagingtests/test_markers.py,tests/test_utils.py4eb0753dba8fcaaac8eb75463374e448f093155826.3dereferences to929fd4b1410ac7ef61ef3f45b2f5d7e87711a9b5, 6 commits ahead; its onlytest_markers.pychange is a type annotation onTestNode.test_accepts_value(not ported,TestNodehas no counterpart anyway) — so the ported content is identical at 26.3.astral-sh/uvcrates/uv-pep508/src/lib.rs'smod tests01cb90c1a4f88af09906cb60de9766d2add4a0620.12.18(lightweight tag), confirmed bycommits/01cb90c.Cargo.tomlat that commit:license = "Apache-2.0 OR BSD-2-Clause";License-BSDline 1:Copyright (c) 2023 konstin. First uv pin in this repo.Per-file counts
extras/conformance_test.gomarker/conformance_test.gointernal/pep508/error_position_test.goZero fixes: every ported case either passes as upstream states it, is an annotated divergence, or is a documented skip with a concrete reason (
t.Skip, visible ingo test -v's--- SKIPlines).Correction carried from the issue
Nearly every upstream
evaluate(dict)call is a partial environment: 18 of the 40evaluate(calls intest_markers.pypass a dict, and upstream fills every key the dict omits from the live interpreter — not "~4" as the issue estimated. Every dict case here is built asbaseEnvironment().With(dict), never a struct literal (seemarker/conformance_test.go's header andpartial_environment_test.go'sTestStructLiteralZeroFillIsNotAPartialEnvironment).Skips and divergences
extras/: thevalidate=Truehalf oftest_canonicalize_name_invalidis a whole-function skip —Normalizehas no validate mode, documented in the file header as a half-port.marker/: 5 divergences, all documented inline —'2.7.0' ~= os_name,os_name === 'posix',sys_platform === 'linux': upstream raisesUndefinedComparison;Evaluate's fixedboolcan't propagate an error, so it returnsfalse(pre-existing, documented divergence, already pinned byevaluate_test.go).test_parses_invalid_malformed_quoted_string's two inputs: asserted as errors only, not upstream's exact wrapped message/caret (that granularity lives ininternal/pep508, not here; this input overlapsinternal/pep508/marker_test.go's #19401 escape table — duplication is deliberate per the issue).internal/pep508/error_position_test.go(uv): the caret-translation rule (documented once, in the file header) — uv draws a caret as^^^^spanning display columns; ours draws~~~+ one^at a byte offset. Every "Expected X" error in this grammar is a zero-width point at the parser's cursor; uv spans the whole offending token. Where our point equals uv's span start, that's an annotated divergence (29 rows, one shared reason) — not a bug, we just don't additionally measure a width. One more row (error_random_char) is divergent differently: our point lands at the last byte of uv's span, not the first (both anchor the same#) — 30 divergences total.10 skips:
error_extras_eof1/2/3,error_parenthesized_parenthesis,error_marker_incomplete4(5): different anchor entirely — we report the cursor at end-of-input where a closing]/)was expected; uv reports the position of the opening delimiter that never closed. Fixing this would mean widening the zero-width convention across every unclosed-delimiter call site, well past a contained fix.error_unnamedunnamed_url(1): uv has a bespoke "this looks like an unnamed URL" heuristic with a tailored message; pypa (our semantics anchor) has no such heuristic and neither do we.error_end(name_),error_extras_illegal_end'sfoo[bar_]case (2): the exact oracle-conflict example from the issue — pypa accepts a trailing_in this identifier grammar, uv rejects it, we follow pypa.error_pep440(numpy >=1.1.*),error_invalid_prerelease(name==1.0.org1) (2): version-string validity is checked one layer up, in packagerequirementviaversion.NewSpecifiers— this raw grammar entry point (pep508.ParseRequirement, matchinggrammar_conformance_test.go's own entry point) doesn't validate specifier text at all.error_invalid_extra_unnamed_urlis excluded outright (not counted above): behind uv'snon-pep508-extensionscargo feature, no counterpart.Byte-vs-display-column note (as flagged by the issue):
error_unicode_after_extraandparse_name_with_star's non-ASCII case involve a multi-byte character right at the flagged position; our zero-widthStartstill lands at the correct byte offset (nothing multi-byte precedes it here), so only uv's span width would differ if we ever measured one. Annotated, not "fixed".Mutation proofs (all reverted before commit;
git diff --staton each production file is empty)evalStringOp's"in"case to!strings.Contains(...). RED:TestConformance_Evaluates/'2.7'_in_python_versionfailed. Reverted, GREEN..fromNormalize's collapsed-separator set. RED:TestConformance_CanonicalizeName/Foo.....Bar(and its sibling.-bearing rows) failed. Reverted, GREEN.StartinNewSyntaxErrorAt. RED: many namederror_*rows failed (e.g.error_random_char,error_whats_that). Reverted, GREEN.NOTICE
Append-only, at the very end of the file (after the
pgregory.net/rapidparagraph) — three new paragraphs for themarker/,extras/andinternal/pep508conformance ports. PR #60 is rewriting NOTICE elsewhere (its hunks end well above this append point), so this should merge cleanly in either order — but it still needs the same human licensing review #60 is waiting on, especially the uv-pep508Apache-2.0 OR BSD-2-Clause/Copyright (c) 2023 konstinattribution.CHANGELOG
No entry. Every row is test-only or an annotated/skipped divergence; no fix touched
marker/*.go,extras/extras.goorinternal/pep508/*.go(confirmed empty diffs on all three after each mutation revert).Out of scope / candidate follow-ups (not filed, per the issue)
test_python_full_version_untagged_user_provided: surfaces thatEvaluatedoes not repair a bare trailing"+"on a caller-suppliedpython_full_versionthe wayEnvironmentFromTargetdoes. Real gap, not fixed here.Verification
go test ./... -count=1andgo test -race ./... -count=1: all packages pass.go vet ./...: clean.gofmt -l .: empty.golangci-lint run ./...at the repo's pinned v2.11.2: clean (verified live via a planted, then removed, uncheckedos.Setenv).go list -deps ./... | grep rapid: empty.go.moduntouched (go 1.25.0).error_position_test.goheader's self-reported split (5+28+7+4=44) undercounted by one row (actually 5 pass / 30 divergence / 10 skip = 45); corrected in a follow-up commit, no table or test logic changed.🤖 Generated with Claude Code