The SparkFun qwiic python package aggregates all python qwiic drivers/modules to provide a single entity for qwiic within a python environment. The qwiic package delivers the high-level functionality needed to dynamically discover connected qwiic devices and construct their associated driver object.
New to qwiic? Take a look at the entire SparkFun qwiic ecosystem.
The qwiic Python package current supports the following platforms:
Each qwiic board has an independent driver library that implements the required logic for the specific board. This driver implementation is structured as a python package that supports standard python package management operations and tools. Additionally, each driver is deployed in a distinct GitHub repository which provides a central area for package management and development.
To provide dynamic discovery and instantiation capabilities, the qwiic package imports all the underlying qwiic driver packages at runtime. As such the qwiic driver packages must be installed prior to using this package. These packages can be installed manually, or the overall package will install them automatically when using a PyPi based package manger (aka pip).
To make development and evaluation easer, the modules this package is dependent on are included in this repository as git submodules. This allows rapid checkout and access to the entire qwiic python ecosystem if needed.
This structure has the following layout:
Qwiic_Py/ | +--- qwiic_i2c/ --> Link to the qwiic_i2c submodule repository | |--- __index__.py | `--- ... The cross platform I2C bus access driver | +--- qwiic/ | |--- __index__.py | +--- ... Package Implementation | `--- drivers/ | |--- qwiic_bme280 --> The qwiic_bme280 submodule | |--- qwiic_micro_oled --> The qwiic_micro_oled submodule | `--- ... links to qwiic driver submodule repositories | +--- README.md +--- setup.py `--- ...etc
The qwiic package depends on the qwiic I2C driver: Qwiic_I2C_Py
This package is also dependent on the driver packages contained in the drivers directory.
To clone this repository, a standard git clone command will create a local copy of this repository:
git clone https://github.com/sparkfun/Qwiic_Py
This will create a local version of this repository, but the submodule directories (drivers/*, and qwiic_i2c/ ) will be empty. To clone the git repository and include the submodule contents, use the following command:
git clone --recurse-submodules https://github.com/sparkfun/Qwiic_Py.git
This repository is hosted on PyPi as the sparkfun-qwiic package. On systems that support PyPi installation via pip, this package is installed using the following commands For all users (note: the user must have sudo privileges):
sudo pip install sparkfun-qwiic
For the current user:
pip install sparkfun-qwiic
This process will also install all modules the qwiic package requires for operation, including the needed qwiic driver packages.
To install, make sure the setuptools package is installed on the system.
Direct installation at the command line:
python setup.py install
To build a package for use with pip:
python setup.py sdist
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
cd dist pip install sparkfun_qwiic_-<version>.tar.gz