semvec/pypi-packages huggingface dataset:
kaxi 0.1.1
Run pipelines similar to github actions
License: MIT
Requires Python: >=3.8,<4.0

# kaxi

<p align="center">
    <em>Run pipelines similar to github actions</em>
</p>

<div align="center">

[![Package version](https://img.shields.io/pypi/v/kaxi?color=%2334D058&label=pypi%20package)](https://pypi.org/project/kaxi/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/gabrielguarisa/kaxi/releases)
[![License](https://img.shields.io/github/license/gabrielguarisa/kaxi)](https://github.com/gabrielguarisa/kaxi/blob/main/LICENSE)

</div>

## Installation

```bash
pip install kaxi
```

## Usage

You can run a pipeline by running the following command:

```bash
kaxi <pipeline_file>.yaml
```

Or you can programmatically run a pipeline by running the following command:

```python
from kaxi import Runner

runner = Runner(your_pipeline)
runner.execute()
```

## Pipeline file

A pipeline file is a yaml file that contains a list of steps to execute. Each step is a dictionary with the following keys:

- `uses`: The callable to execute (e.g. `pandas.read_csv`)
- `name` (optional): The name of the step
- `with` (optional): A dictionary of arguments to pass to the callable

If you want to use arguments without the respective name, you can use the `args` key inside the `with` dictionary.

### Example

```yaml
verbose: true

steps:
  - uses: os.path.isfile
    name: file_exists
    with:
      path: example.yaml

  - uses: kaxi.log.info
    with:
      args:
        - ${file_exists}
```

### Environment variables

You can use environment variables in your pipeline file by using the `${ENV_VAR}` syntax.

To define environment variables, you can set them inside the `enviroment` key:

```yaml
environment:
  ENV_VAR: value
```

Another way to use environment variables is to use the ouput of a step as an environment variable, this can be done by using the `name` of the step inside the `${}` syntax:

```yaml
steps:
  - uses: os.path.isfile
    name: file_exists
    with:
      path: example.yaml

  - uses: kaxi.log.info
    with:
      args:
        - ${file_exists}
```
pynetem 0.1.5
PyNetem is a tool that allow the user to limit the bandwidth or simulate weak network.
License: MIT

# pynetem
PyNetem is a tool that allow the user to limit the bandwidth or simulate weak network.
It does so by using iproute's tc command, but greatly simplifies its operation.
And provide apis if you need in your work.
## Installation
```
pip install pynetem
```
## How to Use It?
In command mode, type `pynetem -h`, you will see help information, parameters in this tool is same as 'tc/netem'.

If the host cannot download package from PyPI, you can use PyNetem (>=0.1.2) in your PC (no mater Windows or Linux) with the following parameters in addition:
```bash
--host          The host IP, which you will send command to
--usrname       The username of host
--password      The password of host
```

You can also use original command of `tc/netem`.
For more information about `tc/netem`, you can click here: [netem](https://man7.org/linux/man-pages/man8/tc-netem.8.html)

It is recommended to use web mode, when you have several hosts to control, or you want to build a web page for easier usage.

Run in web mode: `pynetem --web`, default port is 8899, you can specify by yourself `pynetem --web --port=9090`

There are 8 APIs:
```
[GET] /pynetem/help                                     -- Get demo post data and simple description
[GET] /pynetem/listInterfaces                           -- Get interfaces name of host
[GET] /pynetem/getRules?eth=<interface name>            -- Get qdisc rules by interface
[GET/DELETE] /pynetem/clear?eth=<interface name>        -- Clear all rules
[POST] /pynetem/setRules?eth=<interface name>           -- Set tc qdisc rule

[POST] /pynetem/brctl/addbr                             -- Set bridge, the bridge name is pynetem_bridge by defaut
[GET/DELETE] /pynetem/brctl/delbr                       -- Delete pynetem_bridge
[POST] /pynetem/brctl/addif                             -- Add interface(s) to pynetem_bridge
```
Post Body, if you set parameter `None` or `''`, the parameter will be ignored.

Format for the options is the same as [tc-netem](https://man7.org/linux/man-pages/man8/tc-netem.8.html)'s and
[tc-tbf](https://man7.org/linux/man-pages/man8/tc-tbf.8.html)'s.

`[POST] /pynetem/setRules?eth=<interface name>`
```python
{
    "delay": "100ms 10ms 25%",
    "distribution": "normal",
    "reorder": "25% 50%",
    "loss": "0.3% 25%",
    "duplicate": "1%",
    "corrupt": "0.1%",
    # Bitrate control using Netem 
    "netem_rate": "256kbit",
    "netem_limit": 3000,
    # Bitrate control using TBF
    "rate": "256kbit",
    "buffer": 1600,
    "limit": 3000,
    "dst": "10.10.10.0/24"
}
```
`netem_rate` and `rate` are mutually exclusive.

`buffer`, `limit`, and `dst` can only be used if `rate` is set.

---
`[POST] /pynetem/brctl/addbr`

`stp` is "on" by default.
```json
{
    "interfaces": ["eth0", "eth1"],
    "stp": "on"
}
```
---
`[POST] /pynetem/brctl/addif`
```json
{
    "interfaces": ["eth2"]
}
```

---
**ATTENTION!**

When you press `ctrl + c` to stop the web server, **ALL qdisc rules in all interfaces AND the pynetem_bridge** will be cleared automatically.
easy-flask-restful 1.1.5
Easy to Make Flask Server
License: MIT

# easy-flask
Automatic generate a flask server project by command

# Start
Install
```bash
pip3 install easy-flask-restful
```
Make a flask server project at current dir:
```bash
easy-flask -n demo_server
# or
easy-flask --new=demo_server

# start server in debug mode
cd demo_server
python3 app.py
# or
sh control.sh start|restart|stop
```

# Introduce
By this tool you don`t need care how to make a flask server project.
What you need to do is write api-file in easy format inside dir ``api``.
This project will automatically load uri by api-file, and pack json response with same format.

Project structure
```base
.
├── api
│   ├── __init__.py
│   └── demo
│       ├── __init__.py
│       └── demo_api.py
├── conf
│   ├── __init__.py
│   ├── config.ini
├── internal
│   ├── __init__.py
│   ├── error.py
│   └── utils.py
├── app.py
├── start.py
├── control.sh
└── logs
    └── app.log

```

``api`` - write api files here.

``internal.error`` - define error info here.

``app.py`` - start app by this file, you can rename it.

``conf`` - config for application

``control.sh`` - run app with command by gunicorn

## Write Api File
For example:
```python3
from flask import g

from internal import Resource
from utils.parser import Type, Required, Default, Min, Max


class DemoApi(Resource):

    uri = ['/api/demo']

    def get(self):
        pattern = {
            'num': {Type: int, Min: 10, Max: 100},
            'print': {Type: str, Required: True},
            'default': {Type: str, Default: 'demo'}
        }

        data, err = self.parse_request_data(pattern=pattern)
        if err:
            g.logger.warning(err)
            return err
        g.logger.info('success')
        return {'result': data}
```

``uri`` - required by all api file

``g.logger`` is loaded before each request for making different log_id.

``self.parse_request_data`` can help you to parse params, it will return ``ParamsError`` when param invalid.

Normal response:
```json
{
    "errno": 0,
    "data": {
        "result": {
            "num": 100,
            "print": "aaaa",
            "default": "demo"
        }
    },
    "msg": "success",
    "log_id": "f40c889d1b5744c7a87a9045aea8595c"
}
```

Error response:

return ``errno`` and ``msg`` according to ``error.py``.
```json
{
    "errno": 2,
    "msg": "params error:num check max invalid",
    "log_id": "7c53531b93a4406e9d3050bae5b99968"
}
```

## Suggest
A real project must have complex logic and interactions with DB or other service.
By this tool, you just can get a simple framework. So I give some suggestions here for writing better code.

- ``logic`` dir (or other name) for writing complex logic, keep simple in api file.
- if you need db operation, use ``flask-sqlalchemy``, and mkdir ``dto``.
- ``client`` dir for interact with other service, and make ``BaseClient`` class(inherited by other client), because you never want to write same code for many times.
pyqt-llamaindex 0.0.1
Example of using LLamaIndex in Python desktop app
License: MIT


# pyqt-llamaindex
Example of use llama-index in Python desktop application

With combination of llama-index and openai, you can pretty much make your personal chatbot, by your input.

Currently this package is only supporting txt files(i don't know about other file type such as .doc works) in the directory. If you want to feed the chatbot to respond what you want to get answer, put txt file inside the "example" directory in this repo and read the instruction below("How to Run" section) to use it. Of course, you can use your own directory other than the directory i mentioned earlier. <b>Remember, the directory has to contain at least one text file</b>.

By default, example folder contains yjg30737.txt and pyqt-openai.txt. It was used for testing so feel free to remove it if you want.

## Requirements
* PyQt5 >= 5.14
* openai
* llama-index

## How to Run
1. git clone ~
2. cd pyqt-llamaindex
3. pip install -r requirements.txt
4. cd pyqt_llamaindex
5. python main.py
6. write your openai api key to the top of the screen and clicking "use" button
7. pressing "set directory" button to import directory which contains text files
8. chat with your personal chatbot

## Preview

![image](https://github.com/yjg30737/pyqt-llamaindex/assets/55078043/67e17c9b-9a49-4f3b-8c3d-05d7c85941fb)

## See Also
* <a href="https://github.com/yjg30737/pyqt-openai">pyqt-openai</a>