Skip to main content

MicroPython PyPi package template project with auto deploy

Project description

MicroPython package template

Downloads Release Python License: MIT codecov

MicroPython PyPi package template project with auto deploy


General

MicroPython PyPi package template with GitHub Action based testing and deploy

Installation

Install required tools

Python3 must be installed on your system. Check the current Python version with the following command

python --version
python3 --version

Depending on which command Python 3.x.y (with x.y as some numbers) is returned, use that command to proceed.

python3 -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

Setup

Install package with upip

Connect the MicroPython device to a network (if possible)

import network
station = network.WLAN(network.STA_IF)
station.connect('SSID', 'PASSWORD')
station.isconnected()

and install this lib on the MicroPython device like this

import upip
upip.install('micropython-package-template')

Manually

Upload files to board

Copy the module to the MicroPython board and import them as shown below using Remote MicroPython shell

Open the remote shell with the following command. Additionally use -b 115200 in case no CP210x is used but a CH34x.

rshell --port /dev/tty.SLAB_USBtoUART --editor nano

Perform the following command inside the rshell to copy all files and folders to the device

mkdir /pyboard/lib
mkdir /pyboard/lib/be_upy_blink

cp be_upy_blink/* /pyboard/lib/be_upy_blink

cp examples/main.py /pyboard
cp examples/boot.py /pyboard

Usage

from be_upy_blink import flash_led
from machine import Pin

led_pin = Pin(4, Pin.OUT)

flash_led(pin=led_pin, amount=3)
# flash_led(pin=led_pin, amount=3, on_time=1, off_time=3)

Contributing

Unittests

Run the unittests locally with the following command after installing this package in a virtual environment

# run all tests
nose2 --config tests/unittest.cfg

# run only one specific tests
nose2 tests.test_blink.TestBlink.test_flash_led

Generate the coverage files with

python create_report_dirs.py
coverage html

The coverage report is placed at reports/coverage/html/index.html

Credits

Based on the PyPa sample project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropython-package-template-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file micropython-package-template-0.1.1.tar.gz.

File metadata

File hashes

Hashes for micropython-package-template-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b085bb9aadd4d7fd99418e9b6add27d6e0467148350f42846c461ae41e530cd6
MD5 4a8b38e4b1b3f4c06cecc023627623b4
BLAKE2b-256 fccc051df3444766b774d4cfa8a300eebd5701610f526eaa77d24425a8526a43

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