Skip to content

Commit cba6134

Browse files
committed
Add Python interface to __init__ and instruction to README.
1 parent 1f22c90 commit cba6134

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ $ pip install stubdoc
125125

126126
# Usage
127127

128+
Notes: specified module need to be able to import. Stubdoc will replace paths to package path (e.g., 'sample/path.py' to 'sample.path'), so that paths argument can not be specified upper level directory or root directory (e.g., '/sample/path.py' or '../sample/path').
129+
128130
```
129131
This command will add docstring to stub file. Currently supported one-line stub implementation, like mypy's stubgen
130132
command, something as follows: def any_func(a: int, b: str) -> None: ... If line break exists after colon, this
@@ -150,6 +152,16 @@ or
150152
$ stubdoc --module_path samples/sample.py --stub_path out/samples/sample.pyi
151153
```
152154

155+
Or maybe Python interface is useful, like Django environment:
156+
157+
```py
158+
from stubdoc import add_docstring_to_stubfile
159+
160+
add_docstring_to_stubfile(
161+
original_module_path='sample/path.py',
162+
stub_file_path='sample/path.pyi')
163+
```
164+
153165
# Limitations
154166

155167
This library supported only one-line stub implementation, like this:

development_doc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ poetry run pytest --cov=./ tests/ -v -s -k <module_or_func_name>
3232
Notes: this command maybe hang-up on Windows. In that case it is necessary to press Ctrl + C to stop.
3333

3434
```
35-
$ stubgen --include-private ./
35+
$ poetry run stubgen --include-private ./
3636
```
3737

3838
# Try to apply stubdoc to generated stub

stubdoc/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
__version__: str = '0.1.5'
2+
from stubdoc.stubdoc import add_docstring_to_stubfile

0 commit comments

Comments
 (0)