Skip to content

Commit

Permalink
Docs for .pyi (#165)
Browse files Browse the repository at this point in the history
* mkdocstrings for .pyi file

* try updating mkdocstrings-python

* complete _rust_notify docs

* uprev test requirements.txt
  • Loading branch information
samuelcolvin authored Jun 24, 2022
1 parent 93f744d commit a06c0b0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
10 changes: 6 additions & 4 deletions docs/api/rust_backend.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
The `_rust_notify.pyi` file defines the interface to rust:
::: watchfiles._rust_notify.RustNotify

```{.py title="_rust_notify.pyi" test="skip"}
{! watchfiles/_rust_notify.pyi !}
```
::: watchfiles._rust_notify.WatchfilesRustInternalError

::: watchfiles._rust_notify.__version__

# Rust backend direct usage

The rust backend can be accessed directly as follows:

Expand Down
12 changes: 9 additions & 3 deletions docs/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ def test_examples():
logger.info('pytest not installed, skipping examples tests')
else:
logger.info('running examples tests...')
return_code = pytest.main(['-q', '-p', 'no:sugar', 'tests/test_docs.py'])
if return_code != 0:
logger.warning('examples tests failed')
try:
pytest.main(['--version'])
except AttributeError:
# happens if pytest is not properly installed
logger.info('pytest not installed correctly, skipping examples tests')
else:
return_code = pytest.main(['-q', '-p', 'no:sugar', 'tests/test_docs.py'])
if return_code != 0:
logger.warning('examples tests failed')


def on_files(files: Files, config: Config) -> Files:
Expand Down
8 changes: 5 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
black==22.3.0
mkdocs==1.2.3
mkdocs-material==8.2.7
griffe==0.20.0
mkdocs==1.3.0
mkdocs-material==8.3.7
mkdocs-simple-hooks==0.1.5
mkdocstrings[python]==0.18.1
mkdocstrings[python]==0.19.0
mkdocstrings-python==0.7.1
mdx-include==1.4.1
6 changes: 3 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coverage==6.3.2
dirty-equals==0.2
pytest==7.1.1
coverage==6.4.1
dirty-equals==0.4
pytest==7.1.2
pytest-mock==3.7.0
pytest-sugar==0.9.4
pytest-timeout==2.1.0
1 change: 1 addition & 0 deletions watchfiles/_rust_notify.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from typing import List, Literal, Optional, Protocol, Set, Tuple, Union
__all__ = 'RustNotify', 'WatchfilesRustInternalError'

__version__: str
"""Gets the package version as defined in `Cargo.toml`, modified to match python's versioning semantics."""

class AbstractEvent(Protocol):
def is_set(self) -> bool: ...
Expand Down

0 comments on commit a06c0b0

Please sign in to comment.