Metadata-Version: 2.3
Name: parameter-toolkit
Version: 0.1.1
Summary: A python library to interact with inspects Parameters objects.
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# Parameter-Toolkit
## A small python library to interact with and convert parameters.

Working on a different project where I want to receive optional commands in a human readable manner I dug a bit deeper 
into the world of inspect, functools and astlib and discovered there is no low-level way to interact with python-signatures.

This library meant to overcome this bt providing Utitlites to access Parameters of Signatures in a more primitive manner.

### Features:

Parameter Tools:
* Get all `Parameter` objects from a func with inspect shorthand (Either as list or generator).
* Convert function `parameters` to a `dict` of python BuiltIns.

LiteralParameter Tools:
* Extract string of literal paramaters to convert them with ast.literalEval into usable `args' and 'kwargs'!
    - All types supported by astlib are extractable/slicable
    - Supports nested containers

* Map a literal parameteres ` directly to a function and get a `partial` object. (WIP)

* **NO external dependencies**

**Get functions parameter info:**
```python
    def helloWorld(name_to_greet:str="World!"):
        return f"Hello {name_to_greet}"

    func_parameters_info = getFuncParameterAsDict(helloWord)
    for p in func_parameters_info:
        print(p)
    '''
    {"name":"name_to_greet", "type":"str", "default": "World!", "kind"}    
    '''
```

**Convert a single parameter to dict:**
```python
    parameter_info = parameterToDict(myExtractedParemeter)
    print(parameter_info)

    '''
    {"name":"name_to_greet", "type":"str", "default": "World!", "kind"}    
    '''
```

**Convert a stringified parameters to positional and keyword args:**
```python
    myParameterString = '"Please write me in Upper\\"s", True, repeat=5", data=[4,2,1,[6,2],8] ...'
    extracted_parameters = LiteralParameterExtraxtor(myParameterString).extractStringParameters()
```

### Known Bugs
* No more bugs known (yet!)

Happy Hacking!

[![Get it on Codeberg](codeberg.svg)](https://codeberg.org/LaManu/Python-Parameter-Toolkit/)

### Licensing
All of the provided code as well as readme and other releated files to the library are published under:
**GPLv3** 
