Metadata-Version: 2.4
Name: PyAutomationIO
Version: 1.0.2
Summary: A python library to develop automation continuous tasks using sync or async concurrent threads
Home-page: https://github.com/know-ai/PyAutomation
Author: KnowAI
Author-email: dev.know.ai@gmail.com
License: GNU AFFERO GENERAL PUBLIC LICENSE
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: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Logging
Classifier: Topic :: System :: Monitoring
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-statemachine==2.4.0
Requires-Dist: python-statemachine[diagrams]
Requires-Dist: peewee==3.17.8
Requires-Dist: psycopg2-binary==2.9.9; sys_platform != "win32"
Requires-Dist: psycopg2==2.9.9; sys_platform == "win32"
Requires-Dist: numpy==1.25.0
Requires-Dist: PyWavelets==1.7.0
Requires-Dist: dash==2.18.2
Requires-Dist: dash-bootstrap-components==1.6.0
Requires-Dist: dash-mantine-components==0.14.7
Requires-Dist: dash-iconify==0.1.2
Requires-Dist: opcua==0.98.13
Requires-Dist: python-dotenv==1.0.1
Requires-Dist: cryptography==43.0.3
Requires-Dist: Flask-Cors==5.0.0
Requires-Dist: flask-restx==1.3.0
Requires-Dist: Flask-SocketIO==5.4.1
Requires-Dist: gunicorn==23.0.0
Requires-Dist: websocket-client==1.8.0
Requires-Dist: gevent-websocket==0.10.1
Requires-Dist: PyJWT==2.9.0
Requires-Dist: pydot==3.0.2
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# PyAutomation

The development intention of this framework is to provide the ability to develop industrial applications where processes need to be executed concurrently and field data need to be managed for monitoring, control, and supervision applications.



![Core](docs/img/PyAutomationCore.svg)

In the image above, you can generally see the architecture and interaction of the different modules that make up the framework.

For this, state machines are available that run in the background and concurrently to acquire data by query (DAQ), Acquire Data by Exception (DAS) and any other general purpose state machine.

It has a memory persistence module for real-time variables that we call (CVT, Current Value Table).

There is also an alarm management system

And finally, the disk persistence of the variables to provide functionalities for historical trends of the field variables.


# Run Config Page

## Crearte Virtual Environment

```python
python3 -m venv venv
. venv/bin/activate
```
## Install Dependencies

```python
pip install --upgrade pip
pip install -r requirements.txt
```

## Run Config page

```python
python run.py
```

or 

```python

./docker-entrypoint.sh
```

## Deploy documentation on Development mode With mkautodoc

### Install Wheel

```python
pip install wheel
```

### Create PyAutomation's package

Execute this code where is setup.py file

```python
python3 setup.py bdist_wheel
```

This create some folders

- build
- dist
- PyAutomation.egg-info

### Install PyAutomation Folder

Located into "dist" folder

```python
pip install dist/PyAutomation-1.0.0-py3-none-any.whl
```

After that, you can run mkdocs serve


# Deploy

Make the following `.env` file:

```
PORT=5000
```

## Docker

Export environment variables

```
export $(grep -v '^#' .env | xargs)
```

Start the app

```
sudo docker run -d \
  --name PyAutomation \
  -p ${PORT}:${PORT}\
  -v $(pwd)/temp/db:/app/db \
  -v $(pwd)/temp/logs:/app/logs \
  -e PORT=${PORT} \
  knowai/automation:1.0.0
```

## Docker Compose

If you want to deploy it using docker compose, make the following `docker-compose.yml` file:

```YaMl
version: '3.3'

services:

  automation:
    container_name: "PyAutomation"
    image: "knowai/automation:1.0.0"
    restart: always
    ports:
      - ${PORT}:${PORT}
    volumes:
      - ./temp/db:/app/db
      - ./temp/logs:/app/logs
    environment:
      PORT: ${PORT}
      OPCUA_SERVER_PORT: ${OPCUA_SERVER_PORT}
    healthcheck:
      test: ["CMD-SHELL", "curl --fail -s -k http://0.0.0.0:${PORT}/api/healthcheck/ || curl --fail -s -k https://0.0.0.0:${PORT}/api/healthcheck/ || exit 1"]
      interval: 15s
      timeout: 10s
      retries: 3

```

Start the docker compose file

```
sudo docker-compose --env-file .env up -d
```


Go to http://host:${PORT} to view the config page
