Skip to content

Commit

Permalink
ci: add infrastructure for generating custom stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Feb 17, 2021
1 parent 1cd8a0a commit 2c94f15
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ disable=

[MASTER]
ignore=
conf.py
conf.py,
sympy
ignore-patterns=
.*\.pyi

[TYPECHECK]
ignored-modules=
Expand Down
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
"rewrap.wrappingColumn": 79,
"search.exclude": {
"**/tests/**/__init__.py": true,
"docs/tox.ini": true,
"reqs/3.*/*.txt": true,
"tests/tox.ini": true
"*/tox.ini": true,
"reqs/3.*/*.txt": true
},
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
Expand Down
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"requirements*.txt",
"setup.cfg",
"setup.py",
"tox.ini"
"tox.ini",
"typings"
],
"language": "en-US",
"words": [
Expand Down
3 changes: 1 addition & 2 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reportUnusedClass": true,
"reportUnusedFunction": true,
"reportUnusedImport": true,
"reportUnusedVariable": true,
"stubPath": ""
"reportUnusedVariable": true
}
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ files =
check_untyped_defs = True
disallow_incomplete_defs = False
disallow_untyped_defs = False
[mypy-typings.*]
ignore_errors = True

; https://github.com/ComPWA/tensorwaves/issues/125
[mypy-matplotlib.*]
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ filename =
exclude =
__pycache__
docs/conf.py
typings/**
ignore = # more info: https://www.flake8rules.com/
E203 # https://github.com/psf/black#slices
E231 # allowed by black
Expand Down
2 changes: 2 additions & 0 deletions typings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyi
/*/
17 changes: 17 additions & 0 deletions typings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Stubs for external libraries

To speed up linting and code navigation, it's often useful to generate
[stub files](https://mypy.readthedocs.io/en/stable/stubs.html) (`.pyi` files)
for the external libraries. You can do this using
[`stubgen`](https://mypy.readthedocs.io/en/stable/stubgen.html). For instance:

```shell
stubgen -p tensorflow -o typings
```

Alternatively, use [Pyright](https://github.com/microsoft/pyright) to generate
stub files that contain docstrings as well:

```shell
pyright --createstub tensorflow
```
Empty file added typings/__init__.pyi
Empty file.
4 changes: 4 additions & 0 deletions typings/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; ignore all pydocstyle errors in this folder

[pydocstyle]
add_ignore = D

0 comments on commit 2c94f15

Please sign in to comment.