Skip to content

gh-133678: Add a banner to C API doc to recommend 3rd party tools #133679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 8, 2025

@vstinner
Copy link
Member Author

vstinner commented May 8, 2025

Banner added to all pages (the gray note):

Screenshot 2025-05-08 at 17-50-23 Python_C API Reference Manual — Python 3 15 0a0 documentation


Link to this new section:

Screenshot 2025-05-08 at 17-51-19 Introduction — Python 3 15 0a0 documentation

@zooba
Copy link
Member

zooba commented May 8, 2025

I think we'll need a bit more nuance in here, explaining why we still have a C API at all if we're telling people not to use it (obvious to us, not obvious to someone who happens to be reading these docs for the first time).

@efimov-mikhail
Copy link
Contributor

I think we'll need a bit more nuance in here, explaining why we still have a C API at all if we're telling people not to use it (obvious to us, not obvious to someone who happens to be reading these docs for the first time).

Totally agree. For example, I've personally taken a lot of information from the last discuss thread. It seems to be very useful to document these nuances in concise manner.

@zooba
Copy link
Member

zooba commented May 8, 2025

I also think we need to be careful to indicate that these are not supported by the same people who maintain Python, and issues need to be raised with the projects directly.

@philthompson10
Copy link

...and, by implication, other abstractions are not recommended?

@vstinner
Copy link
Member Author

vstinner commented May 8, 2025

@zooba: I elaborated the rationale a little bit in the "Recommended third party tools" section. Feel free to propose better wording, I'm not good to write documentation :-)

https://cpython-previews--133679.org.readthedocs.build/en/133679/c-api/intro.html#recommended-third-party-tools

@vstinner
Copy link
Member Author

vstinner commented May 8, 2025

...and, by implication, other abstractions are not recommended?

It's not the case. Did I miss some major abstractions in my list?

@philthompson10
Copy link

The list is at least inconsistent with https://docs.python.org/dev/faq/extending.html#writing-c-is-hard-are-there-any-alternatives

However my problem is with the word recommended which implies some sort of official blessing which would put new (possibly better) abstractions at a disadvantage and implies some quality control process. I'd prefer something like established or commonly used.

@efimov-mikhail
Copy link
Contributor

However my problem is with the word recommended which implies some sort of official blessing which would put new (possibly better) abstractions at a disadvantage and implies some quality control process.

IMO, this is actually a recommended API for the most of the projects. There is no direct implication that other abstraction could not be better in future. In fact, it's not a problem to add a new entry to this list, if some project had proven as a well-established alternative.

But at the moment a maintainer of some project can use C API directly or through some binding. And CPython developers encourage that maintainer to use the latter.

vstinner and others added 3 commits May 9, 2025 07:44
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@vstinner vstinner marked this pull request as ready for review May 9, 2025 05:55
@vstinner vstinner requested review from AA-Turner, hugovk and 1st1 as code owners May 9, 2025 05:55
@vstinner vstinner changed the title gh-133678: Add a banner to C API doc to recommend tools gh-133678: Add a banner to C API doc to recommend 3rd party tools May 9, 2025
@ZeroIntensity ZeroIntensity added docs Documentation in the Doc dir topic-C-API labels May 9, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs May 9, 2025
Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

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

Suggested an adjustment to the banner wording. The intro to https://docs.python.org/3/extending/index.html should also be updated (potentially replacing the existing 3rd party tool list there and cross-referencing it from the C API intro rather than making a new separate list in the C API docs intro)

Comment on lines +268 to +269
class CAPIToolsBanner(SphinxDirective):
"""CAPI Tools banner."""
Copy link
Member

Choose a reason for hiding this comment

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

From an implementation perspective, it would be better to use an .. include:: directive rather than adding custom code here.

I don't have a strong opinion on the banner in general, but I wonder if adding it to every page is a bit much? I defer to the C API group for deliberations here, though.

A

Copy link
Contributor

Choose a reason for hiding this comment

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

We've had the existing note in the extending/embedding intro for a long time, but it doesn't really work for anyone coming in from a deep link (including search results). A banner seems like a plausible improvement.

Given the possibility of anchor targets dropping people in well down the pages, though, I do wonder if a hovering banner like the ones added to finalised PEPs might be a better technical approach.

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

8 participants