Skip to content

Commit 28c2008

Browse files
committed
added Readme.md
1 parent 3d35842 commit 28c2008

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,72 @@
11
The project is a fork from the original project - https://github.com/rr-/docstring_parser/
2+
3+
Based on the provided document, here is a README outline for the Python package it describes:
4+
5+
---
6+
7+
# PyDocSmith
8+
9+
PyDocSmith is a versatile Python package designed for parsing, detecting, and composing docstrings in various styles. It supports multiple docstring conventions, including reStructuredText (reST), Google, NumPydoc, and Epydoc, providing flexibility in documentation practices for Python developers.
10+
11+
## Features
12+
13+
- **Docstring Style Detection:** Automatically detect the style of docstrings (e.g., reST, Google, NumPydoc, Epydoc) using simple heuristics.
14+
- **Docstring Parsing:** Convert docstrings into structured representations, making it easier to analyze and manipulate documentation.
15+
- **Docstring Composition:** Render structured docstrings back into text, allowing for automated docstring generation and modification.
16+
- **Attribute Docstrings:** Parse attribute docstrings defined at class and module levels, enhancing the documentation of class properties and module-level variables.
17+
18+
## Installation
19+
20+
```bash
21+
pip install PyDocSmith
22+
```
23+
24+
## Usage
25+
26+
### Detecting Docstring Style
27+
28+
Detect the docstring style of a given text:
29+
30+
```python
31+
from PyDocSmith import detect_docstring_style, DocstringStyle
32+
33+
docstring = """
34+
This is an example docstring.
35+
:param param1: Description of param1
36+
:return: Description of return value
37+
"""
38+
style = detect_docstring_style(docstring)
39+
print(style) # Outputs: DocstringStyle.EPYDOC
40+
```
41+
42+
### Parsing Docstrings
43+
44+
Parse a docstring into its components:
45+
46+
```python
47+
from PyDocSmith import parse, DocstringStyle
48+
49+
parsed_docstring = parse(docstring, style=DocstringStyle.AUTO)
50+
print(parsed_docstring)
51+
```
52+
53+
### Composing Docstrings
54+
55+
Render a parsed docstring back into text:
56+
57+
```python
58+
from PyDocSmith import compose
59+
60+
docstring_text = compose(parsed_docstring, style=DocstringStyle.REST)
61+
print(docstring_text)
62+
```
63+
64+
## Advanced Features
65+
66+
- **Parse From Object:** PyDocSmith can parse docstrings directly from Python objects, including classes and modules, incorporating attribute docstrings into the structured representation.
67+
- **Custom Rendering Styles:** Customize the rendering of docstrings with compact or detailed styles, and specify custom indentation for the generated docstring text.
68+
69+
## Contributing
70+
71+
Contributions are welcome! Please submit pull requests or report issues on the project's GitHub page.
72+

0 commit comments

Comments
 (0)