Skip to content

Fix: explicitly re-export public API via __all__ - #42

Open
RafaelWO wants to merge 1 commit into
toumorokoshi:masterfrom
RafaelWO:fix/explicit-reexports
Open

Fix: explicitly re-export public API via __all__#42
RafaelWO wants to merge 1 commit into
toumorokoshi:masterfrom
RafaelWO:fix/explicit-reexports

Conversation

@RafaelWO

Copy link
Copy Markdown

Consumers running mypy --strict on from deepmerge import Merger got:

error: Module "deepmerge" does not explicitly export attribute "Merger"
[attr-defined]

Under --no-implicit-reexport (implied by --strict), names imported into __init__.py are not considered part of the public API unless listed in __all__. Add __all__ covering Merger, STRATEGY_END, the standard merger instances and DEFAULT_TYPE_SPECIFIC_MERGE_STRATEGIES.

The # noqa on the STRATEGY_END import is now redundant, since __all__ marks it as intentionally re-exported.

Mirrors the same fix applied to deepmerge.strategy in db7c653.


P.S. I was not fully sure if DEFAULT_TYPE_SPECIFIC_MERGE_STRATEGIES should be exposed as well. I can remove it from __all__ if it should not be part of the public API, of course 🙂

Consumers running `mypy --strict` on `from deepmerge import Merger` got:

    error: Module "deepmerge" does not explicitly export attribute "Merger"
    [attr-defined]

Under `--no-implicit-reexport` (implied by `--strict`), names imported into
`__init__.py` are not considered part of the public API unless listed in
`__all__`. Add `__all__` covering `Merger`, `STRATEGY_END`, the standard
merger instances and `DEFAULT_TYPE_SPECIFIC_MERGE_STRATEGIES`.

The `# noqa` on the `STRATEGY_END` import is now redundant, since `__all__`
marks it as intentionally re-exported.

Mirrors the same fix applied to `deepmerge.strategy` in db7c653.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant