Skip to content

Commit 05f5c67

Browse files
authored
Merge pull request #4 from LC-Linkous/polish_and_test
Polish and test
2 parents 1f605e6 + a443428 commit 05f5c67

31 files changed

Lines changed: 2480 additions & 403 deletions
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Bug report
2+
description: Something isn't working as documented
3+
labels: ["bug"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for the report. This library talks to real hardware over serial,
9+
so please include device and OS details — many issues are
10+
firmware- or environment-specific.
11+
12+
For questions about **device behavior** (not this library), the
13+
[official tinySA wiki](https://tinysa.org/wiki/) and the tinySA
14+
community at groups.io are the right places — they do not support this
15+
library, and library issues belong here, not there.
16+
- type: textarea
17+
id: what-happened
18+
attributes:
19+
label: What happened
20+
description: What did you expect, and what happened instead?
21+
validations:
22+
required: true
23+
- type: textarea
24+
id: repro
25+
attributes:
26+
label: Steps to reproduce
27+
description: The exact minimal code. Include the command string the library sent if you have it (set_verbose(True) output helps).
28+
render: python
29+
validations:
30+
required: true
31+
- type: input
32+
id: os
33+
attributes:
34+
label: Operating system
35+
placeholder: "e.g. Windows 11 23H2 / Ubuntu 24.04 / macOS 14"
36+
validations:
37+
required: true
38+
- type: input
39+
id: python
40+
attributes:
41+
label: Python version
42+
placeholder: "output of: python --version"
43+
validations:
44+
required: true
45+
- type: input
46+
id: tsapython
47+
attributes:
48+
label: tsapython version
49+
placeholder: "output of: pip show tsapython | grep Version (or 'local build from <commit>')"
50+
validations:
51+
required: true
52+
- type: dropdown
53+
id: device
54+
attributes:
55+
label: Device model
56+
options:
57+
- tinySA (Basic)
58+
- tinySA Ultra
59+
- tinySA Ultra+
60+
- "No device connected (reproduces without hardware)"
61+
- Other / not sure
62+
validations:
63+
required: true
64+
- type: textarea
65+
id: firmware
66+
attributes:
67+
label: Device firmware / info
68+
description: Paste the output of `tsa.info()` if a device is involved (redact the serial if you wish).
69+
render: shell
70+
validations:
71+
required: false
72+
- type: textarea
73+
id: logs
74+
attributes:
75+
label: Logs / traceback
76+
description: Full traceback or output. Run with `set_verbose(True)` and `set_error_byte_return(True)` if possible.
77+
render: shell

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Official tinySA documentation
4+
url: https://tinysa.org/wiki/
5+
about: Authoritative reference for device behavior, valid ranges, and safe operation. Check here first.
6+
- name: tinySA community (groups.io)
7+
url: https://groups.io/g/tinysa
8+
about: Device-usage questions belong here. Note they do NOT support this library — library issues stay on this repo.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Feature request
2+
description: Suggest a new capability or improvement
3+
labels: ["enhancement"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Before filing: this is deliberately a **non-GUI** API. GUI features are
9+
out of scope. New device commands are in scope — note that the
10+
`command()` function already provides raw access to any serial command,
11+
so a request for a wrapped method is a request for validation, parsing,
12+
and documentation around it.
13+
- type: textarea
14+
id: problem
15+
attributes:
16+
label: Problem / use case
17+
description: What are you trying to do that the library doesn't currently support?
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: proposal
22+
attributes:
23+
label: Proposed solution
24+
description: What would the method / behavior look like? A sketch of the signature is helpful.
25+
validations:
26+
required: false
27+
- type: dropdown
28+
id: area
29+
attributes:
30+
label: Area
31+
options:
32+
- Acquisition (scan / sweep / data)
33+
- Markers / traces
34+
- Levels / gain
35+
- Output / signal generator
36+
- Calibration
37+
- Display / UI commands
38+
- Presets / config
39+
- System info / connection / autodetect
40+
- Docs / examples
41+
- Other
42+
validations:
43+
required: true
44+
- type: dropdown
45+
id: devices
46+
attributes:
47+
label: Which device(s) does this apply to?
48+
options:
49+
- All tinySA models
50+
- tinySA (Basic)
51+
- tinySA Ultra
52+
- tinySA Ultra+
53+
- Not sure
54+
validations:
55+
required: false
56+
- type: textarea
57+
id: alternatives
58+
attributes:
59+
label: Alternatives considered
60+
description: Existing workarounds, or why the raw `command()` passthrough doesn't cover it.
61+
validations:
62+
required: false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Question / usage help
2+
description: How do I use this library to do something?
3+
labels: ["question"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
For questions about **this library** (tsapython). Questions about the
9+
tinySA device itself are better answered by the
10+
[official wiki](https://tinysa.org/wiki/) and the
11+
[tinySA community](https://groups.io/g/tinysa) — they know the hardware
12+
far better, but do not support this library.
13+
- type: textarea
14+
id: question
15+
attributes:
16+
label: What are you trying to do?
17+
description: The goal, plus what you've tried so far (code welcome).
18+
validations:
19+
required: true
20+
- type: input
21+
id: setup
22+
attributes:
23+
label: Setup
24+
placeholder: "e.g. tinySA Ultra, Windows 11, Python 3.12, tsapython 3.0.0"
25+
validations:
26+
required: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!-- Thanks for contributing to tinySA_python. Keep PRs focused: one logical change. -->
2+
3+
## Summary
4+
5+
<!-- What does this change and why? Link the issue it closes. -->
6+
Closes #
7+
8+
## Type of change
9+
10+
- [ ] Bug fix
11+
- [ ] New command / feature
12+
- [ ] Docs / examples
13+
- [ ] Test / CI / tooling
14+
- [ ] Refactor (no behavior change)
15+
16+
## How it was tested
17+
18+
- [ ] `uv run pytest -m "not hardware"` passes locally (from the `tsapython/` directory)
19+
- [ ] `uv run ruff check .` passes
20+
- [ ] Tested against a **real device** (describe below)
21+
- [ ] Tested with the **mocked fixtures only** (no device)
22+
23+
<!-- If real hardware: which model (Basic / Ultra / Ultra+) and firmware version (from info())? -->
24+
25+
## Checklist for new/changed commands
26+
27+
- [ ] Device writes go through `tinySA_serial()` (no direct `self.ser` access from command methods)
28+
- [ ] Added a command-construction test asserting the exact command string via the `recorder` fixture
29+
- [ ] Added a validation-error test asserting **nothing is sent** on bad input
30+
- [ ] Response parsing (if any) is tested with the `fake_port` fixture, ideally against captured device bytes
31+
- [ ] README command reference updated; example added under `examples/` if it's a significant public method
32+
33+
## Notes for reviewers
34+
35+
<!-- Anything tricky, follow-ups intentionally left out, etc. -->

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,31 @@ on:
66
workflow_dispatch: # allows manual runs from the Actions tab
77

88
jobs:
9+
test:
10+
# A release cannot ship with a red suite: the build/publish jobs below
11+
# depend on this passing. Single-platform here for speed; the full
12+
# cross-platform matrix runs on every push via tests.yml.
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
19+
20+
- name: Sync environment
21+
run: uv sync
22+
working-directory: tsapython
23+
24+
- name: Run test suite
25+
run: uv run pytest -m "not hardware"
26+
working-directory: tsapython
27+
28+
- name: Lint + type check
29+
run: uv run ruff check . && uv run mypy
30+
working-directory: tsapython
31+
932
build:
33+
needs: test
1034
runs-on: ubuntu-latest
1135
steps:
1236
- uses: actions/checkout@v4

.github/workflows/tests.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
# Cancel superseded runs on the same ref (saves CI minutes on rapid pushes).
10+
concurrency:
11+
group: tests-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
defaults:
15+
run:
16+
# The installable project lives in the tsapython/ subdirectory (the one with
17+
# pyproject.toml, the pytest config, and the `hardware` marker).
18+
working-directory: tsapython
19+
20+
jobs:
21+
test:
22+
name: pytest (${{ matrix.os }}, py${{ matrix.python-version }})
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
# The library is pyserial-based and developed on Windows, lightly
28+
# tested on Linux -- so both matter; macOS is cheap to include.
29+
os: [windows-latest, ubuntu-latest, macos-latest]
30+
python-version: ["3.10", "3.11", "3.12", "3.13"]
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v5
37+
with:
38+
enable-cache: true
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: Sync environment (deps + dev group, editable install)
42+
run: uv sync
43+
44+
- name: Run test suite (hardware tests deselected)
45+
run: uv run pytest -m "not hardware" --cov=tsapython --cov-report=xml --cov-report=term-missing
46+
47+
- name: Upload coverage to Codecov
48+
# Optional: only does anything once the repo is linked at
49+
# https://codecov.io. Tokenless for public repos. Safe to leave in
50+
# before linking -- it soft-fails.
51+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
52+
uses: codecov/codecov-action@v5
53+
with:
54+
files: tsapython/coverage.xml
55+
fail_ci_if_error: false
56+
57+
lint:
58+
name: ruff + mypy
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Install uv
64+
uses: astral-sh/setup-uv@v5
65+
with:
66+
enable-cache: true
67+
python-version: "3.12"
68+
69+
- name: Sync environment
70+
run: uv sync
71+
72+
- name: Ruff lint
73+
# Blocking ruleset is E9 + F only (see [tool.ruff.lint] in
74+
# pyproject.toml); style rules are a planned follow-up cleanup.
75+
run: uv run ruff check .
76+
77+
- name: Mypy
78+
# Blocking. The package ships a py.typed marker, which promises
79+
# downstream type-checkers that these annotations are real; this gate
80+
# is what keeps that promise true.
81+
run: uv run mypy
82+
83+
build:
84+
name: package builds
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Install uv
90+
uses: astral-sh/setup-uv@v5
91+
92+
- name: Build sdist + wheel
93+
# Catches packaging breakage on every push instead of at release time.
94+
# release.yml does the same build when publishing.
95+
run: uv build

0 commit comments

Comments
 (0)