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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for SamtecDeviceShare-2.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4168b26128d7f15157d325b662f36e48a7026f2dbaa9c903a65738e1613a46c |
|
MD5 | 2f6cd2fece715b3ae2fb3a4b2e92eac3 |
|
BLAKE2b-256 | 3010f4079fe2a959d394950579266c585475d3db967b4aea96f73e80fadb8e47 |