semvec/pypi-packages huggingface dataset:
edgefarm-application 0.2.2
A python library for EdgeFarm applications

# edgefarm-application
[![CI](https://github.com/edgefarm/edgefarm-application-sdk.py/actions/workflows/push_on_main.yml/badge.svg)](https://pypi.org/project/edgefarm-application/)

A python library for EdgeFarm applications.

Supported features
* Communicate with Service Modules
    * [alm-mqtt-module](./edgefarm_application/alm_mqtt_module)
    * [ads-node-module](./edgefarm_application/ads_node_module)

This library is using [asyncio](https://docs.python.org/3/library/asyncio.html) and therefore the application must use the design patters required for asyncio.

## Installation via pip
```
pip3 install edgefarm-application
```

## Example usage:
```python
import edgefarm_application as ef

async def subject_handler(msg):
    payload = json.loads(msg["payload"])
    print(f"{msg}: payload={payload}")


async def main():
    # Initialize Edgefarm Application SDK
    await ef.application_module_init_from_environment(asyncio.get_event_loop())

    # Publish a message to Application Data Service (ADS)
    ads = ef.AdsProducer()

    # Create an encoder for an application specific payload
    payload_schema = { .... }  # replace with your avro schema

    encoder = ef.AdsEncoder(
        payload_schema,
        schema_name="temperature_data",
        schema_version=(1, 0, 0),
        tags={"monitor": "channel1"},
    )

    ads_payload = { 'mydata': 1234 }

    await ads.encode_and_send(encoder, ads_payload)


    # Connect to ALM MQTT module and register the MQTT subjects we want to receive
    mqtt_client = AlmMqttModuleClient()
    await mqtt_client.subscribe("simulation/temperature", subject_handler)

    #
    # The following shuts down gracefully when SIGINT or SIGTERM is received
    #
    stop = {"stop": False}

    def signal_handler():
        stop["stop"] = True

    for sig in ("SIGINT", "SIGTERM"):
        loop.add_signal_handler(getattr(signal, sig), signal_handler)

    while not stop["stop"]:
        await asyncio.sleep(1)

    print("Unsubscribing and shutting down...")
    await mqtt_client.close()
    await ef.application_module_term()


if __name__ == "__main__":
    asyncio.run(main())
```

## Compatibility

Compatible with Python >= 3.8

## Running examples

(You can ignore these instructions if you installed this SDK via pip)

When you have cloned this repo and want to run the code in `examples`, ensure that you have the `edgefarm_application` in your `PYTHONPATH`, e.g.
```bash
export PYTHONPATH=<this-repo-checkout-path>:${PYTHONPATH}
```

Furthermore, load required schemas from [ads_schema repo](https://github.com/edgefarm/ads-schemas.git):
```bash
make
```
tornado-request-mapping 0.0.6
spring-like request_mapping for tornado.

# install 

```bash
pip install -U git+https://github.com/sazima/tornado_request_mapping
```

# A simple example 

```python
import tornado.ioloop
from tornado.websocket import WebSocketHandler
import tornado.web
from tornado_request_mapping import request_mapping, Route


@request_mapping("/test")
class MainHandler(tornado.web.RequestHandler):
    @request_mapping('/get_by_id', method='get')
    async def test(self):
        self.write("Hello, world. get")

    @request_mapping('/update_by_id', method='post')
    async def test1(self):
        self.write("Hello, world. post")


@request_mapping('/t')
class MyHandler(tornado.web.RequestHandler):
    @request_mapping('/get_by_id', method='put')
    async def test(self):
        self.write("Hello, world. put")


@request_mapping("/ws")
class Wshandler(WebSocketHandler):
    def open(self, *args: str, **kwargs: str):
        print('open')

    def close(self, code: int = None, reason: str = None) -> None:
        print('close')

    def check_origin(self, origin: str) -> bool:
        return True


if __name__ == "__main__":
    app = tornado.web.Application()

    route = Route(app)
    route.register(MainHandler)
    route.register(MyHandler)
    route.register(Wshandler)

    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()

```
xeasy-ml 0.1.3
An integrated machine learning analysis framework
Requires Python: >=3.6

xeasy-ml
====
## 1. What is xeasy-ml
Xeasy-ml is a packaged machine learning framework. It allows a beginner to quickly bui
-ld a machine learning model and use the model to process and analyze his own data. At the same time, we have also realized the automatic analysis of data. During data proces
-sing, xeasy-ml will automatically draw data box plots, distribution histograms, etc., and perform feature correlation analysis to help users quickly discover the value of data.

## 2.Installation
### Dependencies
xeasy-ml requires:

    Scikit-learn >= 0.24.1

    Pandas >= 0.24.2

    Numppy >= 1.19.5

    Matplotlib >= 3.3.4

    Pydotplus >= 2.0.2

    Xgboost >= 1.4.2
### User installation
    pip install xeasy-ml

## 3. Quick Start


### 1.Create a new project

#### Create a new python file named pro_init.py to initialize the project.
```Bash
from xeasy_ml.project_init.create_new_demo import create_project
import os

pro_path = os.getcwd()
create_project(pro_path)
```

#### Now you can see the following file structure in your project.
```
├── Your_project
     ...
│   ├── pro_init.py
│   ├── project
│   │   └── your_project
```
### 2.Run example
```Bash
cd project/your_project

python __main__.py
```

### 3.View Results

```Bash
cd project/your_project_name/result/v1
ls -l
```
    ├── box   (Box plot)
    ├── cross_predict.txt （Cross-validation prediction file）
    ├── cross.txt  （Cross validation effect evaluation）
    ├── deleted_feature.txt  （Features that need to be deleted）
    ├── demo_feature_weight.txt  （Feature weights）
    ├── demo.m   （Model）
    ├── feature_with_feature  （Feature similarity）
    ├── feature_with_label   （Similarity between feature and label ）
    ├── hist    （Distribution histogram）
    ├── model
    ├── predict_result.txt  （Test set prediction results）
    └── test_score.txt      （Score on the test set）