Interface definitions for Python.
Project description
Note: This package is in the dangerous land of
0.x.y
versions and may be subject to breaking changes with minor version increments.
Important: Development of
nr.interface
is discontinued. We recommend to use theabc
module instead.
nr.interface
Interface definitions for Python. Inspired by zope.interface
.
Quickstart
from nr.interface import Interface, implements, override
class Pet(Interface):
def make_sound(self) -> str:
pass
@implements(Pet)
class Dog:
@override
def make_sound(self) -> str:
return 'Bark!'
assert 'make_sound' in Pet.members
assert Pet.implemented_by(Dog)
assert list(Pet.implementations()) == [Dog]
Copyright © 2020 Niklas Rosenstein
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nr.interface-0.0.5.tar.gz
(11.5 kB
view details)
Built Distribution
File details
Details for the file nr.interface-0.0.5.tar.gz
.
File metadata
- Download URL: nr.interface-0.0.5.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed6043954813247555299ce3032033bbbcaa2d7906f849e1f8317df4011ade83 |
|
MD5 | 470cad57b8ed63b5789278f7192a9256 |
|
BLAKE2b-256 | 149fa004ed3f261a8041de0557ad9b507f9c7cc9e24ee807b53688840c9d7c57 |
File details
Details for the file nr.interface-0.0.5-py2.py3-none-any.whl
.
File metadata
- Download URL: nr.interface-0.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8287f817297d825641793bf3e860445c43e271f4f87ff34f3e30b94bf1aa79a8 |
|
MD5 | 9ba1f6d52a55e59fd36bd31ec2bfa831 |
|
BLAKE2b-256 | 9a24611a16157232b5d205f9f6bffdaf2db8eee71ea156a1f381ff7e76c6ad79 |