Skip to content

Commit

Permalink
feat: Add initial restructured text docstirng parsing
Browse files Browse the repository at this point in the history
This implementation should be mostly complete.

Not implemented:
 - references: Not planned at this time
 - examples: I'm not aware of a standard format for this

Still needed:
 - more test:
   - Many of the error cases aren't currently covered
   - More full fixture test cases

To be cleaned up:
 - I'm not confident I got the types right for all of the data that comes in with the context
 - ParseContext works, but it is a bit awkward with the rest of the project using the dict

References: mkdocstrings#67
  • Loading branch information
plannigan committed Oct 18, 2020
1 parent 50cd7e6 commit 666dcc5
Show file tree
Hide file tree
Showing 9 changed files with 1,549 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ include = [

[tool.poetry.dependencies]
python = "^3.6"
dataclasses = {version = "^0.7", python = "3.6"}
typing-extensions = {version = "^3.7.4.3", python = "3.6 || 3.7"}

coverage = {version = "^5.2.1", optional = true}
invoke = {version = "^1.4.1", optional = true}
Expand Down
2 changes: 1 addition & 1 deletion src/pytkdocs/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def __init__(
"and the option will be removed in v0.13. "
"Please update your paths to use a colon to delimit modules from other objects. "
"Read more at https://pawamoy.github.io/pytkdocs/#details-on-new_path_syntax",
PendingDeprecationWarning
PendingDeprecationWarning,
)

def get_object_documentation(self, dotted_path: str, members: Optional[Union[Set[str], bool]] = None) -> Object:
Expand Down
3 changes: 2 additions & 1 deletion src/pytkdocs/parsers/docstrings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

from pytkdocs.parsers.docstrings.base import Parser
from pytkdocs.parsers.docstrings.google import Google
from pytkdocs.parsers.docstrings.restructured_text import RestructuredText

PARSERS: Dict[str, Type[Parser]] = {"google": Google}
PARSERS: Dict[str, Type[Parser]] = {"google": Google, "restructured-text": RestructuredText}
Loading

0 comments on commit 666dcc5

Please sign in to comment.