Skip to main content

No project description provided

Project description

Balena SDK

The official balena SDK for python.

Role

The intention of this module is to provide developers a nice API to integrate their python applications with balena.

Installation

Install the balena SDK:

From Source:

https://github.com/balena-io/balena-sdk-python

From git:

pip install git+https://github.com/balena-io/balena-sdk-python.git

Example of installing on a Debian container:

FROM balenalib/amd64-debian:stretch

# Install python 3 and balena SDK dependencies.
RUN install_packages build-essential python3 python3-pip python3-setuptools \
    python3-dev libffi-dev libssl-dev

# Install balena python SDK in python 3.
RUN pip3 install balena-sdk

Example of installing on a Alpine Linux container:

FROM balenalib/amd64-alpine:3.9

# Install python 3 and balena SDK dependencies.
RUN install_packages build-base python3 py3-setuptools python3-dev libffi-dev openssl-dev

# Install balena python SDK in python 3.
RUN pip3 install balena-sdk

Platforms

We also support NodeJS SDK.

Basic Usage

>>> from balena import Balena
>>> balena = Balena()
>>> credentials = {'username':<your email>, 'password':<your password>}
>>> balena.auth.login(**credentials)
...

Documentation

We generate markdown documentation and automatically import it into our documentation.

To generate the documentation run:

python docs_generator.py > DOCUMENTATION.md

Deprecation policy

The balena SDK for Python uses semver versioning, with the concepts of major, minor and patch version releases.

The latest release of the previous major version of the balena SDK will remain compatible with the balenaCloud backend services for one year from the date when the next major version is released. For example, balena SDK v8.1.1, as the latest v8 release, would remain compatible with the balenaCloud backend for one year from the date when v9.0.0 is released.

At the end of this period, the older major version is considered deprecated and some of the functionality that depends on balenaCloud services may stop working at any time. Users are encouraged to regularly update the balena SDK to the latest version.

Developing locally

This project uses poetry for dependency management. In order to install all the needed dependencies please run poetry install.

Linting and Formatting

This project uses black for code formatting and flake8 for linting.

To format this project please use poetry run black . -l 120 To verify linting you can run poetry run flake8 --max-line-length=120

Tests

To run the tests, first create a .env file with your test user configuration, like below. Do not use credentials for users with active fleets, as the tests may be destructive.

[Credentials]
email=my_test_user+test_sdk@balena.io
user_id=my_test_user
password=123456my_password

[Member]
member_email=my_member_user+testsdk@balena.io
member_username=my_member_user
member_password=123456my_member_password

The [Member] section is required for membership tests. This should be a second test user that will be added to applications. The member must be manually added to the main test user's organization before running the tests. All emails must include +testsdk to avoid accidental deletion.

You can optionally change the target API endpoint too, e.g. api_endpoint=https://api.balena-cloud.com.

Then run poetry run python -m unittest discover tests -v. Use of poetry to run tests ensures use of its virtual environment.

Support

If you're having any problem, please raise an issue on GitHub and the balena team will be happy to help.

Contribute

License

The project is licensed under the MIT license.

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

balena_sdk-17.1.2.tar.gz (64.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

balena_sdk-17.1.2-py3-none-any.whl (75.9 kB view details)

Uploaded Python 3

File details

Details for the file balena_sdk-17.1.2.tar.gz.

File metadata

  • Download URL: balena_sdk-17.1.2.tar.gz
  • Upload date:
  • Size: 64.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.12.3 Linux/6.17.0-1015-azure

File hashes

Hashes for balena_sdk-17.1.2.tar.gz
Algorithm Hash digest
SHA256 696c263b1ea028c2b76a6daa5f972b83bc1481c35f79ea0c9736134448589b6d
MD5 646d13ae65403a0d96b65d4cad629e77
BLAKE2b-256 e4e0a4625f9e7a139994669c718069c95a63de1cb5c2f695676de83b823e5490

See more details on using hashes here.

File details

Details for the file balena_sdk-17.1.2-py3-none-any.whl.

File metadata

  • Download URL: balena_sdk-17.1.2-py3-none-any.whl
  • Upload date:
  • Size: 75.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.12.3 Linux/6.17.0-1015-azure

File hashes

Hashes for balena_sdk-17.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8403e2cefdb0cbe0bf03a1985818016fab49e9ba454ba16ad4295ca6c0d02a49
MD5 f0605b28dc0933a3fbfbcf6a66229667
BLAKE2b-256 520385acf6e23b31bc3740463569e513a0f0746b1b7c717330c6e6203ef75f70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page