GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-97908: CAPI docs: Remove repeated struct names from member docs by encukou · Pull Request #100054 · python/cpython

Conversation

@encukou

@encukou encukou commented Dec 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Members with repeated struct names were interpreted as e.g. PyType_Spec.PyType_Spec.name,
showing up incorrectly wrong in the search and index, and complicating automation.

This removes the duplicated names, but keeps old HTML anchors so that external links continue to work.
I don't see a better way than raw HTML to add custom anchors with dots.

Most PyMemberDef fields were already fixed in GH-99014, old anchors are added for those too.

Edit: PyMemberDef and PyGetSetDef were only marked up in 3.12 (gh-97909), so they don't need “old” URL anchors.

  • Issue: Docs for some C struct members repeat the struct name #97908

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
encukou added 4 commits December 6, 2022 10:47
@encukou
TMP: Fail docs build on repeated name components
493ff87
@encukou
Remove duplicate struct names from member docs
e2867fd
@encukou
Add raw HTML fragments to keep old links working
14c2ae7
@encukou
Remove hack to find repeated struct names
26e095e
@bedevere-bot bedevere-bot mentioned this pull request Dec 6, 2022
Docs for some C struct members repeat the struct name #97908
Closed
@bedevere-bot bedevere-bot added awaiting core review docs Documentation in the Doc dir skip news labels Dec 6, 2022
@encukou

encukou commented Dec 6, 2022

Copy link
Copy Markdown
Member Author

(I've included and reverted a hack to find these. I don't think it's worth keeping, at least without better error reporting. Eventually I hope we'll grow general checks that docs correspond to code.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou
encukou requested a review from AA-Turner December 6, 2022 10:43
@hugovk hugovk mentioned this pull request Dec 6, 2022
bpo-37860: re-add netlify.toml to set up deploy previews for docs #92852
Merged
@encukou
Merge branch 'main' into struct-name-repeats
afab871
@netlify

netlify Bot commented Dec 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✅ Deploy Preview for python-cpython-preview ready!

Name Link
🔨 Latest commit cc57955
🔍 Latest deploy log https://app.netlify.com/sites/python-cpython-preview/deploys/638f6c9df0890f000965d292
😎 Deploy Preview https://deploy-preview-100054--python-cpython-preview.netlify.app/c-api/structures
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou
Don't add "old" fragments for PyMemberDef and PyGetSetDef
cc57955
These were only marked up in 3.12 (pythongh-97909), so they don't need
backcompat backflips.
@CAM-Gerlach

CAM-Gerlach commented Dec 7, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I don't see a better way than raw HTML to add custom anchors with dots.

I can think of a few practical solutions here that should work, that would be cross-builder, less hacky, and more concise, clean and precise, and should be able to fix internal and intersphinx references as well:

  • Add a custom directive .. literal-target:: or similar that could be used anywhere to add a literal explicit target (without normalizing the label); this would be the most general solution, but users would have to specify the fully qualified raw label name (as you do here)
  • Add a custom directive .. alias:: or similar that could be used as a child of any domain directive (like .. c:member::), that would list alias(es) of that domain directive. A little less general, but simpler for users to use, as they only have to specifiy the immediate alias name
  • As a the most specific solution to this problem, but potentially requiring the least work by users, in our custom extension (that you inserted the check into), we could potentially add some custom code to fix the issue and retain the existing cross-references as well as new fixed ones.

I have some meetings now, but I'll explore these further and report back later tonight

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Dec 7, 2022

Copy link
Copy Markdown
Member Author

Sounds good! But it also sounds like it could use a longer discussion, since there's no obvious better way :(

Unless there's a problem with raw, let's use it for now, and file an issue for the improvement? I'd like to unblock #96996 which will also need to retain anchors.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CAM-Gerlach

CAM-Gerlach commented Dec 8, 2022

Copy link
Copy Markdown
Member

Yeah, I guess that makes the most sense, unless @AA-Turner has a better solution—I intended to get to it yesterday, but I've been busy since then helping students with their Python final projects, so I haven't had the chance to continue to dig into it and prototype something.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou mentioned this pull request Dec 8, 2022
gh-97909: Fix markup for PyMethodDef members #100089
Merged
@encukou
Merge branch 'main' of https://github.com/python/cpython into struct-…
6b5824e
…name-repeats
@encukou encukou added the needs backport to 3.12 only security fixes label May 25, 2023
@encukou
encukou merged commit 1668b41 into python:main May 29, 2023
@miss-islington

miss-islington commented May 29, 2023

Copy link
Copy Markdown
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting core review label May 29, 2023
@encukou
encukou deleted the struct-name-repeats branch May 29, 2023 11:54
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 29, 2023
@encukou @miss-islington
pythongh-97908: CAPI docs: Remove repeated struct names from member d…
0c57463
…ocs (pythonGH-100054)

And add raw HTML fragments to keep old links working.
(cherry picked from commit 1668b41)

Co-authored-by: Petr Viktorin <[email protected]>
@bedevere-bot

bedevere-bot commented May 29, 2023

Copy link
Copy Markdown

GH-105057 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label May 29, 2023
ambv pushed a commit that referenced this pull request Jun 5, 2023
@miss-islington @encukou
[3.12] gh-97908: CAPI docs: Remove repeated struct names from member …
05b6153
…docs (GH-100054) (#105057)

And add raw HTML fragments to keep old links working.
(cherry picked from commit 1668b41)

Co-authored-by: Petr Viktorin <[email protected]>
@erlend-aasland erlend-aasland mentioned this pull request Jun 6, 2023
3.12 backport gh 105236 #105358
Closed
@hugovk hugovk mentioned this pull request Dec 29, 2023
gh-101100: Fix Sphinx warnings in c-api/structures.rst #113564
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@AA-Turner AA-Turner Awaiting requested review from AA-Turner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@encukou @CAM-Gerlach @miss-islington @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.