Miniflask

Latest version: v5.1.2

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 3

2.0.0

This release marks a major version jump of the miniflask framework.
(Check out 75 in case you want a list of all PRs and Issues that went into this release.)

**Your miniflask v1 code will not work out of the box with this release.**
- **Read the migration notes below.**
- Please, pay close attention to all changes that have been made.

Major Changes
- **Documentation**: (see [PR 69](https://github.com/da-h/miniflask/pull/69))
- **API-Reference added**.
- some chapters are now rewritten
- **Module Inheritance**: (see [PR 48](https://github.com/da-h/miniflask/pull/48))
- enabled submodules (modules with modules beneath it)
- changed the way relative modules are referenced
- relative module ids can now be for all functions that require module ids (e.g. `register_default_module` to register a submodule as default specialization)
- this makes the module identifier keyword `default` obsolete, thus this feature has been removed
- `mf.any_child_loaded` checks dynamically if a submodule has been loaded already (see [PR 60](https://github.com/da-h/miniflask/pull/60))
- **Parent autoload**: (see [PR 56](https://github.com/da-h/miniflask/pull/56))
- All parent modules load automatically before loading the actual requested module.
(This allows grouped modules to share functionality in parent modules.)
*Note*: Disabling autoloading can be done using a global variable named `register_parent = False`.
- **Fuzzy Variable Matching**: (see [PR 51](https://github.com/da-h/miniflask/pull/51))
- The search order of fuzzy variable matching (`state["var"]` calls or CLI-arguments) has changed. Starting with the most special versions of the call, the search traverses to the global variables.
- Matches are cached to reduce query-time. `del state["var"]` statements now clear the cache.
- **Events**:
- Any event can now be called with an `mf` argument. This enables dynamic event registration during other events, i.e. using `mf.register_mf(..)`. (see [PR 58](https://github.com/da-h/miniflask/pull/58))
- `mf.overwrite_event` and `mf.unregister_event` are two additional dynamic event registration methods that can be used at any time
- before/after-events API changed and does not require the events to match a specific function signatures anymore (see [74](https://github.com/da-h/miniflask/pull/74))
- changed default call from `register_event(...,unique=False)` to `register_event(...,unique=True)` (see [65](https://github.com/da-h/miniflask/issues/65))
- now any function gets wrapped in case before/after-event or altfn-option is requested by the user (see [62](https://github.com/da-h/miniflask/issues/62))

Minor Changes
- `miniflask.init` now allows `PosixPath` arguments
- `event` and `state` objects are tightly bound to the specific miniflask object, thus deepcopying those is disabled from now.
- This Repo now comes with Unit-Tests to ensure consistency and to prevent accidental API-Changes
- Like- & lambda expressions now check for circular dependencies

Bugfixes
- **Argparse**:
- the negative scientific notation can now be used as numeric values
- single dash-arguments have been removed for more consistent CLI-parsing (see [PR 47](https://github.com/da-h/miniflask/pull/47))
- **Import**:
- Rewrite of module imports to enable testing.
- (Python import interfered with multiple miniflask instances.)
- Previously, the import was based on modifying `sys.path`. Now, import is based on Python's `importlib` module.
- cases where the `__init__.py` file of a module was inaccessible have lead to bugs
- **Exceptions**:
- Did not showed `raise` line of exception in some cases
- Hiding internal calls from the exception message has lead to some bugs that have been resolved in this PR
- event-calls with `outervar` and optional arguments could interfere in some cases
- The predefined module `[modules]` now lists submodules as well.
- `get_default_args` should not return `None`-arguments (as they cannot be registered for CLI)
- fixed Boolean list default values

1.35

**Code built with Miniflask v1 probably will not work out of the box with Miniflask v2.**
- **Module Inheritance**: (see [PR 48](https://github.com/da-h/miniflask/pull/48))
- With that change, the module identifier keyword `default` is not needed anymore, and thus, has been removed.
- In most cases, it is sufficient to move the contents of `modulename/default/*` to `modulename/*` (especially & including the `__init__.py` file.
- Relative module identifiers where defined without submodules in mind, thus modules where interpreted as files. Specifying a sibling module (say `siblingmodule`) the relative identifier was `.siblingmodule`. Getting the sibling one directory up could be specified using an additional dot, i.e. `..siblingmodule`. To adapt this notation to submodules, i.e. specifying modules below the current directory, the notation got an offset for relative module paths. The new notation is `..siblingmodule` for a sibling, `...siblingmodule` for a sibling of the parent directory, `.childmodule` for a submodule.
- All this makes most uses of `set_scope` or `redefine_scope` obsolete. Please consider restructuring the modules that usese one of those features.
- Relative module ids work now with all functions that require module ids. Relative module ids can help to maintain portability of modules into other module repositories. Thus, consider rewriting your repository to use that feature.
- **Parent autoload**:
- Previous versions did not allow submodules, thus this new feature should not interefere with old code bases.
- If however, your code did call some kind of parent module loading (i.e. using `default`-keyworded modules), these calls may need to be rewritten.
- Consider the function `mf.any_child_loaded` to specify “default“-parameter queries/module loading-calls in case of grouped modules.
- **Fuzzy Variable Matching**:
Previous fuzzy variable matching (in CLI or in `state["varname"]` calls) started with the most special version of the match, then proceeded to global matches in case no match was found and then descentedt into all other modules.
This search order has changed significantly. For instance, global matches are now last in the search order. Please consider the [PR 51](https://github.com/da-h/miniflask/pull/51) for more details.
- **Events**:
- `mf.register_event` registers any event as `unique` by default now. Previously it has registered a non-unique event by default.
- Hacky code-snippets to define new events inside event-callcs are not required anymore and should be replaced with `mf.register_event`-calls (or similar).
- the `before`/`after`-event API has changed significantly. Please check the documentation on how to modify arguments of event-calls and their results.

Page 3 of 3

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.