Skip to content

Commit 52e70b1

Browse files
committed
feat: Implement no-op extension
1 parent 61b3a37 commit 52e70b1

File tree

7 files changed

+39
-2
lines changed

7 files changed

+39
-2
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,24 @@ Mark wildcard imported objects as public.
1111
This project is available to sponsors only, through my Insiders program.
1212
See Insiders [explanation](https://mkdocstrings.github.io/griffe-public-wildcard-imports/insiders/)
1313
and [installation instructions](https://mkdocstrings.github.io/griffe-public-wildcard-imports/insiders/installation/).
14+
15+
## Usage
16+
17+
[Enable](https://mkdocstrings.github.io/griffe/guide/users/extending/#using-extensions) the `griffe_public_wildcard_imports` extension. Now all objects imported through wildcard imports will be considered public, as per the convention.
18+
19+
```python
20+
# All imported objects are marked as public.
21+
from somewhere import *
22+
```
23+
24+
With MkDocs:
25+
26+
```yaml
27+
plugins:
28+
- mkdocstrings:
29+
handlers:
30+
python:
31+
options:
32+
extensions:
33+
- griffe_public_wildcard_imports
34+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ plugins:
132132
show_root_heading: true
133133
show_root_full_path: false
134134
show_signature_annotations: true
135+
show_source: false
135136
show_symbol_type_heading: true
136137
show_symbol_type_toc: true
137138
signature_crossrefs: true

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ classifiers = [
2828
"Topic :: Utilities",
2929
"Typing :: Typed",
3030
]
31-
dependencies = []
31+
dependencies = [
32+
"griffe>=0.49",
33+
]
3234

3335
[project.urls]
3436
Homepage = "https://mkdocstrings.github.io/griffe-public-wildcard-imports"

src/griffe_public_wildcard_imports/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55

66
from __future__ import annotations
77

8-
__all__: list[str] = []
8+
from griffe_public_wildcard_imports._internals.extension import PublicWildcardImportsExtension
9+
10+
__all__: list[str] = ["PublicWildcardImportsExtension"]

src/griffe_public_wildcard_imports/_internals/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import griffe
2+
3+
4+
class PublicWildcardImportsExtension(griffe.Extension):
5+
"""Mark wildcard imported objects as public."""

tests/test_extension.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Test extension."""
2+
3+
4+
def test_extension() -> None:
5+
"""Dummy test."""
6+
assert True

0 commit comments

Comments
 (0)