Name | samtecdeviceshare JSON |
Version |
2.9.1
JSON |
| download |
home_page | |
Summary | Handles a variety of common routines for SDC-based applications |
upload_time | 2023-08-28 21:26:33 |
maintainer | |
docs_url | None |
author | Adam Page |
requires_python | >=3.8,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Samtec Device Connect Service
A Python 3 SDC conforming REST API to run on IoT devices that enables user discovery, viewing, and management.
## Installation
```bash
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.
```bash
python -m samtecdeviceshare.server
```
## Environment Variables
A number of environment variables are supported for configuration. These configurations can also be contained in a yaml/json configuration file specified using `SDC_CONFIGURATION_PATH`. Env vars take precedence over the configuration file.
### SDC Server / General
These variables are specific to this SDC service. The variables can also start with prefix `SDC_`.
| Name | Description | Default |
| ----------------- | ----------------------------- | ------------------------------------------- |
| REST_ADDRESS | Rest API Address | 0.0.0.0 |
| REST_PORT | Rest port | 47546 |
| ROOT_PATH | API root path | '' |
| PYTHON_ENV | enum: development production | production |
| EMULATION | Use emulated devices/io | null |
| LOG_VERBOSE | boolean verbose logs | false |
### Application
These variables are used to provide app info that will be shared by SDC.
| Name | Description | Default |
| ----------------- | ----------------------------- | ------------------------------------------- |
| APP_NAME | Name of app | SDC App |
| APP_VERSION | SemVer of app | 0.0.0 |
| APP_WEB_PORT | Embedded web app port | 80 |
| APP_IMG_PATH | app icon path | {CURDIR}../static/img.png |
| APP_LOG_PATH | Path to store log files | default tempdir() |
| APP_LOCK_PATH | Path to update lock file | .__sdc.lock |
### Wireless Networks
SDC can handle configuring N wireless networks. Prefix *SDC_* is required. Us integer `i` in prefix for defining multiple networks.
A network can optionally be defined default. This will be primary method used to handle updates and will be exposed through REST API.
| Name | Description | Default |
| ------------------------ | ----------------------------- | ------------------------------- |
| SDC_WIFI[i]_SSID | WiFi SSID | null* |
| SDC_WIFI[i]_MODE | enum: HOTSPOT CLIENT DISABLED | DISABLED |
| SDC_WIFI[i]_PASS | WiFi passphrase | null |
| SDC_WIFI[i]_IFACE | WiFi hardware interface | null |
| SDC_WIFI[i]_DEFAULT | Use as default for updates | False |
### Wired Networks
SDC can handle configuring N wired networks. Prefix *SDC_* is required. Us integer `i` in prefix for defining multiple networks.
`SDC_ETH[i]_IFACE` or `SDC_ETH[i]_REGEX_IFACE` is required with the latter supporting regex matching. Be careful defining multiple networks with generic regular expression.
[Most Linux distros follow a predictable naming scheme for interfaces.](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-understanding_the_predictable_network_interface_device_names). When searching for interfaces, a fullmatch is required `re.fullmatch()`.
| Name | Description | Default |
| --------------------------- | ----------------------------- | ---------------------------- |
| SDC_ETH[i]_IFACE | Interface name (str) | null |
| SDC_ETH[i]_REGEX_IFACE | Interface name (regex) | null |
| SDC_ETH[i]_METHOD | Primary method | WiredConnectionMethod.auto |
| SDC_ETH[i]_TIMEOUT | Timeout of primary | 15 |
| SDC_ETH[i]_FALLBACK | Fallback method | null |
| SDC_ETH[i]_FALLBACK_TIMEOUT | Timeout to get DHCP address | -1 |
### Balena
Refer to Balena [documentation](https://www.balena.io/docs/learn/develop/runtime/) 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
```bash
git clone git@bitbucket.org:samteccmd/samtecdeviceshare.git samtecdeviceshare
cd samtecdeviceshare
poetry install --dev
poetry shell
```
### Testing
First, run dummy Balena supervisor:
```bash
bash ./tests/dummy-supervisor.sh
```
Next, fire up REST server using uvicorn:
```bash
EMULATION=1 \
PYTHON_ENV="development" \
DEBUG=1 \
uvicorn samtecdeviceshare.server:app --reload --reload-dir ./samtecdeviceshare
```
**Interactive API docs** will be available: <http://127.0.0.1:8000/docs>
### Unit Tests
```bash
pylint --rcfile .pylintrc samtecdeviceshare
pytest
```
Raw data
{
"_id": null,
"home_page": "",
"name": "samtecdeviceshare",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Adam Page",
"author_email": "adam.page@samtec.com",
"download_url": "https://files.pythonhosted.org/packages/a4/73/19a25fef09b2c372dca81b8082a497238c18bb5d6b558d3c4fb7685e088f/samtecdeviceshare-2.9.1.tar.gz",
"platform": null,
"description": "# Samtec Device Connect Service\n\nA Python 3 SDC conforming REST API to run on IoT devices that enables user discovery, viewing, and management.\n\n## Installation\n\n```bash\npip install samtecdeviceshare\n```\n\n## Running\n\nFirst ensure all environment variables are set correctly.\nNote: To test locally for development ensure EMULATION and PYTHON_ENV are set.\n\n```bash\npython -m samtecdeviceshare.server\n```\n\n## Environment Variables\n\nA number of environment variables are supported for configuration. These configurations can also be contained in a yaml/json configuration file specified using `SDC_CONFIGURATION_PATH`. Env vars take precedence over the configuration file.\n\n### SDC Server / General\n\nThese variables are specific to this SDC service. The variables can also start with prefix `SDC_`.\n\n| Name | Description | Default |\n| ----------------- | ----------------------------- | ------------------------------------------- |\n| REST_ADDRESS | Rest API Address | 0.0.0.0 |\n| REST_PORT | Rest port | 47546 |\n| ROOT_PATH | API root path | '' |\n| PYTHON_ENV | enum: development production | production |\n| EMULATION | Use emulated devices/io | null |\n| LOG_VERBOSE | boolean verbose logs | false |\n\n### Application\n\nThese variables are used to provide app info that will be shared by SDC.\n\n| Name | Description | Default |\n| ----------------- | ----------------------------- | ------------------------------------------- |\n| APP_NAME | Name of app | SDC App |\n| APP_VERSION | SemVer of app | 0.0.0 |\n| APP_WEB_PORT | Embedded web app port | 80 |\n| APP_IMG_PATH | app icon path | {CURDIR}../static/img.png |\n| APP_LOG_PATH | Path to store log files | default tempdir() |\n| APP_LOCK_PATH | Path to update lock file | .__sdc.lock |\n\n### Wireless Networks\n\nSDC can handle configuring N wireless networks. Prefix *SDC_* is required. Us integer `i` in prefix for defining multiple networks.\nA network can optionally be defined default. This will be primary method used to handle updates and will be exposed through REST API.\n\n| Name | Description | Default |\n| ------------------------ | ----------------------------- | ------------------------------- |\n| SDC_WIFI[i]_SSID | WiFi SSID | null* |\n| SDC_WIFI[i]_MODE | enum: HOTSPOT CLIENT DISABLED | DISABLED |\n| SDC_WIFI[i]_PASS | WiFi passphrase | null |\n| SDC_WIFI[i]_IFACE | WiFi hardware interface | null |\n| SDC_WIFI[i]_DEFAULT | Use as default for updates | False |\n\n### Wired Networks\n\nSDC can handle configuring N wired networks. Prefix *SDC_* is required. Us integer `i` in prefix for defining multiple networks.\n`SDC_ETH[i]_IFACE` or `SDC_ETH[i]_REGEX_IFACE` is required with the latter supporting regex matching. Be careful defining multiple networks with generic regular expression.\n[Most Linux distros follow a predictable naming scheme for interfaces.](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-understanding_the_predictable_network_interface_device_names). When searching for interfaces, a fullmatch is required `re.fullmatch()`.\n\n| Name | Description | Default |\n| --------------------------- | ----------------------------- | ---------------------------- |\n| SDC_ETH[i]_IFACE | Interface name (str) | null |\n| SDC_ETH[i]_REGEX_IFACE | Interface name (regex) | null |\n| SDC_ETH[i]_METHOD | Primary method | WiredConnectionMethod.auto |\n| SDC_ETH[i]_TIMEOUT | Timeout of primary | 15 |\n| SDC_ETH[i]_FALLBACK | Fallback method | null |\n| SDC_ETH[i]_FALLBACK_TIMEOUT | Timeout to get DHCP address | -1 |\n\n### Balena\n\nRefer to Balena [documentation](https://www.balena.io/docs/learn/develop/runtime/) for list and description of variables.\n\n- BALENA_SUPERVISOR_API_KEY\n- BALENA_APP_ID\n- BALENA_DEVICE_TYPE\n- BALENA\n- BALENA_SUPERVISOR_ADDRESS\n- BALENA_SUPERVISOR_HOST\n- BALENA_DEVICE_UUID\n- BALENA_API_KEY\n- BALENA_APP_RELEASE\n- BALENA_SUPERVISOR_VERSION\n- BALENA_APP_NAME\n- BALENA_DEVICE_NAME_AT_INIT\n- BALENA_HOST_OS_VERSION\n- BALENA_SUPERVISOR_PORT\n\n## Development\n\n### Installing\n\n```bash\ngit clone git@bitbucket.org:samteccmd/samtecdeviceshare.git samtecdeviceshare\ncd samtecdeviceshare\npoetry install --dev\npoetry shell\n```\n\n### Testing\n\nFirst, run dummy Balena supervisor:\n\n```bash\nbash ./tests/dummy-supervisor.sh\n```\n\nNext, fire up REST server using uvicorn:\n\n```bash\nEMULATION=1 \\\nPYTHON_ENV=\"development\" \\\nDEBUG=1 \\\nuvicorn samtecdeviceshare.server:app --reload --reload-dir ./samtecdeviceshare\n```\n\n**Interactive API docs** will be available: <http://127.0.0.1:8000/docs>\n\n### Unit Tests\n\n```bash\npylint --rcfile .pylintrc samtecdeviceshare\npytest\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Handles a variety of common routines for SDC-based applications",
"version": "2.9.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "92604cf7f5254ea709e24815a08c3f939bbf08b843a183a79854969f8b5fa834",
"md5": "896869244332ba831612c8872c0ba964",
"sha256": "8756ccd6a1a915929bdfdc386ad4071aebfbcd6adb80acd520904ffb47bd7702"
},
"downloads": -1,
"filename": "samtecdeviceshare-2.9.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "896869244332ba831612c8872c0ba964",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 27902,
"upload_time": "2023-08-28T21:26:32",
"upload_time_iso_8601": "2023-08-28T21:26:32.387472Z",
"url": "https://files.pythonhosted.org/packages/92/60/4cf7f5254ea709e24815a08c3f939bbf08b843a183a79854969f8b5fa834/samtecdeviceshare-2.9.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a47319a25fef09b2c372dca81b8082a497238c18bb5d6b558d3c4fb7685e088f",
"md5": "d888e02f5234556d148e6760a0b51df5",
"sha256": "dc0fe2264296f4cf28f832cf95d1a2b52bd4258a68dd3abc3eab1924efe62704"
},
"downloads": -1,
"filename": "samtecdeviceshare-2.9.1.tar.gz",
"has_sig": false,
"md5_digest": "d888e02f5234556d148e6760a0b51df5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 23895,
"upload_time": "2023-08-28T21:26:33",
"upload_time_iso_8601": "2023-08-28T21:26:33.540256Z",
"url": "https://files.pythonhosted.org/packages/a4/73/19a25fef09b2c372dca81b8082a497238c18bb5d6b558d3c4fb7685e088f/samtecdeviceshare-2.9.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-28 21:26:33",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "samtecdeviceshare"
}