good_interface
Provides the Interface class and other utilities which can define method "interfaces" which automatically check method implementation in classes and objects.
Interfaces
An Interface is a collection of methods that are to be implemented in classes that implement this Interface. The Interface class can define Interfaces from a class skeleton.
from good_interface import Interface
@Interface
class MyInterface:
def method1(self, arg1, arg2):
pass
def method2(self, arg2):
pass
Since the interface is callable, you can call the new Interface object as a decorator on a class, which provides a check on the given class, ensuring that it implements the defined methods in the given interface.
from good_interface import Interface
@Interface
class MyInterface:
def method1(self, arg1, arg2):
pass
def method2(self, arg2):
pass
@MyInterface
class MyClass:
def method1(self, arg1, arg2):
pass
def method2(self, arg2):
pass
Calling the interface on another interface will extends the interface, adding the methods of this current interface to the new interface
from good_interface import Interface
@Interface
class MyInterface1:
def method1(self):
pass
@MyInterface1
@Interface
class MyInterface2:
def method2(self, arg1, arg2):
pass
def method3(self, arg2):
pass
# Creates:
#
# @Interface
# class MyInterface2:
# def method1(self):
# pass
#
# def method2(self, arg1, arg2):
# pass
#
# def method3(self, arg2):
# pass
Metadata
Release files for good-interface 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| good-interface-1.0.1.tar.gz | 2.5 kB | Without provenance | Details |
Release files / good-interface-1.0.1.tar.gz
| Download URL | good-interface-1.0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6720a6c1cc75c6a5566204c9c2b2ef857985009aebb2cb45a832cf8186c16474
|
|
BLAKE2b-256 checksum How to use checksums |
202bfb30b110cc7596870376ebe16a2efea4e226394d5422c03271638435e998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for good-interface 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.