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

feat(bindings/python): add auto-generated api docs #1613

Merged
merged 3 commits into from
Mar 18, 2023

Conversation

messense
Copy link
Member

@messense messense commented Mar 15, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  • Use pdoc to generate API docs.

image

@PsiACE
Copy link
Member

PsiACE commented Mar 15, 2023

It looks a bit complicated, I think pdoc might be much simpler.

@messense
Copy link
Member Author

I don't mind switching to pdoc, though it can't document opendal.layers yet:

pdoc opendal/
pdoc server ready at http://localhost:8080
Warn: Error parsing type stubs for opendal:
Traceback (most recent call last):
  File "/Users/messense/.pyenv/versions/3.11.0/envs/test-3.11/lib/python3.11/site-packages/pdoc/doc_pyi.py", line 105, in include_typeinfo_from_stub_files
    imported_stub = _import_stub_file(module.modulename, stub_file)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/messense/.pyenv/versions/3.11.0/envs/test-3.11/lib/python3.11/site-packages/pdoc/doc_pyi.py", line 40, in _import_stub_file
    eval(code, m.__dict__, m.__dict__)
  File "opendal/__init__.pyi", line 19, in <module>
    from .layers import ConcurrentLimitLayer, ImmutableIndexLayer, RetryLayer
ImportError: attempted relative import with no known parent package
 (/Users/messense/.pyenv/versions/3.11.0/envs/test-3.11/lib/python3.11/site-packages/pdoc/doc_pyi.py:107)

@messense
Copy link
Member Author

messense commented Mar 15, 2023

And pdoc doesn't pickup docstrings in .pyi files with current setup.

image

@Xuanwo
Copy link
Member

Xuanwo commented Mar 15, 2023

And pdoc doesn't pickup docstrings in .pyi files with current setup.

Related to mitmproxy/pdoc#239?

@messense
Copy link
Member Author

And pdoc doesn't pickup docstrings in .pyi files with current setup.

Related to mitmproxy/pdoc#239?

Probably just need to move docstrings to Rust side.

@PsiACE
Copy link
Member

PsiACE commented Mar 15, 2023

Just an example #1614

@messense
Copy link
Member Author

I don't mind switching to pdoc, though it can't document opendal.layers yet:

pdoc opendal/
pdoc server ready at http://localhost:8080
Warn: Error parsing type stubs for opendal:
Traceback (most recent call last):
  File "/Users/messense/.pyenv/versions/3.11.0/envs/test-3.11/lib/python3.11/site-packages/pdoc/doc_pyi.py", line 105, in include_typeinfo_from_stub_files
    imported_stub = _import_stub_file(module.modulename, stub_file)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/messense/.pyenv/versions/3.11.0/envs/test-3.11/lib/python3.11/site-packages/pdoc/doc_pyi.py", line 40, in _import_stub_file
    eval(code, m.__dict__, m.__dict__)
  File "opendal/__init__.pyi", line 19, in <module>
    from .layers import ConcurrentLimitLayer, ImmutableIndexLayer, RetryLayer
ImportError: attempted relative import with no known parent package
 (/Users/messense/.pyenv/versions/3.11.0/envs/test-3.11/lib/python3.11/site-packages/pdoc/doc_pyi.py:107)

Can't solve this yet, this boils down to PyO3/pyo3#759 and the workaround doens't work with pdoc.

@Xuanwo
Copy link
Member

Xuanwo commented Mar 17, 2023

I am not satisfied with the current state of the Layers API. Therefore, I am fine if we do not document any API related to layers at this time. Maybe we can setup the Operator related API first?

@messense messense marked this pull request as ready for review March 18, 2023 00:56
@messense messense requested a review from Xuanwo March 18, 2023 01:07
@suyanhanx
Copy link
Member

We can update here together.

https://github.com/apache/incubator-opendal/blob/27abd5123c14fbc6eb3438197183640744ac47b3/website/docusaurus.config.js#L92-L96

@Xuanwo
Copy link
Member

Xuanwo commented Mar 18, 2023

Hello, @messense. I apologize for the broken CI. It has been fixed now. Kindly update your branch and try again.

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Copy link
Member

@suyanhanx suyanhanx left a comment

Choose a reason for hiding this comment

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

Thanks.

@Xuanwo Xuanwo merged commit 0ac2b78 into apache:main Mar 18, 2023
@messense messense deleted the python-docs branch July 23, 2023 14:53
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.

4 participants