Skip to content

Commit

Permalink
feat: Implement no-op extension
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Aug 18, 2024
1 parent bca3399 commit a36f889
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 3 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,28 @@ Mark objects imported with redundant aliases as public.
This project is available to sponsors only, through my Insiders program.
See Insiders [explanation](https://mkdocstrings.github.io/griffe-public-redundant-aliases/insiders/)
and [installation instructions](https://mkdocstrings.github.io/griffe-public-redundant-aliases/insiders/installation/).

## Usage

[Enable](https://mkdocstrings.github.io/griffe/guide/users/extending/#using-extensions) the `griffe_public_redundant_aliases` extension. Now all objects imported with redundant aliases will be marked as public, as per the convention.

```python
# Following objects will be marked as public.
from somewhere import Thing as Thing
from somewhere import Other as Other

# Following object won't be marked as public.
from somewhere import Stuff
```

With MkDocs:

```yaml
plugins:
- mkdocstrings:
handlers:
python:
options:
extensions:
- griffe_public_redundant_aliases
```
5 changes: 4 additions & 1 deletion docs/insiders/goals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ goals:
features: []
1500:
name: HyperLamp Navigation Tips
features: []
features:
- name: "[Project] Mark objects imported with redundant aliases as public"
ref: /
since: 2024/08/18
2000:
name: FusionDrive Ejection Configuration
features: []
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ classifiers = [
"Topic :: Utilities",
"Typing :: Typed",
]
dependencies = []
dependencies = [
"griffe>=1.1",
]

[project.urls]
Homepage = "https://mkdocstrings.github.io/griffe-public-redundant-aliases"
Expand Down
4 changes: 3 additions & 1 deletion src/griffe_public_redundant_aliases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

from __future__ import annotations

__all__: list[str] = []
from griffe_public_redundant_aliases._internals.extension import PublicRedundantAliasesExtension

__all__: list[str] = ["PublicRedundantAliasesExtension"]
Empty file.
5 changes: 5 additions & 0 deletions src/griffe_public_redundant_aliases/_internals/extension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import griffe


class PublicRedundantAliasesExtension(griffe.Extension):
"""Mark objects imported with redundant aliases as public."""
6 changes: 6 additions & 0 deletions tests/test_extension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Test the extension."""


def test_extension() -> None:
"""Dummy test."""
assert True

0 comments on commit a36f889

Please sign in to comment.