Metadata-Version: 2.1
Name: simple-print
Version: 1.4.1
Summary: Poweful function that will help you with debugging.
Home-page: https://github.com/Sobolev5/simple-print/
Author: Sobolev Andrey
Author-email: email.asobolev@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: termcolor (==1.1.0)
Requires-Dist: executing (==0.8.1)
Requires-Dist: asttokens (==2.0.5)
Requires-Dist: typing-extensions (>=4.1.0)
Provides-Extra: broker
Requires-Dist: pika (>=1.3.0) ; extra == 'broker'
Requires-Dist: pydantic (>=1.10.2) ; extra == 'broker'
Requires-Dist: orjson (>=3.8.0) ; extra == 'broker'

# Simple print
Powerful debugging & logging function.
Userful for `bash` console messages (debug) & `rabbitmq` proxy messages (logging).

```no-highlight
https://github.com/Sobolev5/simple-print
```

# For local development (minimal version)
## Install
To install run:
```no-highlight
pip install simple-print
```

Add the following line at the top of your *.py file:
```python
from simple_print import sprint 
```
Print your variables:
```python
master = "yoda"
sprint(master)    
sprint(master, c="blue") # colors: grey, red, green, yellow, blue, magenta, cyan, white. 
sprint(master, c="blue", b="on_white") # backgrounds: on_grey, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan
sprint(master, c="blue", b="on_white", a="bold") # attributes: bold, dark, underline, blink, reverse, concealed
sprint(master, c="blue", b="on_white", a="bold", p=True) # 
my_string = sprint(master, s=True) # return as string
my_string = sprint(master, s=True, p=True) # return as string with path to file 
```
Open development console and see the result:
![](https://github.com/Sobolev5/simple-print/blob/master/screenshots/screenshot.png)
`p` param is `False` by default, but you can override this behavior with `SIMPLE_PRINT_PATH_TO_FILE=True` in your local environment.
### Disable printing
Stop printing:
```sh
export DEBUG=False
```
### Test 
```sh
pytest test/test_print.py -s
```
# For catch messages on production server 
## Install
To install run:
```no-highlight
pip install simple-print[broker]
```

Add the following line at the top of your *.py file:
```python
from simple_print import throw, catch 
```
Now you can send messages to rabbitmq queue `amq.direct`.`simple_print` (by default):
```python
throw({"tag":"tag", "msg":{"any_key":"any val"}, uri="amqp://admin:pass@0.0.0.0:5672/vhost") # default queue
throw({"exchange":"any_exchange", "routing_key":"any_key", "tag":"tag", "msg":{"any_key":"any val"}}, uri="amqp://admin:pass@0.0.0.0:5672/vhost") # with custom routing key
 ``` 
Catch last 10 messages from RabbitMQ:
```python
catch(tag="tag", count=10, uri="amqp://admin:pass@0.0.0.0:5672/vhost") # default queue
catch(queue="queue", tag="tag", count=10, console=True, uri="amqp://admin:pass@0.0.0.0:5672/vhost") # custom queue
```
### Test 
```sh
pytest test/test_broker.py -s
```

# TODO
> Kafka support & PyQt support


# Try my free time tracker
My free time tracker for developers [Workhours.space](https://workhours.space/). 


