Skip to content
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

[Docs] Align _cpython.mojo docs with the C API #3661

Open
helehex opened this issue Oct 13, 2024 · 1 comment
Open

[Docs] Align _cpython.mojo docs with the C API #3661

helehex opened this issue Oct 13, 2024 · 1 comment
Labels
help wanted Extra attention is needed mojo-repo Tag all issues with this label

Comments

@helehex
Copy link
Contributor

helehex commented Oct 13, 2024

Where is the problem?

https://github.com/modularml/mojo/blob/main/stdlib/src/python/_cpython.mojo

What can we do better?

The _cpython module provides bindings to CPython, so it should reflect and wrap it in a consistent way, with corresponding documentation. Currently some things are missing though.

This involves:

  • Links to the official documentation, or docstrings which accurately describe the function
  • Documenting cases where a function raises

Maybe this could fall under bindgen and be done automatically:
We could put the ref comments in and later pull in the documentation automatically and put it in as a docstring.
However, the documentation does not seem very gen-friendly.

Anything else?

This was talked about in the public stdlib discussion here)
@soraros started work on cleaning it up here

@helehex helehex added documentation Improvements or additions to documentation mojo-repo Tag all issues with this label labels Oct 13, 2024
@soraros
Copy link
Contributor

soraros commented Oct 14, 2024

We should also use types (c_char etc.) from ffi in the get_function calls.

@JoeLoser JoeLoser added the help wanted Extra attention is needed label Oct 14, 2024 — with Linear
@JoeLoser JoeLoser removed the documentation Improvements or additions to documentation label Oct 14, 2024
modularbot pushed a commit that referenced this issue Oct 16, 2024
- [X] Document PyGILState_STATE
- [X] Rename PyKeyValuePair to PyKeysValuePair to match CPython
- [X] Add docstrings to all the structs in cpython.mojo
- [X] Add single docstring regarding C-API docs to all the functions

Related issue: #3661

Co-authored-by: Manuel Saelices <[email protected]>
Closes #3664
MODULAR_ORIG_COMMIT_REV_ID: d464718f686c30d0c223c812b2fa8eb67fb654b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

3 participants