Metadata-Version: 2.4
Name: cls-str
Version: 0.1.1
Summary: Magic of class-to-str
License: MIT
License-File: LICENSE
Author: Allen Chou
Author-email: f1470891079@gmail.com
Requires-Python: >=3.11,<4
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: all
Project-URL: Homepage, https://github.com/allen2c/cls-str
Project-URL: PyPI, https://pypi.org/project/cls-str/
Project-URL: Repository, https://github.com/allen2c/cls-str
Description-Content-Type: text/markdown

# cls-str

[![PyPI version](https://img.shields.io/pypi/v/cls-str.svg)](https://pypi.org/project/cls-str/)
[![Python Version](https://img.shields.io/pypi/pyversions/cls-str.svg)](https://pypi.org/project/cls-str/)
[![License](https://img.shields.io/pypi/l/cls-str.svg)](https://opensource.org/licenses/MIT)

Convert Python classes to strings and back. Useful for serialization, configuration files, and message passing.

## Installation

```bash
pip install cls-str
```

## Quick Start

### Basic Usage

```python
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

```python
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

