This project has been archived by its maintainers, and is no longer receiving any updates.
Motivation
This library implements a simple clas decorator that you can apply to a base class. This decorator then hooks into the way the decorated class is subclassed, adding all new subclasses to a dictionary whose keys are class names and values are the classes themselves.
The motivation for this project was to autogenerate deep learning models from pure JSON files, thus ensuring reproducibility of the results. I do, however, think that it is ideal for any kind of codebase where we want to generate safe code from configuration files.
Installation instructions
The subclass register can be installed with pip:
pip install subclass-register
by cloning this repo and running setup.py
git clone https:\\github.com\yngvem\subclass-register
cd subclass-register
python setup.py
or by simply downloading the src\subclass_register\subclass_register.py file and the LISENCE file into your project.
Example
Here is a basic example of how to use the subclass register.
from subclass_register import SubclassRegister
register = SubclassRegister('car')
@register.link_base
class BaseCar:
pass
class SUV(BaseCar):
def __init__(self, horse_powers):
self.horse_powers = horse_powers
suv = register['SUV'](horse_powers = 50)
You can read more examples at the documentation page.
Metadata
Release files for subclass-register 1.0.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 | |
|---|---|---|---|---|
| subclass-register-1.0.1.tar.gz | 4.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| subclass_register-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / subclass-register-1.0.1.tar.gz
| Download URL | subclass-register-1.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a2d8634edcd1e566b746d29b8eb82cdefec29b19b0b5185748fa69605973f75
|
|
BLAKE2b-256 checksum How to use checksums |
8d812b5c946b79df13e9da709d78259184ffc5c96d8140a4bbf8f40ece712bb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / subclass_register-1.0.1-py3-none-any.whl
| Download URL | subclass_register-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1515d0275ebb2c4c52956d2bc2519afe80267e87248cf20ba2ff7565fc5d081a
|
|
BLAKE2b-256 checksum How to use checksums |
5dff823416d8410809918286ae0e728d73b7348800e740b9acfdaf7a10b03d00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Security for subclass-register 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.