-
Notifications
You must be signed in to change notification settings - Fork 51
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
Sphinx Doc-comments support #804
Open
tristanlatr
wants to merge
57
commits into
master
Choose a base branch
from
800-doc-comments-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This attribute was used to attach the right docstring node to the right Attribute object. Now it uses AST node navigation (with the .parent attribute) instead for fetching the docstring node for an ast.Assign. This change might not be worth it, on the one hand it removes a attribute beeing mutated at different palces in the code, but replaces this kind of "unsafe" state tracking (meaning not with pop() and push()) by some more verbose solution that involves adding the .parent attribute on all nodes. The zopeinferface extension needed to be adjusted as well because it relied on the docstring assigment feature in an implicit way, now it's explicit what we're doing.
…hpinx... Refactor for a better separation of docstring sources. And add a test.
@lod, this PR introduces support for doc-comments |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…r into 800-doc-comments-support
This comment has been minimized.
This comment has been minimized.
This code obviously has a bug (the pydoctor_primer diff makes no sens)... Still to be worked on... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
tristanlatr
commented
Sep 22, 2024
tristanlatr
removed
the
pending
This ticket needs code related to another ticket not yet fixed
label
Sep 22, 2024
please review |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Diff from pydoctor_primer, showing the effect of this PR on open source code: pydoctor (https://github.com/twisted/pydoctor)
+ /projects/pydoctor/pydoctor/epydoc/markup/restructuredtext.py:64: Existing docstring at line 31 is overriden
scrapy (https://github.com/scrapy/scrapy)
+ /projects/scrapy/scrapy/item.py:80: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
+ Trying "ref" as canonical role name.
+ /projects/scrapy/scrapy/item.py:80: bad docstring: Unknown interpreted text role "ref".
- these 30 objects' docstrings contain syntax errors:
+ these 31 objects' docstrings contain syntax errors:
+ scrapy.Item.fields
bottle (https://github.com/bottlepy/bottle)
+ /projects/bottle/bottle.py:4603: Cannot find link target for "bottle_sqlite"
+ /projects/bottle/bottle.py:2207: Cannot find link target for "latin1"
sphinx (https://github.com/sphinx-doc/sphinx)
+ /projects/sphinx/sphinx/locale/__init__.py:220: bad docstring: No role entry for "confval" in module "docutils.parsers.rst.languages.en".
+ Trying "confval" as canonical role name.
+ /projects/sphinx/sphinx/locale/__init__.py:220: bad docstring: Unknown interpreted text role "confval".
+ /projects/sphinx/sphinx/ext/autodoc/__init__.py:69: bad docstring: Literal block expected; none found.
+ /projects/sphinx/sphinx/project.py:33: bad docstring: No role entry for "confval" in module "docutils.parsers.rst.languages.en".
+ Trying "confval" as canonical role name.
+ /projects/sphinx/sphinx/project.py:33: bad docstring: Unknown interpreted text role "confval".
+ /projects/sphinx/sphinx/transforms/post_transforms/images.py:194: bad docstring: No directive entry for "todo" in module "docutils.parsers.rst.languages.en".
+ Trying "todo" as canonical directive name.
+ /projects/sphinx/sphinx/transforms/post_transforms/images.py:194: bad docstring: Unknown directive type "todo"... todo:: This should be refactored not to store the state without class
+ variable.
+ /projects/sphinx/sphinx/ext/intersphinx/_shared.py:36: bad docstring: No role entry for "confval" in module "docutils.parsers.rst.languages.en".
+ Trying "confval" as canonical role name.
+ /projects/sphinx/sphinx/ext/intersphinx/_shared.py:36: bad docstring: Unknown interpreted text role "confval".
+ /projects/sphinx/sphinx/addnodes.py:299: Cannot find link target for "_sig_element=True"
+ /projects/sphinx/sphinx/builders/__init__.py:84: Cannot find link target for "~.Builder.write_doc" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:84: Cannot find link target for "~.Builder.write_doc" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:84: Cannot find link target for "~.Builder.write_doc" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:84: Cannot find link target for "~.Builder.write_doc" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:84: Cannot find link target for "~.Builder.write_doc" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:79: Cannot find link target for "~sphinx.application.Sphinx.set_translator" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/builders/__init__.py:70: Cannot find link target for ".SphinxPostTransform" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/domains/__init__.py:106: Cannot find link target for "self.data" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/ext/intersphinx/_shared.py:29: Cannot find link target for "~sphinx.builder.html.INVENTORY_FILENAME" (you can link to external docs with --intersphinx)
+ /projects/sphinx/sphinx/locale/__init__.py:223: Cannot find link target for "LC_ALL"
+ /projects/sphinx/sphinx/locale/__init__.py:223: Cannot find link target for "LC_MESSAGES"
- these 65 objects' docstrings contain syntax errors:
+ these 70 objects' docstrings contain syntax errors:
+ sphinx.ext.autodoc.py_ext_sig_re
+ sphinx.ext.intersphinx._shared.IntersphinxMapping
+ sphinx.locale._
+ sphinx.project.Project.source_suffix
+ sphinx.transforms.post_transforms.images.ImageConverter.available
numpy (https://github.com/numpy/numpy)
+ /projects/numpy/numpy/typing/mypy_plugin.py:118: Cannot find link target for "numpy._core.intp", resolved from "np.intp"
+ /projects/numpy/numpy/typing/mypy_plugin.py:115: Cannot find link target for "numpy._core.number", resolved from "np.number"
|
I’de prefer if the implementation was using ast-comments so the astbuilder code is not mixed with token processing code… |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #800