DOC: freeze old whatsnew notes (GH#6856) - #67290
Open
jbrockmendel wants to merge 4 commits into
Open
Conversation
The `.. ipython::` blocks in the whatsnew files are re-executed on every doc build against whatever pandas is current, so they illustrate behavior other than the release they describe, and they periodically break the warnings-as-errors doc build when a deprecation they demonstrate is enforced. Add scripts/freeze_whatsnew.py, which rewrites those directives as static `.. code-block:: pycon` sessions, and apply it to all 45 files that had executable blocks. For 0.17.0 and newer the script reads the file back out of git at that release's tag and runs it against that release's pandas, fetched with `pixi exec`, so the frozen output is what the release produced rather than what pandas does today. conda-forge has no pandas below 0.17.1, so the 16 pre-0.17 files are rendered against the current environment instead. 799 executable blocks and 49 :okexcept:/:okwarning: markers go to zero. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jbrockmendel
marked this pull request as ready for review
September 1, 2026 01:52
mroeschke
reviewed
Sep 1, 2026
mroeschke
left a comment
Member
There was a problem hiding this comment.
- I think it would be helpful to have a pre-commit check for the
doc/source/whatsnewdirectory to ensure.. code-block: pyconis the only allowed code-block directive in these files - IMO I don't think we'll need to commit
freeze_whatsnew.pyand the test it's essentially a one time conversion, and we should ensure all whatsnew docs (even the current) are written in a "frozen" state"
Per review: the conversion tool is not worth committing. It shells out to pixi for pandas 0.17.1-2.x under CPython 3.5/3.6, so it would rot in scripts/ and run 30 tests in CI for something nobody will invoke again. It stays reachable in this PR's history at 82d9c06. Replace it with a pygrep hook rejecting any `.. ipython` directive under doc/source/whatsnew/, which keeps every page frozen going forward, including the in-development v3.1.0. The hook also matches the missing-colons spelling, which caught the pre-existing v0.23.0 `.. ipython` typo that docutils was swallowing as a comment; its sort=False example is now frozen like its two siblings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVo28HBquFdK4ZmkjX3QZs
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.
closes #6856
The
.. ipython::blocks in the whatsnew files are re-executed on every doc build against whatever pandas is current. That is why they end up illustrating behavior other than the release they describe, and why they periodically break the warnings-as-errors doc build when a deprecation they demonstrate is enforced — five blocks inv0.18.0are currently held up by:okwarning:on theinplacedeprecation ineval/queryalone.This rewrites those directives as static
.. code-block:: pyconsessions across all 45 files that had executable blocks. 799 executable blocks and 49:okexcept:/:okwarning:markers go to zero.The conversion was mechanical, but the script that did it is deliberately not part of this PR — it is a one-shot tool that shells out to
pixi execfor pandas 0.17.1–2.x under CPython 3.5/3.6, so committing it would leave unmaintainable tooling inscripts/and 30 tests running in CI for something nobody will run again. It stays available in this PR's history:freeze_whatsnew.pyand its tests, at 82d9c06.To keep the directory frozen going forward, a
no-executable-ipython-in-whatsnewpre-commit hook rejects any.. ipythondirective underdoc/source/whatsnew/. It passes on the tree as of this PR, including the in-developmentv3.1.0.Picking up the two requests from the dev call on the previous attempt (GH-64742):
>>>prompts rather thanIn [n]:/Out[n]:, and output produced by the then-current pandas. The second turned out to be more tractable than that discussion concluded —pixi execreaches back to 0.17.1, not 2.2. Getting era-faithful output needs three things from the release, not just its pandas:git show <tag>:<file>— these files have been edited for a decade to keep executing, sov2.0.0saysfreq='ME'(a 2.2 spelling) andv0.18.0passespath_or_buf=/header=toSeries.to_csv, neither of which existed. Rendering today's text under 2.0.3 gave 15 tracebacks where 4 were intended.from pandas import *, which is why the released text saysTimestampwhere today's sayspd.Timestamp.doc/data, extracted from the tag, soread_csv('data/baseball.csv')reads the era's file.conda-forge has no pandas below 0.17.1, so the 16 pre-0.17 files are rendered against the current environment instead (
--current). Those pages stop breaking the build but are not historically accurate —v0.13.1now showsRangeIndexanddatetime64[us]where 0.13.1 printedInt64Indexand nous. Deliberate; happy to revisit if reviewers would rather see a note on those 16.Seven blocks render as input with no output, because their output was never reproducible: a
Timestamp.now()wall clock, threeid()calls used as labels, and aStylerwhose repr is a memory address. The script detects these by running each file twice from scratch and refusing anything that disagrees with itself, and pinsPYTHONHASHSEEDso dict ordering under the CPython 3.5/3.6 interpreters those old releases run on is stable. Two independent full runs produce byte-identical output.Verified: 45/45 pages build (43 clean; the 2 that warn,
unknown document: 'v1.2.1'and'/user_guide/io', warn identically on the unmodified files — single-doc mode excluding the referenced pages),pre-commitandmypyclean.One pre-existing bug is fixed rather than re-rendered:
v0.23.0.rstwrote.. ipythonwithout the::, so docutils treated it as a comment and itssort=Falseexample rendered as nothing. The new hook matches that missing-colons spelling too, so it had to be resolved here; the block is now frozen like its two siblings.AI disclosure: drafted with Claude Code (
claude opus 5 (high)), which wrote the script, ran the freeze, and reviewed the result over three adversarial review rounds.