clspack
clspack is a python library that packagizes python classes
how to use
install clspack
pip install clspack
from clspack import pack
# extra imports for class inheritance
from rich.markdown import Markdown
from rich.console import Console
class MyClass(Markdown, Console):
"""class docstring"""
test = 1
@classmethod
def cls_method(cls):
# hidden classmethod comment
pass
source = pack(MyClass) # return the packed class as a string
pack(MyClass, print_output=True) # print it
pack(MyClass, output_file="my_class.py") # save it to a file
pack always returns the packed source code, print_output and output_file can be combined.
The packed code contains the imports needed for the parent classes and metaclass, followed by the class source code. When the class source file is not available (e.g. classes defined in a notebook or an interactive session), the class is rebuilt member by member from its methods, properties, nested classes and attributes.
limitations
- imports used inside method bodies or by class decorators (e.g.
@dataclass) are not added - parent classes defined in the same module as the packed class are not packed nor imported
Metadata
Release files for clspack 0.2.0
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 |
|---|---|---|---|---|
| clspack-0.2.0.tar.gz | 10.2 kB | Without provenance | Details for clspack-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clspack-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for clspack-0.2.0-py3-none-any.whl |
Total release size: 18.8 kB
Release files / clspack-0.2.0.tar.gz
| Download URL | clspack-0.2.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e296536fb784e0d5912b856d74c184b648197eec29255675a27d23dc0e3c154
|
|
BLAKE2b-256 checksum How to use checksums |
d91bec121239db101b7a46909b61c238e62cd3bce2fb6be29f762576ee2e6098
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / clspack-0.2.0-py3-none-any.whl
| Download URL | clspack-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5102f4a1660fc2527321e308f65cf2a66778cf127bd2e8a7711e28292c516932
|
|
BLAKE2b-256 checksum How to use checksums |
daf0725161f354593942161294ad422f3921bd518c72afe6abf046bce0327a20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for clspack 0.2.0
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.