cls-str
Convert Python classes to strings and back. Useful for serialization, configuration files, and message passing.
Installation
pip install cls-str
Quick Start
Basic Usage
from cls_str import cls_to_str, str_to_cls
# Convert class to string
from http.server import SimpleHTTPRequestHandler
class_path = cls_to_str(SimpleHTTPRequestHandler)
print(class_path)
# Output: "http.server.SimpleHTTPRequestHandler"
# Convert string back to class
restored_class = str_to_cls(class_path)
assert restored_class is SimpleHTTPRequestHandler
Nested Classes
class Outer:
class Inner:
pass
# Works with nested classes too
path = cls_to_str(Outer.Inner)
print(path)
# Output: "your_module.Outer.Inner"
loaded_class = str_to_cls(path)
assert loaded_class is Outer.Inner
License
MIT License
Metadata
Release files for cls-str 0.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 | |
|---|---|---|---|
| cls_str-0.1.1.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cls_str-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / cls_str-0.1.1.tar.gz
| Download URL | cls_str-0.1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1df00e829fe918950d5348d2e0870bb7f48a87142e9f9f167777d8ad0754e5b2
|
|
BLAKE2b-256 checksum How to use checksums |
433f6b370db65fdca7a62342435f31d76a51784fa2c919134e6a2d34e64606f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.11.14 Darwin/25.0.0
|
Release files / cls_str-0.1.1-py3-none-any.whl
| Download URL | cls_str-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65e183868f1577eb99839b720efba4042641cc880d1b5ffd93bb873db60b9438
|
|
BLAKE2b-256 checksum How to use checksums |
656f379f25ec52d0219b7f5c12b7170f6c115d300e06bbaef72fe322f7815004
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.11.14 Darwin/25.0.0
|