A simple library to visualize lists.
Project description
AutoIoT Framework
AutoIoT is a framework to generate the server-side software of IoT applications. Based on a model represented as JSON, AutoIoT can generate different components of IoT applications; each component is generated by a different Specialized Builder (generators in the AutoIoT project).
Install
To install AutoIoT from this repository, clone the repository and run:
pip install dist/autoiot-0.1.0-py3-none-any.whl
Usage
To use AutoIoT you need to create a JSON file containing the description of your IoT project, like the one presented below.
In the future this JSON file will be generated by a Web Graphical User Interface (GUI).
{
"name": "My IoT Project",
"description": "This is a sample project to show how to use AutoIoT Specialized Builders.",
"devices": [
{
"name": "Raspberry Pi",
"description": "A small single-board computer.",
"attributes": [
{
"name": "room",
"type": "String"
},
{
"name": "model version",
"type": "Integer"
}
],
"sensors": [
{
"name": "DHT11",
"attributes": [
{
"name": "temperature unit",
"type": "String"
}
],
"data": [
{
"name": "temperature",
"type": "Float"
},
{
"name": "humidity",
"type": "Integer"
}
]
},
{
"name": "GPS",
"attributes": [
{
"name": "model",
"type": "String"
}
],
"data": [
{
"name": "position",
"type": "GPS"
}
]
}
]
}
]
}
The types of data supported by AutoIoT in the description of the system are: String, Integer, Float, Boolean, GPS, Position.
Attributes represent features of devices and sensors and usually do not change very often, while data represent the data sent regularly from devices to the server application.
Now you can import this file into your code and generate the application's source code by choosing one of the available Specialized Builders. In this example we are going to use the SimpleDeviceAPI builder that is packed inside this module (others Specialized Builders need to be installed separately).
from autoiot.AutoIoT import AutoIoT
from autoiot.SimpleDeviceAPI import SimpleDeviceAPI
autoiot = AutoIoT()
autoiot.load_project_from_file('project.json')
autoiot.build(SimpleDeviceAPI, 'output')
The generated source code is written in the folder called "output".
Optionally, your can use the command line interface. Just open a command line in a folder type the following command:
autoiot -p project.json -o output
This will generate an IoT system based in your project.json file in the "output" folder.
SimpleDeviceAPI Builder
The system generated by SimpleDeviceAPI is a ready-to-use project written in Python using the FastAPI framework, it provide the abstraction of one IoT device and allow you to store and retrieve sensor data and the device information.
To make this example the simplest possible, we choose to avoid databases that require installation and configuration (e.g., PostgreSQ:, MySQL and MongoDB). The system created by this builder uses the tinyDB database.
To setup the generated system you need to navegate to its root folder (the "output" folder if you are following the example) and run the following commands:
pip install -r requirements.txt
uvicorn main:app
Your SimpleDeviceAPI system will be running in http://localhost:8000. To access its OpenAPI GUI you should use http://localhost:8000/docs, where you can try some requests and see the system in action.
The main idea behind this Specialized Builder is to be a Blueprint that shows how a Specialized Builder can be created. It is not intended to be used in production and provide very limited features.
Contributing to the project
Tests
This project uses pytest. To run the tests use:
First, you need to install the pytest-cov library to do coverage test:
pip install pytest-cov
and then run the tests:
pytest --cov-report html --cov=autoiot autoiot/tests/
Building the library
To build the library you need the wheel module:
pip install wheel
and run the following command:
python setup.py sdist bdist_wheel
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for visualist-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a26f342def5b8421e6a995d788a9d7ad66b96323c60e86ed662b7e4d2ced409b |
|
MD5 | d28ea400bba7f93c6af5e3b28d73f5f0 |
|
BLAKE2b-256 | 0b488750d848df95c7d6ad939ba19b8a0075b8f7d9fcbaedeb2d904e3ed348a9 |