Handles a variety of common routines for SDC-based applications.
Project description
Samtec Device Share
A Python 3 SDC conforming REST API to run on IoT devices that enables user discovery, viewing, and management.
Installation
pip install samtecdeviceshare
Running
First ensure all environment variables are set correctly. Note: To test locally for development ensure EMULATION and PYTHON_ENV are set.
python -m samtecdeviceshare.server
Environment Variables
Application / SDC / SDS
Name | Description | Default |
---|---|---|
REST_ADDRESS | Rest API Address | 0.0.0.0 |
REST_PORT | Rest port | 47546 |
APP_VERSION | SemVer of app | 0.0.0 |
APP_LOG_PATH | Path to store log files | default tempdir() |
APP_WEB_PORT | Embedded web app port | 80 |
APP_IMG_PATH | app icon path | {CURDIR}../static/img.png |
SDC_WIFI_TYPE | enum: HOTSPOT CLIENT DISABLED | HOTSPOT |
SDC_WIFI_SSID | WiFi SSID | SDC-${BALENA_PREFIX_DEVICE_UUID} |
SDC_WIFI_PASS | WiFi passphrase | samtec1! |
SDC_WIFI_IFACE | WiFi hardware interface | wlan0 |
ETH_DISABLE | Disable ethernet | null |
ETH_TARGET_NAME | Eth hardware interface | null |
ETH_DHCP_TIMEOUT | Timeout to get DHCP address | 15 |
ETH_LOCAL_TIMEOUT | Timeout to get autoip address | 30 |
PYTHON_ENV | enum: development production | production |
EMULATION | Use emulated devices/io | null |
LOG_VERBOSE | boolean verbose logs | false |
Balena
Refer to Balena documentation for list and description of variables.
- BALENA_SUPERVISOR_API_KEY
- BALENA_APP_ID
- BALENA_DEVICE_TYPE
- BALENA
- BALENA_SUPERVISOR_ADDRESS
- BALENA_SUPERVISOR_HOST
- BALENA_DEVICE_UUID
- BALENA_API_KEY
- BALENA_APP_RELEASE
- BALENA_SUPERVISOR_VERSION
- BALENA_APP_NAME
- BALENA_DEVICE_NAME_AT_INIT
- BALENA_HOST_OS_VERSION
- BALENA_SUPERVISOR_PORT
Development
Installing
git clone git@bitbucket.org:samteccmd/samtecdeviceshare.git samtecdeviceshare
cd samtecdeviceshare
pipenv install --dev
pipenv shell
Testing
First, run dummy Balena supervisor:
bash ./tests/dummy-supervisor.sh
Next, fire up REST server using uvicorn:
EMULATION=1 PYTHON_ENV="development" uvicorn samtecdeviceshare.server:app --reload
Interactive API docs will be available: http://127.0.0.1:8000/docs
Unit Tests
pylint --rcfile .pylintrc samtecdeviceshare
pytest
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
SamtecDeviceShare-2.2.2.tar.gz
(13.0 kB
view hashes)
Built Distribution
Close
Hashes for SamtecDeviceShare-2.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c90698e9d64d0f9a3899081349b7a113bf92d15a41fe8afe566e4a4d53068d0 |
|
MD5 | af152b80e33740bd1d38237db6d24a5e |
|
BLAKE2b-256 | 9959265eac1631df8d11f5785e97a84a695445580a7dc14ebc892ad074acd6cf |