Metadata-Version: 2.1
Name: dynamic-cast
Version: 0.1.2a2
Summary: A Python library for flexible type casting of function arguments and return values based on type annotations.
Keywords: type-casting,type-annotations,dynamic-typing,python-type-hints,type-conversion,function-arguments,type-checking,callable-type,data-types,type-safety,python-decorators,runtime-type-checking,type-inference,generic-types,automatic-type-casting,type-system
Author-Email: Santiago Papiernik <spapiernik12@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Cxx-mlr
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Project-URL: Repository, https://github.com/Cxx-mlr/dynamic-cast
Requires-Python: >=3.8
Requires-Dist: packaging>=24.1
Requires-Dist: typing-extensions>=4.12.2
Description-Content-Type: text/markdown

---

# Dynamic Casting Utility

## Introduction

This Python module provides a dynamic casting utility that enables flexible casting of function arguments and return values based on type annotations. The utility is particularly useful for handling complex type conversions and ensuring compatibility between different data types.

## Installation

To use this dynamic casting utility, you can include it in your project by importing the `dynamic_cast` function from the module.

```python
from dynamic_cast import dynamic_cast
```

## Usage

### Basic Usage

The `dynamic_cast` function can be applied to functions to dynamically cast their arguments and return values based on the provided type annotations. It supports various scenarios, including handling iterable types, callables, and more.

```python
@dynamic_cast
def example_function(arg1: int, arg2: str) -> float:
    # Function logic here.
    return result
```

### Advanced Usage

For more advanced scenarios, the utility provides additional functionality, such as handling generic types, callable types, and class instances.

```python
@dynamic_cast
def advanced_function(arg1: List[int], arg2: Dict[str, float]) -> Tuple[str, int]:
    # Advanced function logic here.
    return result_tuple
```

## Examples.

### Dynamic Casting of Arguments.

```python
@dynamic_cast
def example_function(arg1: Union[str, int], arg2: List[float]) -> Tuple[str, List[int]]:
    # Function logic here
    return result_tuple
```

### Dynamic Casting of Class Instances

```python
class ExampleClass:
    @dynamic_cast
    def __init__(self, arg1: int, arg2: str) -> None:
        # Class initialization logic here
```

## Contributing

Feel free to contribute to the development of this dynamic casting utility. If you encounter any issues or have suggestions for improvement, please create an issue or submit a pull request.

## License

This dynamic casting utility is distributed under the MIT License. See the [LICENSE](LICENSE) file for more information.

---
