You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was generated by AI during a pre-4.0 audit of main at 9cd88e7.
Observation
The docs call the provider set closed, yet internal methods are public: AbstractProvider.mark_registered/get_dependencies/redirect_target/iter_validation_issues (providers/abstract.py:43-93), Factory.wiring_plan/can_call_positionally/resolution_step, Alias.find_source, CacheSettings.coerce. No integration calls them; once public in 4.0 they cannot change in a minor.
Factory(cache=) accepts three spellings of "off": None, False, absent.
AbstractProvider is an abc.ABC with no abstract methods (abstract.py:16). Besides misleading, it makes every isinstance a Python-level __instancecheck__ (98 ns vs 23 ns), hit per injected parameter in Container.resolve_dependency (container.py:156): Marker.resolve 260 -> 183 ns measured on 3.14.
modern_di/__init__.py lists "providers" in __all__ without importing it; it works only because container.py imports modern_di.providers.abstract.
Proposal
Underscore-prefix the internal methods (keep the public provider API: constructors, bound_type, scope, cast helpers, whatever the docs show).
Narrow cache= to bool | CacheSettings.
Drop abc.ABC from AbstractProvider.
from modern_di import exceptions, integrations, providers.
Acceptance
Tests updated; Factory(cache=None) raises a clear error (or TypeError); migration guide entries; integrations still pass (modern-di-pytest imports AbstractProvider only as a type).
Activity
feat!: tighten the provider surface (#566)