Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit e71a141

Browse files
authored
Merge pull request #3 from rhooper/master
Implement adafruit_pypixelbuf necessary for neopixel and dotstar without _pixelbuf
2 parents be8c4e6 + b5465ad commit e71a141

File tree

14 files changed

+214
-164
lines changed

14 files changed

+214
-164
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build CI
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Dump GitHub context
10+
env:
11+
GITHUB_CONTEXT: ${{ toJson(github) }}
12+
run: echo "$GITHUB_CONTEXT"
13+
- name: Translate Repo Name For Build Tools filename_prefix
14+
id: repo-name
15+
run: |
16+
echo ::set-output name=repo-name::$(
17+
echo ${{ github.repository }} |
18+
awk -F '\/' '{ print tolower($2) }' |
19+
tr '_' '-'
20+
)
21+
- name: Set up Python 3.6
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: 3.6
25+
- name: Versions
26+
run: |
27+
python3 --version
28+
- name: Checkout Current Repo
29+
uses: actions/checkout@v1
30+
with:
31+
submodules: true
32+
- name: Checkout tools repo
33+
uses: actions/checkout@v2
34+
with:
35+
repository: adafruit/actions-ci-circuitpython-libs
36+
path: actions-ci
37+
- name: Install deps
38+
run: |
39+
source actions-ci/install.sh
40+
- name: Library version
41+
run: git describe --dirty --always --tags
42+
- name: PyLint
43+
run: |
44+
pylint $( find . -path './adafruit*.py' )
45+
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
46+
- name: Build assets
47+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
48+
- name: Build docs
49+
working-directory: docs
50+
run: sphinx-build -E -W -b html . _build/html

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release Actions
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
upload-release-assets:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Dump GitHub context
12+
env:
13+
GITHUB_CONTEXT: ${{ toJson(github) }}
14+
run: echo "$GITHUB_CONTEXT"
15+
- name: Translate Repo Name For Build Tools filename_prefix
16+
id: repo-name
17+
run: |
18+
echo ::set-output name=repo-name::$(
19+
echo ${{ github.repository }} |
20+
awk -F '\/' '{ print tolower($2) }' |
21+
tr '_' '-'
22+
)
23+
- name: Set up Python 3.6
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: 3.6
27+
- name: Versions
28+
run: |
29+
python3 --version
30+
- name: Checkout Current Repo
31+
uses: actions/checkout@v1
32+
with:
33+
submodules: true
34+
- name: Checkout tools repo
35+
uses: actions/checkout@v2
36+
with:
37+
repository: adafruit/actions-ci-circuitpython-libs
38+
path: actions-ci
39+
- name: Install deps
40+
run: |
41+
source actions-ci/install.sh
42+
- name: Build assets
43+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
44+
- name: Upload Release Assets
45+
# the 'official' actions version does not yet support dynamically
46+
# supplying asset names to upload. @csexton's version chosen based on
47+
# discussion in the issue below, as its the simplest to implement and
48+
# allows for selecting files with a pattern.
49+
# https://github.com/actions/upload-release-asset/issues/4
50+
#uses: actions/[email protected]
51+
uses: csexton/release-asset-action@master
52+
with:
53+
pattern: "bundles/*"
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
upload-pypi:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v1
60+
- name: Check For setup.py
61+
id: need-pypi
62+
run: |
63+
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
64+
- name: Set up Python
65+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
66+
uses: actions/setup-python@v1
67+
with:
68+
python-version: '3.x'
69+
- name: Install dependencies
70+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
71+
run: |
72+
python -m pip install --upgrade pip
73+
pip install setuptools wheel twine
74+
- name: Build and publish
75+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
76+
env:
77+
TWINE_USERNAME: ${{ secrets.pypi_username }}
78+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
79+
run: |
80+
python setup.py sdist
81+
twine upload dist/*

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ __pycache__
44
_build
55
*.pyc
66
.env
7-
build*
87
bundles
98
*.DS_Store
109
.eggs
1110
dist
12-
**/*.egg-info
11+
**/*.egg-info
12+
.vscode

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

3-
Based on the Adafruit NeoPixel and Adafruit DotStar CircuitPython drivers.
4-
Copyright (c) 2019 Roy Hooper
3+
Based on the Adafruit NeoPixel and Adafruit DotStar CircuitPython libraries.
4+
Copyright (c) 2019-2020 Roy Hooper
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Introduction
99
:target: https://discord.gg/nBQh6qu
1010
:alt: Discord
1111

12-
.. image:: https://travis-ci.com/adafruit/Adafruit_CircuitPython_Pypixelbuf.svg?branch=master
13-
:target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_Pypixelbuf
12+
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf/workflows/Build%20CI/badge.svg
13+
:target: https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf/actions
1414
:alt: Build Status
1515

1616
Pure python implementation of _pixelbuf for smaller boards.
@@ -24,7 +24,7 @@ This driver depends on:
2424

2525
Please ensure all dependencies are available on the CircuitPython filesystem.
2626
This is easily achieved by downloading
27-
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
27+
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
2828

2929
Installing from PyPI
3030
=====================
@@ -58,22 +58,16 @@ This example tests that the pypixelbuf works.
5858

5959
.. code-block:: python
6060
61-
import pypixelbuf
61+
class TestBuf(adafruit_pypixelbuf.PixelBuf):
62+
called = False
6263
63-
callback_called = False
64+
def show(self):
65+
self.called = True
6466
6567
66-
def callback():
67-
global callback_called
68-
callback_called = True
69-
70-
71-
buffer = pypixelbuf.PixelBuf(20, bytearray(20 * 3), pypixelbuf.RGB, 1.0, auto_write=True, write_function=callback)
72-
68+
buffer = TestBuf(20, bytearray(20 * 3), "RGB", 1.0, auto_write=True)
7369
buffer[0] = (1, 2, 3)
7470
75-
print(callback_called)
76-
7771
7872
Contributing
7973
============

0 commit comments

Comments
 (0)