🦆 Quacks
If it walks like a duck and it quacks like a duck, then it must be a duck
Thanks to PEP544, Python now has protocols: a way to define duck typing statically. This library gives you some niceties to make common idioms easier.
Installation
pip install quacks
⚠️ For type checking to work with mypy, you’ll need to enable the plugin in your mypy config file:
[mypy]
plugins = quacks
Features
Easy read-only protocols
Defining read-only protocols is great for encouraging immutability and working with frozen dataclasses. Use the readonly decorator:
from quacks import readonly
@readonly
class User(Protocol):
id: int
name: str
is_premium: bool
Without this decorator, we’d have to write quite a lot of cruft, reducing readability:
class User(Protocol):
@property
def id(self) -> int: ...
@property
def name(self) -> str: ...
@property
def is_premium(self) -> bool: ...
Metadata
Release files for quacks 1.1.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 | Actions |
|---|---|---|---|---|
| quacks-1.1.1.tar.gz | 4.9 kB | Without provenance | Details for quacks-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quacks-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for quacks-1.1.1-py3-none-any.whl |
Total release size: 11.3 kB
Release files / quacks-1.1.1.tar.gz
| Download URL | quacks-1.1.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d53d26645cb5e1f68f963b15c0b388ce1a49a44ec818d26e39e84ed195b1987
|
|
BLAKE2b-256 checksum How to use checksums |
52ddfb139a911620070870de7f513f548d72241f37f1b0aff7b099fbb3c3af3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Release files / quacks-1.1.1-py3-none-any.whl
| Download URL | quacks-1.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef7bfb5d790de7b5807bfd8df2f5f56d1eeb985d6e75c3072dc50b8b93b2971a
|
|
BLAKE2b-256 checksum How to use checksums |
06f422956c43a4b469f8b38430f962824eb18c6ea07ece8c6e44fd68a7968e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Security for quacks 1.1.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.