Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[Makefile]
indent_style = tab

[*.{py,cfg,ini,toml,yaml,yml,md,sh}]
indent_style = space
indent_size = 4
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on:
pull_request:
push:
branches:
- master

permissions:
contents: read

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

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

steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
fetch-depth: 0 # the version comes from the git tag

- name: Set up uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
python-version: ${{ matrix.python }}

- name: Build Packages
run: |
uv run make build

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

on:
pull_request:
push:
branches:
- master

permissions:
contents: read

jobs:
test:
name: Install (Python ${{ matrix.python }})
runs-on: ubuntu-latest
env:
TERM: xterm-256color
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
fetch-depth: 0 # the version comes from the git tag

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

- name: Stub files & Patch install.sh
run: |
mkdir -p boot/firmware
touch boot/firmware/config.txt
sed -i "s|/boot/firmware|`pwd`/boot/firmware|g" install.sh

- name: Run install.sh
run: |
./install.sh --unstable --force
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish

# Trusted publishing, so PyPI trusts this workflow over OIDC and no API token is stored
# here. Configure it once at pypi.org/manage/project/plasmalights/settings/publishing/ with
# this repository, this filename and the `pypi` environment.
#
# Only plasmalights is published from here. The two fx packages are still built and
# uploaded by hand via `make deploy`.
on:
release:
types: [published]
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # for trusted publishing

steps:
- uses: actions/checkout@v7
with:
# The tag is the version, so the build has to be able to see it. A checkout of a
# tag has it at HEAD anyway; this covers a dispatch from a branch as well.
fetch-depth: 0

# setup-uv publishes no floating major tag past v6, only exact versions
- uses: astral-sh/setup-uv@v10.0.1
with:
version: "0.9.2"

- run: uv build

# A build that cannot see the tag produces 0.0.0.postN.devN+hash rather than failing,
# so what came out is checked against what was asked for. Skipped for a dispatch from
# a branch, where the ref is not a version at all.
- name: Check the built version is the tag
run: |
TAG="${GITHUB_REF_NAME#v}"
BUILT="$(ls dist/*.whl | head -1 | cut -d- -f2)"
echo "tag=$TAG built=$BUILT"
if [ "$GITHUB_REF_NAME" != "$TAG" ] && [ "$TAG" != "$BUILT" ]; then
echo "::error::built $BUILT from tag $TAG - check whether the checkout could"
echo "::error::see the tag at all"
exit 1
fi

- name: Publish
run: uv publish --trusted-publishing always
41 changes: 41 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: QA

on:
pull_request:
push:
branches:
- master

permissions:
contents: read

jobs:
test:
name: Linting & Spelling
runs-on: ubuntu-latest
env:
TERM: xterm-256color

steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
fetch-depth: 0 # the version comes from the git tag

- name: Set up uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
python-version: '3.11'

- name: Run Quality Assurance
run: |
uv run make qa

- name: Run Code Checks
run: |
uv run make check

- name: Run Pre-Commit
run: |
uv run pre-commit run --all-files
34 changes: 19 additions & 15 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

permissions:
contents: read

jobs:
test:
name: Test (Python ${{ matrix.python }})
runs-on: ubuntu-latest
env:
TERM: xterm-256color
strategy:
matrix:
python: [3.7, 3.9]
python: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
- name: Checkout Code
uses: actions/checkout@v7

- name: Set up uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
python-version: ${{ matrix.python }}
- name: Install Dependencies
run: |
python -m pip install --upgrade setuptools tox

- name: Run Tests
working-directory: library
run: |
tox -e py
uv run 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' }}

uvx coveralls --service=github
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ __pycache__
*.build
*.changes
*.orig.*
packaging/*tar.xz
library/debian/
.coverage
.tox/
.pytest_cache
.tox
.venv
.vscode/
.pytest_cache/
venv/
uv.lock
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
hooks:
- id: ruff-check
args: ['--fix']
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies: ['tomli']
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
12 changes: 11 additions & 1 deletion library/CHANGELOG.txt → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Changelog

3.0.1
-----

* Repackage to pyproject/hatchling
* Drop Python 3.7 and 3.8, add 3.12 and 3.13
* Fix GitHub URL to plasma-python
* plasmafx: replace pkg_resources with importlib.metadata
* Version now comes from the git tag; `plasma.__version__` reads package metadata

2.0.2
-----

Expand Down Expand Up @@ -31,4 +42,3 @@
-----

* Initial Release

Loading
Loading