`interface_meta` is a Python library (current version 1.3.0) that provides a robust way to expose extensible APIs. It focuses on enforcing method signatures and ensuring consistent documentation for subclasses, making it suitable for plugin architectures. The library is currently in maintenance, with its last release in April 2022.
pip install interface-metaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining an interface using `InterfaceMeta` with abstract properties and methods, and then creating a conforming implementation. It highlights how to set interface-specific configurations for method signature enforcement and documentation.
Thoroughly review the `InterfaceMeta` configuration attributes (`INTERFACE_EXPLICIT_OVERRIDES`, `INTERFACE_RAISE_ON_VIOLATION`, `INTERFACE_SKIPPED_NAMES`) to match desired enforcement strictness. Test interface implementations rigorously to ensure they adhere to the defined contracts. Consider enabling `INTERFACE_RAISE_ON_VIOLATION=True` during development for stricter checking.
Rely on the examples in the GitHub repository and source code for detailed understanding. Be prepared to experiment and validate behavior through testing. Consult related projects or prior art mentioned in the README (e.g., `pure_interface`, `python-interface`) for conceptual guidance, though their implementations will differ.
Be aware that new features or critical bug fixes may not be actively developed. Plan for potential internal modifications or consider alternative, more actively maintained interface enforcement libraries if long-term active development and bleeding-edge Python compatibility are paramount for your project.
Ensure that any concrete class inheriting from an interface defines all methods declared as abstract in the interface. For example, if `MyInterface` defines `my_abstract_method`, your subclass `MyImplementation` must provide an implementation for it.
Adjust the method signature in the subclass (`MyImplementation.my_method`) to precisely match the signature defined in the parent interface (`MyInterface.my_method`), including parameters and their types if type hints are used. `interface-meta` allows additional *optional* arguments in subclasses, but required arguments must match.
Install the library using pip: `pip install interface-meta` or correct the import statement to `from interface_meta import InterfaceMeta` (or other components as needed).
Ensure that the subclass explicitly defines all properties and methods declared in the interface. If the property is meant to be abstract, ensure it's properly implemented in the subclass.
No dependency data recorded yet.