Skip to content
Open
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
58 changes: 34 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,32 @@ permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v5
with:
enable-cache: false
- name: Ruff lint
run: uvx ruff@0.15.10 check
- name: Ruff format
run: uvx ruff@0.15.10 format --check
- name: Type check (ty)
run: uvx --with ipython ty@0.0.30 check

linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
- runner: ubuntu-24.04-arm
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Build wheels
Expand All @@ -48,6 +54,10 @@ jobs:
args: --release --out dist --find-interpreter
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto
before-script-linux: |
if command -v yum >/dev/null; then yum install -y systemd-devel; fi
if command -v apt-get >/dev/null; then apt-get update && apt-get install -y libudev-dev; fi
if command -v apk >/dev/null; then apk add --no-cache eudev-dev; fi
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -61,15 +71,11 @@ jobs:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
- runner: ubuntu-24.04-arm
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Build wheels
Expand All @@ -79,6 +85,10 @@ jobs:
args: --release --out dist --find-interpreter
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: musllinux_1_2
before-script-linux: |
if command -v yum >/dev/null; then yum install -y systemd-devel; fi
if command -v apt-get >/dev/null; then apt-get update && apt-get install -y libudev-dev; fi
if command -v apk >/dev/null; then apk add --no-cache eudev-dev; fi
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand All @@ -95,8 +105,8 @@ jobs:
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
Expand All @@ -122,8 +132,8 @@ jobs:
- runner: macos-latest
target: x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Build wheels
Expand All @@ -141,7 +151,7 @@ jobs:
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
Expand All @@ -157,7 +167,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, windows, macos, sdist]
needs: [lint, linux, musllinux, windows, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
Expand Down
3 changes: 2 additions & 1 deletion examples/tl-meta.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python3

import pprint

import twinleaf

dev = twinleaf.Device()

meta = dev._get_metadata()
import pprint
pp = pprint.PrettyPrinter(indent=1)
pp.pprint(meta)
9 changes: 4 additions & 5 deletions examples/tl-samples.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env python3

import twinleaf
import pprint

dev = twinleaf.Device()

samples_dict_getter = dev.samples # All samples
samples_list_getter = dev.samples.imu.imu.accel # Wildcard samples
#samples_list_getter = dev.samples.imu.imu.accel.x # Specific column
samples_dict_getter = dev.samples # All samples
samples_list_getter = dev.samples.imu.imu.accel # Wildcard samples
# samples_list_getter = dev.samples.imu.imu.accel.x # Specific column

samples_dict = samples_dict_getter(n=10)
for _id, stream in samples_dict.items():
Expand All @@ -19,5 +18,5 @@
samples_list = samples_list_getter(n=10)
for sample in samples_list:
for column in sample:
print(f"{column:<20}", end='')
print(f"{column:<20}", end="")
print()
3 changes: 2 additions & 1 deletion examples/tl-settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python3

import pprint

import twinleaf

dev = twinleaf.Device()

settings = dev.settings()
import pprint
pp = pprint.PrettyPrinter(indent=1)
pp.pprint(settings)
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ build-backend = "maturin"
features = ["pyo3/extension-module"]
module-name = "twinleaf._twinleaf"
python-source = "python"

[tool.ruff]
target-version = "py312"

[tool.ty.environment]
python-version = "3.12"

[tool.ty.src]
exclude = ["examples"]
Loading
Loading