Skip to content

Commit

Permalink
Add auto-generated stub file for PEP 561 type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Nov 7, 2023
1 parent ddde2f4 commit fb59f3a
Show file tree
Hide file tree
Showing 4 changed files with 1,640 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ To deploy docs to GitHub:
```
mkdocs gh-deploy
```

### Generating stubs

To generate [stubs](https://peps.python.org/pep-0561/) for IDE type hinting and inline documentation, the [pybind11-stubgen](https://github.com/sizmailov/pybind11-stubgen) package is required. Once installed, run:

```
pybind11-stubgen -o auxiliary/libs/signalflow-stubs signalflow
```

The `signalflow-stubs` package is bundled with the standard SignalFlow wheel, and as per [PEP 561's convention for stub-only packages](https://peps.python.org/pep-0561/#stub-only-packages), should be used by IDEs to display type hints and docs. This has been verified in Visual Studio Code 1.84.1.
8 changes: 8 additions & 0 deletions auxiliary/libs/signalflow-stubs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Stubs for type hinting and inline documentation.
See PEP 561: https://peps.python.org/pep-0561/
The stub file imported below is autogenerated by pybind11-stubgen.
"""

from .signalflow import *
Loading

0 comments on commit fb59f3a

Please sign in to comment.