Metadata-Version: 2.1
Name: pawnlib
Version: 1.0.68
Summary: pawnlib is a collection of libraries for IaC.
Project-URL: Changelog, https://github.com/jinwoo-j/pawnlib
Project-URL: Documentation, https://pawnlib.readthedocs.io
Project-URL: Homepage, https://pawnlib.readthedocs.io
Project-URL: Source, https://github.com/jinwoo-j/pawnlib
Author-email: Jinwoo <jinwoo@parametacorp.com>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
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: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.7
Requires-Dist: aiometer>=0.3.0
Requires-Dist: argparse>=1.4.0
Requires-Dist: asttokens>=2.0.5
Requires-Dist: asyncio>=3.4.3
Requires-Dist: certifi>=2020.12.15
Requires-Dist: charset-normalizer>=2.1.0
Requires-Dist: deprecated~=1.2.13
Requires-Dist: devtools>=0.8.0
Requires-Dist: executing>=0.8.3
Requires-Dist: httpx~=0.24.0
Requires-Dist: idna>=2.5
Requires-Dist: inquirerpy==0.3.4
Requires-Dist: jinja2>=3.0.3
Requires-Dist: parameterized>=0.8.1
Requires-Dist: pyfiglet>=0.8.post1
Requires-Dist: pygments>=2.14.0
Requires-Dist: pyyaml>=5.3.1
Requires-Dist: requests~=2.25.0
Requires-Dist: rich>=12.0.1
Requires-Dist: six>=1.15.0
Requires-Dist: tabulate>=0.8.7
Requires-Dist: termcolor>=1.1.0
Requires-Dist: websocket-client>=0.59.0
Provides-Extra: brotli
Requires-Dist: brotli; platform_python_implementation == 'CPython' and extra == 'brotli'
Requires-Dist: brotlicffi; platform_python_implementation != 'CPython' and extra == 'brotli'
Provides-Extra: docker
Requires-Dist: aiodocker~=0.21.0; extra == 'docker'
Provides-Extra: full
Requires-Dist: aiodocker~=0.21.0; extra == 'full'
Requires-Dist: coincurve~=18.0.0; extra == 'full'
Requires-Dist: eth-keyfile>=0.6.1; extra == 'full'
Requires-Dist: rich<14,>=10; extra == 'full'
Provides-Extra: wallet
Requires-Dist: coincurve~=18.0.0; extra == 'wallet'
Requires-Dist: eth-keyfile>=0.6.1; extra == 'wallet'
Requires-Dist: rich<14,>=10; extra == 'wallet'
Description-Content-Type: text/markdown

# ♟️ Pawnlib

A collection of libraries that can be used like pawns on a chessboard.
Pawnlib is a collection of libraries for IaC.

utils, globals vars, logging, http, network, pretty printing, resource, converter ...


[![Build Docker Images](https://github.com/JINWOO-J/pawnlib/actions/workflows/docker-push.yml/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/docker-push.yml)
[![Docs](https://github.com/JINWOO-J/pawnlib/actions/workflows/docs-publish.yml/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/docs-publish.yml)
[![pages-build-deployment](https://github.com/JINWOO-J/pawnlib/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/JINWOO-J/pawnlib/actions/workflows/pages/pages-build-deployment)

[![PyPI version](https://badge.fury.io/py/pawnlib.svg)](https://badge.fury.io/py/pawnlib)



### Installing pawnlib

pawnlib is available on PyPI:

```
pip3 install pawnlib

```

pawnlib with wallet is available on PyPI:

```
pip3 install pawnlib[wallet]

```

### Global Config

You can use the global config. 

```python
from pawnlib.config.globalconfig import pawnlib_config as pawn
from pawnlib.output import *


def main():
    current_path = get_script_path(__file__)
    log_time_format = '%Y-%m-%d %H:%M:%S.%f'
    app_name = "default_app"
    stdout = True
    pawn.set(
        PAWN_PATH=current_path,        
        PAWN_TIME_FORMAT=log_time_format,
        PAWN_LOGGER=dict(
            log_level="INFO",
            stdout_level="INFO",
            log_path=f"{current_path}/logs",
            stdout=stdout,
            use_hook_exception=True,
        ),
        PAWN_CONSOLE=dict(
            redirect=True,
            record=True,
            log_time_format=f"%Y-%m-%d %H:%M:%S.%f",
        ),
        PAWN_DEBUG=True, # Don't use production, because it's not stored exception log.
        PAWN_VERBOSE=3,
        app_name=app_name,
        app_data={},
    )
    
    pawn.console.log("START APP")
    pawn.console.log(pawn.to_dict())

```

### app builder 

You can create a simple application based on pawnlib with the command below.


```bash

$ pawns init
[10:35:21,837] main_cli wrapper                                                                                               main_cli.py:117
[10:35:21,840] args = Namespace(proxy=None, init=Namespace(command='init')), command = init                                   main_cli.py:119

--------------------------------------------------


___.         .__.__       .___
\_ |__  __ __|__|  |    __| _/___________
 | __ \|  |  \  |  |   / __ |/ __ \_  __ \
 | \_\ \  |  /  |  |__/ /_/ \  ___/|  | \/
 |___  /____/|__|____/\____ |\___  >__|
     \/                    \/    \/

 - Description : Initialize Python Development Environment
 - Version     : 0.0.28
 - Author      : jinwoo


--------------------------------------------------

PWD = /Users/jinwoo/work/python_prj/pawnlib


What's your python3 app name? (default_app):
What's your name? (jinwoo):
Please explain this script. (This is script):
Project directory => /Users/jinwoo/work/python_prj/pawnlib ? [y/n] (y):
Do you want to logger? [y/n] (y):
Do you want to daemon? [y/n] (n):
```


### simple reflector proxy

Simple Python HTTP Server which reflects the client HTTP request header in server logs to see the header fields forwarded by web servers. 


```bash

$ pawns proxy -l 8080 -f 127.0.0.1:8200
[10:34:33,898] main_cli wrapper                                                                                               main_cli.py:117
[10:34:33,902] args = Namespace(proxy=Namespace(listen='8080', forward='127.0.0.1:8200', buffer_size=4096, delay=0.0001,      main_cli.py:119
               timeout=3), init=None), command = proxy

--------------------------------------------------



_____________  _______  ______.__.
\____ \_  __ \/  _ \  \/  <   |  |
|  |_> >  | \(  <_> >    < \___  |
|   __/|__|   \____/__/\_ \/ ____|
|__|                     \/\/
                _____.__                 __
_______   _____/ ____\  |   ____   _____/  |_  ___________
\_  __ \_/ __ \   __\|  | _/ __ \_/ ___\   __\/  _ \_  __ \
 |  | \/\  ___/|  |  |  |_\  ___/\  \___|  | (  <_> )  | \/
 |__|    \___  >__|  |____/\___  >\___  >__|  \____/|__|
             \/                \/     \/

 - Description : proxy reflector
 - Version     : 0.0.28
 - Author      : jinwoo


--------------------------------------------------

[10:34:33,904] args = Namespace(listen='8080', forward='127.0.0.1:8200', buffer_size=4096, delay=0.0001, timeout=3)              proxy.py:173
[10:34:33,905] Listen 0.0.0.0:8080 => Forward 127.0.0.1:8200

```
Officially supports Python 3.9+.

### Documentation

Documentation and tutorials are available at https://docs.jinwoo.xyz

## Release Information

