Skip to content

Commit

Permalink
Add Python interface to __init__ and instruction to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
CurrentTV committed Dec 21, 2020
1 parent 1f22c90 commit cba6134
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ $ pip install stubdoc

# Usage

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').

```
This command will add docstring to stub file. Currently supported one-line stub implementation, like mypy's stubgen
command, something as follows: def any_func(a: int, b: str) -> None: ... If line break exists after colon, this
Expand All @@ -150,6 +152,16 @@ or
$ stubdoc --module_path samples/sample.py --stub_path out/samples/sample.pyi
```

Or maybe Python interface is useful, like Django environment:

```py
from stubdoc import add_docstring_to_stubfile

add_docstring_to_stubfile(
original_module_path='sample/path.py',
stub_file_path='sample/path.pyi')
```

# Limitations

This library supported only one-line stub implementation, like this:
Expand Down
2 changes: 1 addition & 1 deletion development_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ poetry run pytest --cov=./ tests/ -v -s -k <module_or_func_name>
Notes: this command maybe hang-up on Windows. In that case it is necessary to press Ctrl + C to stop.

```
$ stubgen --include-private ./
$ poetry run stubgen --include-private ./
```

# Try to apply stubdoc to generated stub
Expand Down
1 change: 1 addition & 0 deletions stubdoc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__: str = '0.1.5'
from stubdoc.stubdoc import add_docstring_to_stubfile

0 comments on commit cba6134

Please sign in to comment.