Skip to main content

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.

Metadata

Release files for balena-sdk 17.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for balena-sdk 17.3.0
File Size Uploaded
balena_sdk-17.3.0.tar.gz 68.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for balena-sdk 17.3.0
File Interpreter ABI Platform
balena_sdk-17.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 149.8 kB

Release files / balena_sdk-17.3.0.tar.gz

Download URL balena_sdk-17.3.0.tar.gz
Size 68.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2e4d1d0839c93bc2de652e0cacb5766ff247e5693fcb1bfd5245b89b0cffb937
BLAKE2b-256 checksum
How to use checksums
adc087bcff1179b5f8823ad82027b494ed81e64da8d13a20dcea13ee058a1a1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.12.3 Linux/6.17.0-1018-azure

Release files / balena_sdk-17.3.0-py3-none-any.whl

Download URL balena_sdk-17.3.0-py3-none-any.whl
Size 81.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56393a16a46f9de6defa1fb25c80733459c6a11c1b55b424eabc437bdf39586e
BLAKE2b-256 checksum
How to use checksums
605788858ddebcc830b535883fbe7a2471245b7456a9e46ff8dbd6704adc775a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.12.3 Linux/6.17.0-1018-azure

Release history Release notifications | RSS feed

This release

17.3.0 This release

2 release files

17.2.0

2 release files

17.1.1

2 release files

17.1.0

2 release files

17.0.2

2 release files

17.0.0

2 release files

16.0.0

2 release files

15.1.4

2 release files

15.1.3

2 release files

15.1.2

2 release files

15.1.1

2 release files

15.1.0

2 release files

15.0.4

2 release files

15.0.3

2 release files

15.0.2

2 release files

15.0.1

2 release files

15.0.0

2 release files

14.5.0

2 release files

14.4.6

2 release files

14.4.4

2 release files

14.4.3

2 release files

14.4.2

2 release files

14.4.1

2 release files

14.4.0

2 release files

14.2.0

2 release files

14.1.0

2 release files

14.0.0

2 release files

13.3.0

2 release files

13.2.0

2 release files

13.1.0

2 release files

13.0.4

2 release files

13.0.0

2 release files

12.7.0

2 release files

12.5.0

1 release file

12.4.0

1 release file

12.3.1

1 release file

12.3.0

1 release file

12.2.0

1 release file

12.1.0

1 release file

12.0.0

1 release file

11.11.3

1 release file

11.5.0

1 release file

11.4.0

1 release file

11.3.2

1 release file

11.3.1

1 release file

11.2.0

1 release file

11.1.1

1 release file

11.1.0

1 release file

11.0.3

1 release file

11.0.0

1 release file

10.6.0

1 release file

10.5.0

1 release file

10.4.0

1 release file

10.3.0

1 release file

10.2.2

1 release file

10.2.0

1 release file

10.1.1

1 release file

10.1.0

1 release file

10.0.0

1 release file

9.5.0

1 release file

9.4.1

1 release file

9.3.0

1 release file

9.2.0

1 release file

9.0.0

1 release file

8.1.1

1 release file

8.1.0

1 release file

8.0.0

1 release file

7.9.0

1 release file

7.8.0

1 release file

7.7.2

1 release file

7.7.0

1 release file

7.6.0

1 release file

7.3.0

1 release file

7.2.0

1 release file

7.1.0

1 release file

7.0.0

1 release file

6.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page