Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookworm/Pi5 Compatibility: Upgrade to latest boilerplate #102

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7f544f1
Repackage and focus on Python only code.
Gadgetoid Oct 31, 2023
748299e
Examples: switch from apt to pip install.
Gadgetoid Oct 31, 2023
1411204
Restore clear on exit.
Gadgetoid Oct 31, 2023
89f346b
QA: Apply isort suggestions.
Gadgetoid Oct 31, 2023
68f0953
QA: Apply ruff suggestion.
Gadgetoid Oct 31, 2023
256fdcd
README.md: add link to unofficial web-based simulator for examples wr…
simoesh Oct 31, 2023
6610f06
CI: Update workflows, eek.
Gadgetoid Oct 31, 2023
c8506c9
Remove rogue .coveragerc.
Gadgetoid Oct 31, 2023
e79775a
Search for common gpiochip device names.
Gadgetoid Oct 31, 2023
bcf2a6b
Friendly errors when pins are claimed.
Gadgetoid Oct 31, 2023
7b6d50e
Tests: Fix to catch runtime error due to missing gpiochip.
Gadgetoid Oct 31, 2023
479fd1b
Handle more gpiochip error cases.
Gadgetoid Nov 1, 2023
7747e43
Fix error output.
Gadgetoid Nov 1, 2023
a44e9d1
Use gpiodevice to find pins.
Gadgetoid Nov 1, 2023
2eff9ba
Update to latest gpiodevice lib.
Gadgetoid Nov 1, 2023
18e5eb9
Fix Pi 5 pins.
Gadgetoid Nov 1, 2023
d9245a8
Do not explicitly release gpio lines.
Gadgetoid Nov 2, 2023
bad87d1
Try to set up pins using gpiodevice before falling back.
Gadgetoid Nov 2, 2023
16d2fcd
Fix import sorting.
Gadgetoid Nov 2, 2023
d234a1e
Require gpiodevice >= 0.0.2
Gadgetoid Nov 2, 2023
c6fcf62
Remove unused glob import.
Gadgetoid Nov 2, 2023
9d2b4c8
Fix test to pass locally.
Gadgetoid Nov 2, 2023
8134ffa
install.sh: rework for better error reporting and fix some bugs.
Gadgetoid Nov 23, 2023
402ff25
Shakeup examples and fix README links.
Gadgetoid Nov 23, 2023
d957c4a
Sync to latest boilerplate.
Gadgetoid Feb 13, 2024
8452998
Simplify GPIO pin setup.
Gadgetoid Jun 3, 2024
a2dc729
CI: Fix tests.
Gadgetoid Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/.coveragerc → .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[run]
source = blinkt
omit =
.tox/*
tests/
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build

on:
pull_request:
push:
branches:
- main

jobs:
test:
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.9', '3.10', '3.11']

env:
RELEASE_FILE: ${{ github.event.repository.name }}-${{ github.event.release.tag_name || github.sha }}-py${{ matrix.python }}

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Dependencies
run: |
make dev-deps

- name: Build Packages
run: |
make build

- name: Upload Packages
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_FILE }}
path: dist/
39 changes: 39 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: QA

on:
pull_request:
push:
branches:
- main

jobs:
test:
name: linting & spelling
runs-on: ubuntu-latest
env:
TERM: xterm-256color

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python '3,11'
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Dependencies
run: |
make dev-deps

- name: Run Quality Assurance
run: |
make qa

- name: Run Code Checks
run: |
make check

- name: Run Bash Code Checks
run: |
make shellcheck
24 changes: 14 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: Python Tests
name: Tests

on:
pull_request:
push:
branches:
- master
- main

jobs:
test:
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: [2.7, 3.5, 3.7, 3.9]
python: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Dependencies
run: |
python -m pip install --upgrade setuptools tox
make dev-deps

- name: Run Tests
working-directory: library
run: |
tox -e py
make pytest

- name: Coverage
if: ${{ matrix.python == '3.9' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: library
run: |
python -m pip install coveralls
coveralls --service=github
if: ${{ matrix.python == '3.9' }}

File renamed without changes.
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

63 changes: 63 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
LIBRARY_NAME := $(shell hatch project metadata name 2> /dev/null)
LIBRARY_VERSION := $(shell hatch version 2> /dev/null)

.PHONY: usage install uninstall check pytest qa build-deps check tag wheel sdist clean dist testdeploy deploy
usage:
ifdef LIBRARY_NAME
@echo "Library: ${LIBRARY_NAME}"
@echo "Version: ${LIBRARY_VERSION}\n"
else
@echo "WARNING: You should 'make dev-deps'\n"
endif
@echo "Usage: make <target>, where target is one of:\n"
@echo "install: install the library locally from source"
@echo "uninstall: uninstall the local library"
@echo "dev-deps: install Python dev dependencies"
@echo "check: perform basic integrity checks on the codebase"
@echo "qa: run linting and package QA"
@echo "pytest: run Python test fixtures"
@echo "clean: clean Python build and dist directories"
@echo "build: build Python distribution files"
@echo "testdeploy: build and upload to test PyPi"
@echo "deploy: build and upload to PyPi"
@echo "tag: tag the repository with the current version\n"

install:
./install.sh --unstable

uninstall:
./uninstall.sh

dev-deps:
python3 -m pip install -r requirements-dev.txt
sudo apt install dos2unix shellcheck

check:
@bash check.sh

shellcheck:
shellcheck *.sh

qa:
tox -e qa

pytest:
tox -e py

nopost:
@bash check.sh --nopost

tag:
git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"

build: check
@hatch build

clean:
-rm -r dist

testdeploy: build
twine upload --repository testpypi dist/*

deploy: nopost build
twine upload dist/*
155 changes: 66 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,66 @@
![Blinkt!](blinkt-logo.png)

[![Build Status](https://travis-ci.com/pimoroni/blinkt.svg?branch=master)](https://travis-ci.com/pimoroni/blinkt)
[![Coverage Status](https://coveralls.io/repos/github/pimoroni/blinkt/badge.svg?branch=master)](https://coveralls.io/github/pimoroni/blinkt?branch=master)
[![PyPi Package](https://img.shields.io/pypi/v/blinkt.svg)](https://pypi.python.org/pypi/blinkt)
[![Python Versions](https://img.shields.io/pypi/pyversions/blinkt.svg)](https://pypi.python.org/pypi/blinkt)

https://shop.pimoroni.com/products/blinkt

Eight super-bright RGB LED indicators, ideal for adding visual notifications to your Raspberry Pi on their own or on a pHAT stacking header.

## Installing

### Full install (recommended):

We've created an easy installation script that will install all pre-requisites and get your Blinkt!
up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal
on your Raspberry Pi desktop, as illustrated below:

![Finding the terminal](http://get.pimoroni.com/resources/github-repo-terminal.png)

In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:

```bash
curl https://get.pimoroni.com/blinkt | bash
```

Alternatively, on Raspbian, you can download the `pimoroni-dashboard` and install your product by browsing to the relevant entry:

```bash
sudo apt-get install pimoroni
```
(you will find the Dashboard under 'Accessories' too, in the Pi menu - or just run `pimoroni-dashboard` at the command line)

If you choose to download examples you'll find them in `/home/pi/Pimoroni/blinkt/`.

### Manual install:

#### Library install for Python 3:

on Raspbian:

```bash
sudo apt-get install python3-blinkt
```

other environments:

```bash
sudo pip3 install blinkt
```

#### Library install for Python 2:

on Raspbian:

```bash
sudo apt-get install python-blinkt
```

other environments:

```bash
sudo pip2 install blinkt
```

### Development:

If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, `cd` to the library directory, and run:

```bash
sudo python3 setup.py install
```
(or `sudo python setup.py install` whichever your primary Python environment may be)

## Documentation & Support

* Guides and tutorials - https://learn.pimoroni.com/blinkt
* Function reference - http://docs.pimoroni.com/blinkt/
* GPIO Pinout - https://pinout.xyz/pinout/blinkt
* Get help - http://forums.pimoroni.com/c/support

## Unofficial / Third-party libraries

* Golang library & examples by [Alex Ellis](https://www.alexellis.io) - https://github.com/alexellis/blinkt_go, https://github.com/alexellis/blinkt_go_examples
* Java library by Jim Darby - https://github.com/hackerjimbo/PiJava
* Java library by @HoldYourWaffle - https://github.com/HoldYourWaffle/blinkt4j
* Node.js library by @irrelon - https://github.com/irrelon/node-blinkt
* Rust library by @golemparts - https://github.com/golemparts/blinkt
![Blinkt!](blinkt-logo.png)

[![Build Status](https://img.shields.io/github/actions/workflow/status/pimoroni/blinkt/test.yml?branch=main)](https://github.com/pimoroni/blinkt/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/pimoroni/blinkt/badge.svg?branch=master)](https://coveralls.io/github/pimoroni/blinkt?branch=master)
[![PyPi Package](https://img.shields.io/pypi/v/blinkt.svg)](https://pypi.python.org/pypi/blinkt)
[![Python Versions](https://img.shields.io/pypi/pyversions/blinkt.svg)](https://pypi.python.org/pypi/blinkt)

https://shop.pimoroni.com/products/blinkt

Eight super-bright RGB LED indicators, ideal for adding visual notifications to your Raspberry Pi on their own or on a pHAT stacking header.

## Installing

### Full install (recommended):

We've created an easy installation script that will install all pre-requisites and get your Blinkt!
up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal
on your Raspberry Pi desktop, as illustrated below:

![Finding the terminal](http://get.pimoroni.com/resources/github-repo-terminal.png)

In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:

```bash
git clone https://github.com/pimoroni/blinkt
cd blinkt
./install.sh
```

### Manual install:

```bash
python3 -m pip install blinkt
```
### Development:

If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, `cd` to the library directory, and run:

```bash
make dev-deps
make build
```

To run QA and tests, use:

```bash
make check
make qa
make pytest
```

## Documentation & Support

* Guides and tutorials - https://learn.pimoroni.com/blinkt
* Function reference - http://docs.pimoroni.com/blinkt/
* GPIO Pinout - https://pinout.xyz/pinout/blinkt
* Get help - http://forums.pimoroni.com/c/support

## Unofficial / Third-party libraries

* Golang library & examples by [Alex Ellis](https://www.alexellis.io) - https://github.com/alexellis/blinkt_go, https://github.com/alexellis/blinkt_go_examples
* Java library by Jim Darby - https://github.com/hackerjimbo/PiJava
* Java library by @HoldYourWaffle - https://github.com/HoldYourWaffle/blinkt4j
* Node.js library by @irrelon - https://github.com/irrelon/node-blinkt
* Rust library by @golemparts - https://github.com/golemparts/blinkt
* Web-based Prequel simulator by Hugo Simoes - https://prequel-lang.org/examples/blinkp/
Loading
Loading