Skip to content

Commit

Permalink
spaces and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral committed Dec 2, 2024
1 parent 61b3967 commit 950534f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
### Changed

- Initialize the getter and dir functions lazily when adding lazy imports.
- Guess attributes from `__all__` when `__getattr__` definition without `__dir__` function is found.

### Fixed

- Missing `__dir__` injection so `dir()` didn't show the lazy imports.
- Missing `__dir__` injection so lazy imports didn't show up in `dir()`.
- Error when adding lazy imports later without pre-existing lazy imports.

## Version 0.1.0
Expand Down
8 changes: 2 additions & 6 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ There are also `deprecated_lazy_imports` which have as value a dictionary with t

Monkay also injects a `__dir__` module function for listing via dir. It contains all lazy imports as well as `__all__` variable contents.
The `__dir__` function is also injected without lazy imports when an existing `__getattr__` without a `__dir__` function was detected and
an `__all__` variable is available to fix it.
an `__all__` variable is available.
It is tried to guess the attributes provided by using the `__all__` variable.

In short the sources for the Monkay `__dir__` are:

Expand Down Expand Up @@ -118,7 +119,6 @@ from pydantic_settings import BaseSettings
class Settings(BaseSettings):
preloads: list[str] = []
extensions: list[Any] = []

```

And voila settings are now available from monkay.settings as well as settings. This works only when all settings arguments are
Expand Down Expand Up @@ -189,8 +189,6 @@ monkay = Monkay(
get_value_from_settings(monkay.settings, "foo")
```



#### Pathes

Like shown in the examples pathes end with a `:` for an attribute. But sometimes a dot is nicer.
Expand Down Expand Up @@ -260,10 +258,8 @@ class ExtensionProtocol(Protocol[INSTANCE, SETTINGS]):
name: str

def apply(self, monkay_instance: Monkay[INSTANCE, SETTINGS]) -> None: ...

```


A name (can be dynamic) and the apply method are required. The instance itself is easily retrieved from
the monkay instance.

Expand Down

0 comments on commit 950534f

Please sign in to comment.