Repository navigation
Closed
Labels
lane:toolingDocs, formatter, LSP, build tools, tests, CIDocs, formatter, LSP, build tools, tests, CIreach:probeNeeds an escaped spelling, a wrong-annotation probe or a python3 message diffNeeds an escaped spelling, a wrong-annotation probe or a python3 message diff
Description
Class: source files that describe themselves as ports of CPython source but carry no licence notice. Found while preparing and reviewing #2601, which adds THIRD-PARTY-NOTICES.txt for Datetime/DatetimeIso.cs only. CPython is under the PSF License Version 2, which asks a derivative work to retain the licence text and copyright notice and to summarise its changes.
| File | Its own claim | Assessment | Ships in |
|---|---|---|---|
src/Sharpy.Stdlib/Fractions/Fraction.Format.cs:9 |
"an exact port of CPython 3.14's fractions.py" |
Real source port: _round_to_exponent / _round_to_figures translated function for function; line 30 carries a CPython comment word for word; lines 90 and 124 carry its format-spec regexes |
Stdlib, sharpyc |
src/Sharpy.Core/PyFormat.cs:1379 |
"A port of CPython's _PyUnicode_InsertThousandsGrouping" |
Likely a real port (the loop follows the C grouping loop), small | Core, Stdlib consumers, sharpyc, playground bundle |
src/Sharpy.Core/PyFormatSpec.cs:72 |
parse and rule order are CPython's unicode_format.h / formatter_unicode.c |
Borderline: structure and rule order | Core |
src/Sharpy.Stdlib/Threading/Barrier.cs:20 |
"CPython's algorithm (Lib/threading.py), on one monitor" | Borderline: same state machine, reimplemented | Stdlib |
src/Sharpy.Core/Str.cs:244 |
"ported from CPython's format_float_short" |
Probably behaviour only (one threshold rule) | Core |
src/Sharpy.Stdlib/Threading/ThreadRegistry.cs:8 |
"modelled on CPython 3.12's threading.py" |
Behaviour only | Stdlib |
Assessments are two agents' readings of the comments and code, not a legal judgment.
Owner decisions
- Which rows get a notice (header + an entry in
THIRD-PARTY-NOTICES.txt). If any Core file does,Sharpy.Core.csprojmust pack and publish the notices file too. - Package licence metadata:
Directory.Build.propssetsPackageLicenseExpressiontoApache-2.0 OR MITandREADME.mdsays the same, while the Stdlib and sharpyc packages contain PSF-2.0 portions. A per-project expression such as(Apache-2.0 OR MIT) AND PSF-2.0may be the accurate one. src/Sharpy.Stdlib.Tests/Spy/cpython/NOTICEuses the copyright years "2001-2024"; the licence text itself says "2001". Harmless, but inconsistent.
Mechanism gap: nothing checks that a file claiming to be a port has a header and a notices entry. A small test that greps Core/Stdlib for "port of CPython" / "ported from CPython" and requires a matching entry would keep this from drifting.
Generated by Claude Code
Metadata
Metadata
Assignees
Labels
lane:toolingDocs, formatter, LSP, build tools, tests, CIDocs, formatter, LSP, build tools, tests, CIreach:probeNeeds an escaped spelling, a wrong-annotation probe or a python3 message diffNeeds an escaped spelling, a wrong-annotation probe or a python3 message diff
Activity
docs: list every ported CPython function; mark notices non-exhaustive
antonsynd commentedon Nov 11, 2026
From the independent review of #2605: two more files that are structural ports of CPython source but make no "port" claim in a comment, so the new guard (which keys on self-declared ports) cannot find them.
src/Sharpy.Stdlib/Difflib/SequenceMatcher.cs:57-160,:328difflib.py__chain_b(b2j,bpopular, autojunk atn >= 200,ntest = n//100 + 1),find_longest_match(j2len/newj2len, the four junk-extension loops),fullbcount/availdifflib.pysrc/Sharpy.Stdlib/Fractions/Fraction.cs:194-236LimitDenominatorfractions.pycontinued-fraction loop, same variable names (p0,q0,p1,q1,a,q2,k,bound1/bound2) and error messagefractions.pyNot checked:
Difflib/Differ.cs,Difflib/DifflibFunctions.cs, and the rest of Stdlib module by module. The guard's limit is structural: an audit by reading each Stdlib module against its CPython counterpart is the only way to find ports that do not announce themselves. #2605 keeps the notices intro saying the list is not exhaustive.Also noted: the notices file reproduces CPython's whole
LICENSE.txtstack, which SPDX namesPython-2.0; the package metadata usesPSF-2.0(the PSF-era licence that covers post-2001 code). Both are real SPDX ids; which to declare is the owner's call.Generated by Claude Code
docs: mark notices non-exhaustive; drop an unverified upstream path
test: widen the CPython port-claim guard to more phrasings
build: make the #2602 notices census exact per file
Merge pull request #2777 from antonsynd/claude/notices-audit
antonsynd commentedon Nov 20, 2026
Closed — implemented in #2777 (merged into
devas8adf932aa). Verified ondev:THIRD-PARTY-NOTICES.txtentry, and the "not yet exhaustive" sentence is gone.Fraction.Format.cs,PyFormat.cs,PyFormatSpec.csandBarrier.csare headed and listed.Str.csandThreadRegistry.csare behaviour only, with neither.Difflib/SequenceMatcher.cs,Fraction.csLimitDenominator) are headed and listed.(Apache-2.0 OR MIT) AND Python-2.0.build_tools/tests/test_third_party_notices.py'sSTDLIB_CENSUSmaps every namesake module toportwith its exact headed files, or tobehaviour. A lost or extra header, or a new namesake module, is red; this was mutation-tested in build: complete the CPython notices (#2602 audit) #2777.test_third_party_notices.pyandtest_package_licenses.pygive 62 passed at8adf932aa.Not part of R-NJ and left as it is: decision 3,
src/Sharpy.Stdlib.Tests/Spy/cpython/NOTICE's "2001-2024" years, which the body calls harmless. The review's follow-ups (docstrings adapted from CPython, the per-module packages, and Unicode and PyYAML credits) are in a lane on the owner's word (2026-11-20).Generated by Claude Code
build: credit API summaries taken from CPython docstrings
build: credit Unicode case folding and PyYAML regexes in the notices
build: declare Unicode-3.0 and PyYAML's MIT in the package licences
build: widen the docstring guard, credit YamlScalarStyle as PyYAML
test: tighten the notices guards after the second #2780 review