Skip to main content

protoclass - Prototype-Oriented Programming in Python.

Prototype-Oriented Programming in Python at the tip of your fingers in a simple, easy-to-use library.

PyPI-package-version PyPI-license PyPI-python-versions travis-ci readthedocs PyPI-downloads-month

Installation

pip install protoclass

Usage

>>> from protoclass import proto

# We create a basic object and add some functionality
>>> jane = proto(first="Jane", last="Doe")
>>> jane.greet = lambda self: print(self)
>>> jane.greet()  #doctest: +ELLIPSIS
<proto object at ...>

# A more user-friendly would be better.
# We could modify the `greet` function
# or we could create another object and inherit from it
>>> person = proto(first="", last="")
>>> person.__str__ = lambda self: f"{self.first} {self.last}"
>>> jane = jane.chain(person)

# and we should get a better message.
>>> jane.greet()
Jane Doe

API Reference

proto(**attrs)

Makes a new prototype with given attributes. An empty prototype will be made when no attributes are given.

proto.chain(self, other, *others)

Makes self copy attributes from another prototype or multiple other prototypes. Any previous relationship with other parent prototypes will be automatically severed. When parent prototypes share attributes with the same name, the first parent prototype that has that attribute will be provide it, so the order in which they are given matters. Any change made to parent prototypes will be automatically propagated to this prototype.

clone(other, *others)

Makes a new prototype by copying attributes from another prototype or multiple other prototypes. When parent prototypes share attributes with the same name, the first parent prototype that has that attribute will be provide it, so the order in which they are given matters. Any change made to parent prototypes will be automatically propagated to this clone.

For more information on these functions, call help on the function you would like to know more of, like this: help(proto). You can also read the docs.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Metadata

Release files for protoclass 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for protoclass 0.5.5
File Size Uploaded Provenance Actions
protoclass-0.5.5.tar.gz 5.3 kB Without provenance Details for protoclass-0.5.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for protoclass 0.5.5
File Interpreter ABI Platform Actions
protoclass-0.5.5-py3-none-any.whl Python 3 none any Details for protoclass-0.5.5-py3-none-any.whl

Total release size: 15.2 kB

Release files / protoclass-0.5.5.tar.gz

Download URL protoclass-0.5.5.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
87a5b844401b799f4b4ad75cd8540c4a6043d593207942780013b3ffc7158e82
BLAKE2b-256 checksum
How to use checksums
d7e7331f4485d188775b0429208ea2ac3b25eec39bd4d875f2b6c27648e9ce31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / protoclass-0.5.5-py3-none-any.whl

Download URL protoclass-0.5.5-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af10c62c8d0fb6f10570b58ae5b7719f06bdb2ba51ff82e2701cab8c5c4676aa
BLAKE2b-256 checksum
How to use checksums
b89c5cb685a9bdbf7a510bf8c0b648bd02488eabc33a5120556a6fd17f9fd2ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Security for protoclass 0.5.5

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.

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