Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral committed Jan 30, 2025
1 parent 62dd83e commit 889e4a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/specials.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ with monkay.with_settings(Settings()) as new_settings:

## `evaluate_preloads`

`evaluate_preloads` is a way to load preloads everywhere in the application.
`evaluate_preloads` is a way to load preloads everywhere in the application. It returns True if all preloads succeeded.
This is useful together with `ignore_import_errors=True`.

### Parameters

Expand All @@ -139,7 +140,7 @@ with monkay.with_settings(Settings()) as new_settings:
strings must be available. When `False` all must be available.
- `package` (Optional). Provide a different package as parent package. By default (when empty) the package of the Monkay instance is used.

Note: `monkay.base` contains a slightly different `evaluate_preloads` which uses when no package is provided the None package. It doesn't require
Note: `monkay.base` contains a slightly different `evaluate_preloads` which uses when no package is provided the `None` package. It doesn't require
an Monkay instance either.

## Typings
Expand All @@ -153,7 +154,6 @@ This is protocol is runtime checkable and has also support for both paramers.

Here a combined example:


```python
from dataclasses import dataclass

Expand Down
18 changes: 7 additions & 11 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ monkay = Monkay(
from foo import monkay
def get_application():
# sys.path updates
monkay.evaluate_settings(prelo)


important_preloads =[...]
monkay.evaluate_preloads(important_preloads, ignore_import_errors=False)
extra_preloads =[...]
monkay.evaluate_preloads(extra_preloads)
monkay.evaluate_settings()
```

When providing your own `__all__` variable **after** providing Monkay or you want more controll, you can provide
When providing your own `__all__` variable **after** providing Monkay or you want more control, you can provide

`skip_all_update=True`

Expand Down Expand Up @@ -232,7 +234,7 @@ from functools import lru_cache
@lru_cache
def get_edgy():
import edgy
edgy.monkay.evaluate_settings()
edgy.monkay.evaluate_settings(ignore_import_errors=False)
return edgy

class SettingsForward:
Expand All @@ -255,10 +257,6 @@ def get_application():
app = get_application()
```

For performance reasons you may want to skip to try to import the settings in init:

`evaluate_settings=False` will disable the evaluation.

You may want to not silence the import error like in monkay `<0.2.0`, then pass

`ignore_settings_import_errors=False` to the init.
Expand Down Expand Up @@ -308,7 +306,6 @@ parameter.

For entrypoints you can set now the instance via `set_instance`. A good entrypoint is the init and using the settings:


``` python title="__init__.py"
import os
from monkay import Monkay, load
Expand All @@ -324,7 +321,6 @@ monkay = Monkay(

monkay.evaluate_settings()
monkay.set_instance(load(settings.APP_PATH))

```

#### Using the extensions feature
Expand Down

0 comments on commit 889e4a8

Please sign in to comment.