-
-
Notifications
You must be signed in to change notification settings - Fork 848
Add a section 'Extensions' #246
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this started! Some more detailed recommendations in line, but I think this will be a useful addition.
extensions.rst
Outdated
@@ -0,0 +1,13 @@ | |||
.. _extensions: | |||
|
|||
Write a CPython extension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest "Updating standard library extension modules"
extensions.rst
Outdated
Write a CPython extension | ||
========================= | ||
|
||
In this section, we could explain how to write a CPython extension with the C language, but the topic can take a complete book. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the goal of this section should be to equip folks with the tools they need to work on the existing extension modules in the reference implementation, and to add new ones if necessary.
Essential pointers:
- link to the full C API docs: https://docs.python.org/dev/c-api/
- link to PEP 399 specifically in relation to accelerator modules and testing both implementations
extensions.rst
Outdated
|
||
Read the following references: | ||
|
||
* https://docs.python.org/3.7/extending/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For easier maintenance, use the dev
link rather than the specific version: https://docs.python.org/dev/extending/
Hi @matrixise, Do you wish to finish up this PR or would you like me to do so? Thanks! |
@willingc I will finish this PR, really sorry, I will work on it on this evening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggested wording adjustment inline, but I think is a useful addition as is.
|
||
In this section, we could explain how to write a CPython extension with the C language, but the topic can take a complete book. | ||
|
||
For this reason, we prefer to give you some links where you can read a very good documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested wording/grammar tweak:
For this reason, we instead prefer to provide some links to existing documentation that we recommend.
(Perhaps it would also be worth mentioning core-mentorship here, and linking to the section on communications?)
Do we really need to create a separate document just for four links? I think the most up-to-date and detailed resource is https://pythonextensionpatterns.readthedocs.io/en/latest/ and it was already linked in the Devguide in #279. |
We really should have more than just the 4 links - referencing the C style guide, pointers to test_embed and test_capi, etc, start building out some extra docs for internal helper functions, etc. It would make sense to mention that as a ReST comment though, otherwise it isn't clear why we're adding such a bare bones page in the first place. |
I don't think "we'll finish this later" is a good argument for merging this PR. A TODO comment can easily be forgotten in a short time. And after two years or so, someone is going to submit a PR to remove extensions.rst because it doesn't contain any useful information. Please don't make the Devguide a place for unfinished and half baked documents. |
@berkerpeksag ok, but where will you put these links? |
PEP 399 can be mentioned at https://devguide.python.org/runtests/#writing ( |
"You can find this information via Google if you already know what to look for, and how to interpret the results" isn't a particularly helpful attitude for us to adopt when writing documentation aimed primarily at new CPython contributors. If starting the section out with just a few links really bothers you, then rather than saying "This doesn't have enough content, so reject it", I'd prefer to see this new section extended a bit to also cover:
|
Most of these links are from our own documentation and don't have anything to do with contributing to CPython (except PEP 399) People can read them to learn how to write Python extensions for their own projects. We don't explain how to use unittest or how to write unit tests in the devguide. We only give information specific to CPython (how to use regrtest, how to find memory leaks by using regrtest, how to make coveragepy work with extension modules,
Your suggestions sound good to me. I'd like to see a action about how to test a C API function (by using |
* Add a section 'Extensions' * Update with the recommendations of Nick Coghlan
No description provided.