Skip to main content

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)

Source distribution for good-interface 1.0.1
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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page