pi-top Python SDK
Project description
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:
Supports pi-top Maker Architecture (PMA):
Supports all pi-top peripherals:
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.
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 import UltrasonicSensor
from pitop import Pitop
pitop = Pitop()
utrasonic = UltrasonicSensor("D1")
while True:
pitop.miniscreen.display_text(utrasonic.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.
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.
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
Built Distribution
File details
Details for the file pitop-0.21.0.tar.gz
.
File metadata
- Download URL: pitop-0.21.0.tar.gz
- Upload date:
- Size: 291.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77481837726bb8d78884686a774e418f6934c977789649b953226d60044f2075 |
|
MD5 | beafb4ac4ea4eb8eda4e3dbb14a24ba1 |
|
BLAKE2b-256 | 548b6134b13d3498521f2def46c1f62eb0194f05e1cc74722c44713f1d4e3722 |
File details
Details for the file pitop-0.21.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pitop-0.21.0-py2.py3-none-any.whl
- Upload date:
- Size: 368.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6b7332bc19aa6ad0268978aa6bb0d2787f588643cf556f9f2521581119c9fb |
|
MD5 | b66f93d97e39248e2d8300542ef1f5f6 |
|
BLAKE2b-256 | 0016e67cf3e07aa400c2fb0fce39b3d43ef928fd8dd676ff06ec8aebd782efff |