name | Python Input Module Boilerplate |
version | v1.0.1 |
GitHub | python-input-module-boilerplate |
authors | Jakub Grzelak, Nithin Saai |
This is a Python Input Boilerplate module and it serves as a starting point for developers to build input modules for weeve platform and data services. Navigate to As a module developer to learn how to use this module. You can also explore our weeve documentation on weeve Modules and module tutorials to learn more details.
Most important resources:
name | description |
---|---|
src | All source code related to the module (API and module code). |
src/main.py | Entry-point for the module. |
src/api | Code responsible for setting module's API and communication with weeve ecosystem. |
src/module | Code related to the module's business logic. This is working directory for module developers. |
docker | All resources related to Docker (Dockerfile, docker-entrypoint.sh, docker-compose.yml). |
example.env | Holds examples of environment variables for running the module. |
requirements.txt | A list of module dependencies. |
Module.yaml | Module's YAML file that is later used by weeve platform Data Service Designer |
├── src
│ ├── api
│ │ ├── __init__.py
│ │ ├── log.py # log configurations
│ │ └── send_data.py # sends data to the next module
│ ├── module
│ │ └── main.py # [*] main logic for the module
│ └── main.py # module entrypoint
├── docker
│ ├── .dockerignore
│ ├── docker-compose.yml
│ ├── docker-entrypoint.sh
│ └── Dockerfile
├── example.env # sample environment variables for the module
├── Module.yaml # used by weeve platform to generate resource in Data Service Designer section
├── makefile
├── README.md
├── example.README.md # README template for writing module documentation
└── requirements.txt # module dependencies, used for building Docker image
There are 4 module variables that are required by each module to correctly function within weeve ecosystem. In development, these variables can overridden for testing purposes. In production, these variables are set by weeve Agent.
Environment Variables | type | Description |
---|---|---|
MODULE_NAME | string | Name of the module |
MODULE_TYPE | string | Type of the module (Input, Processing, Output) |
LOG_LEVEL | string | Allowed log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL. Refer to logging package documentation. |
EGRESS_URLS | string | HTTP ReST endpoint for the next module |
RECOMMENDED: Make sure you have virtual environment
A module developer needs to add all the configuration and business logic.
All the module logic can be written in the module package in src/module
directory.
- The files can me modified for the module
2.
module/module.py
* The functionmodule_main
should input/read data for this module. * All the business logic about modules are written here.
The following are module dependencies:
- requests