Skip to main content

pi-top Python SDK (Preview)

A simple, modular interface for interacting with a pi-top and its related accessories and components.

Supports all pi-top devices:

https://github.com/pi-top/pi-top-Python-SDK/raw/master/docs/_static/overview/devices.jpg

Supports pi-top Maker Architecture (PMA):

https://github.com/pi-top/pi-top-Python-SDK/raw/master/docs/_static/overview/pma.jpg

Supports all pi-top peripherals:

https://github.com/pi-top/pi-top-Python-SDK/raw/master/docs/_static/overview/peripherals.jpg

Status: Active Development

This SDK is currently in active development. Please be patient while we work towards v1.0.0!

Backwards Compatibility

When this library reaches v1.0.0, we will aim to maintain backwards-compatibility thereafter. Until then, every effort will be made to ensure stable support, but it cannot be guaranteed. Breaking changes will be clearly documented.

Build Status: Latest

GitHub Workflow Status GitHub tag (latest by date) GitHub release (latest by date) PyPI release Documentation Status

About

This SDK aims to provide an easy-to-use framework for managing a pi-top. It includes a Python 3 package (pitop), with several modules for interfacing with a range of pi-top devices and peripherals It also contains CLI utilities, to interact with your pi-top using the terminal.

The SDK is included out-of-the-box with pi-topOS.

Ensure that you keep your system up-to-date to enjoy the latest features and bug fixes.

This library is installed as a Python 3 module called pitop. It includes several submodules that allow you to easily interact with most of the hardware inside a pi-top.

You can easily connect different components of the system using the modules available in the library:

from time import sleep
from pitop.pma import UltrasonicSensor
from pitop.miniscreen import OLED

oled = OLED()
utrasonic = PMAUltrasonicSensor("D1")

while True:
    distance = utrasonic.distance
    oled.display_multiline_text(str(distance))
    sleep(0.1)

Check out the API Recipes chapter of the documentation for ideas on how to get started.

This repository also contains a ‘pi-top’ command-line interface (CLI) for some SDK functionality:

$ pi-top oled write "Hey! I'm a $(pt devices hub)"

A ‘pt’ alias is also provided for quicker typing:

$ pt oled write "Hey! I'm a $(pt devices hub)"

Check out the CLI chapter of the documentation for ideas on how to get started.

Installation

The pi-top Python SDK is installed out of the box with pi-topOS, which is available from pi-top.com. To install on Raspberry Pi OS or other operating systems, see the Getting Started chapter.

Documentation

Comprehensive documentation is available here.

Development

To make changes to the SDK you’ll want to install it from source with the documentation and test dependencies:

git clone https://github.com/pi-top/pi-top-Python-SDK.git
cd pi-top-Python-SDK
pip3 install -e ".[doc,test]"

Changes you make to the source will be reflected in your Python environment.

You may want to repeat this process for the pi-top-Python-Common-Library if it’s not installed already or you need to make changes there too.

Once the SDK is installed you can run the automated test suite with:

python3 -m pytest

And you can build the docs locally by running:

PYTHONPATH=. sphinx-build -W -v -bhtml docs/ build/html

To view the generated docs open the build/html/index.html file in your browser.

Most of the SDK requires pi-top hardware to work but it should be possible to run the tests and build documentation in any environment with Python3.

Contributing

Please refer to the Contributing document in this repository for information on contributing to the project.

See the contributors page on GitHub for more info on contributors.

Metadata

Release files for pitop 0.13.3

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

Source distribution (sdist)

Source distribution for pitop 0.13.3
File Size Uploaded Provenance
pitop-0.13.3.tar.gz 77.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pitop 0.13.3
File Interpreter ABI Platform
pitop-0.13.3-py3-none-any.whl Python 3 none any Details

Total release size: 180.4 kB

Release files / pitop-0.13.3.tar.gz

Download URL pitop-0.13.3.tar.gz
Size 77.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2d720a4691ab8f4fac8bf10701c81de6af7fe7dda95405f1d686eadd242f2011
BLAKE2b-256 checksum
How to use checksums
fc57e521c39cb68ed3890f771ec9427da6d61cd294b5a9bcdfc3564475cd2100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pitop-0.13.3-py3-none-any.whl

Download URL pitop-0.13.3-py3-none-any.whl
Size 103.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02b7f65664ca1037bc9a89cd644d42cb3741919052db83bac7e14003f10d508e
BLAKE2b-256 checksum
How to use checksums
6e152efcc5418061913a0b952a4ecb4a159152415fa19442ba3f10d2efd40c52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Security for pitop 0.13.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.13.3 This release

2 release files No provenance

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