Easier & more robust duck typing
pyduck is a Python utility framework for more effective usage of language’s defining traits: duck typing. It enhances the language with several useful features that increase the readability and reliability of Python code.
from pyduck import Interface, expects, Any, overload
class Iterable(Interface):
def __iter__(self): pass
@expects(Iterable)
def __iterable_as_json(value):
json_list = map(as_json, value)
return "[%s]" % str.join(",", json_list)
@expects(basestring)
def __string_as_json(value):
return '"%s"' % str(value)
@expects(Any)
def __other_as_json(value):
return str(value)
as_json = overload(__iterable_as_json, __string_as_json, __other_as_json)
Features
interfaces which do not need to be explicitly declared (similar to Go language)
automatic interface/type checking for function arguments
function overloading based on interfaces/types of arguments
automatic interface/type checking for function return values
For more info & the docs, see the project’s webpage.
Metadata
Release files for pyduck 0.5.2
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 |
|---|---|---|---|---|
| pyduck-0.5.2.tar.gz | 8.5 kB | Without provenance | Details for pyduck-0.5.2.tar.gz |
Release files / pyduck-0.5.2.tar.gz
| Download URL | pyduck-0.5.2.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7eb691a64722fa1ecda11289c387ec1807ac1bd61a7411b11d3784d4e9883cea
|
|
BLAKE2b-256 checksum How to use checksums |
662b10a33b8ab4611c349249946bd8b74b8aafb3f6889299b91f37ba4cf65a2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyduck 0.5.2
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.