Skip to content

Fix __init__.py labels in rendered diff listings#2799

Open
shrirajpawar4 wants to merge 3 commits into
ethereum:forks/amsterdamfrom
shrirajpawar4:fix/filename-in-render
Open

Fix __init__.py labels in rendered diff listings#2799
shrirajpawar4 wants to merge 3 commits into
ethereum:forks/amsterdamfrom
shrirajpawar4:fix/filename-in-render

Conversation

@shrirajpawar4
Copy link
Copy Markdown

Summary

Fix diff Browse labels for package modules so __init__.py is displayed correctly instead of index.

What changed

  • split diff source metadata into:
    • a listing/display path
    • an output path
  • keep __init__.py as the listing path for diff sources
  • keep index as the emitted output path so diff URLs remain unchanged
  • add a render-level regression test for the Browse listing
  • run the targeted docc regression test in the docs workflow

Why

The diff renderer was reusing the rewritten output path (.../index) as the visible listing path. That caused Browse sections on diff pages to show index instead of __init__.py for package
modules.

This change fixes the label at the source metadata layer while preserving existing generated diff URLs like .../index.html.

Testing

  • uv run --group test --group doc pytest tests/spec_tools/test_docc.py
  • just docs-spec

Verified in generated docs that pages such as diffs/bpo5/amsterdam/vm/index.html now show __init__.py in the Browse section.

Closes #2788

Path to the Source (if one exists) relative to the project root.
"""
return None
return self._relative_path
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This highlights an interesting problem with docc... relative_path is supposed to point to an on-disk file, but we also use it to compute the display name.

Comment on lines +239 to +241
- name: Run docc diff regression test
run: uv run --group test --group doc pytest tests/spec_tools/test_docc.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it CI failed because docc wasn't part of the test group? Would it make more sense to just add docc to the test group?

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.

Fix __init__.py file name in rendered diffs

2 participants