applet: add support for applets that have additional requirements.
As a concrete example, this (abridged) `pyproject.toml` with
a mandatory dependency on `aiohttp`:
dependencies = ["aiohttp~=3.8"]
[project.entry-points."glasgow.applet"]
audio-yamaha-opx = "glasgow.applet.audio.yamaha_opx:AudioYamahaOPxApplet"
can now be transformed into the following one with an optional
dependency on `aiohttp`:
[project.optional-dependencies]
http = ["aiohttp~=3.8"]
[project.entry-points."glasgow.applet"]
audio-yamaha-opx = "glasgow.applet.audio.yamaha_opx:AudioYamahaOPxApplet [http]"
If `aiohttp` is not installed or its version is unsatisfying, the CLI
shows a placeholder instead of the applet whose `--help` text explains
how to install the missing packages.
See #234.
by
whitequark
1 year 5 months
applet: kill `all`, use Python entry points to declare applets.
`glasgow.applet.all` was an abomination. Now that it is gone, we have
several new possibilities:
* Out-of-tree applets is the major one. (This commit explicitly
prohibits them because the API is not stable or ready for public
consumption.)
* Applets can now have package dependencies of their own, through
their list of optional dependency groups that must be installed.
This prevents any further dependency bloat of the software stack.
* Applet metadata can at some point be cached to reduce load times.
Loading every applet (which we still do, just in a less directly
intentional way) is costly, especially on low-power systems or
systems with slow disk, and the cost only grows as more applets
are developed. Unfortunately, this will continue to be the case
so long as `argparse` continues to be used.
It might seem odd to move applet's "name" from its source code to
`pyproject.toml`. This actually makes sense because it is less its
name and more a handle by which it is invoked. It is likely that
the handles of out-of-tree applets will collide reasonably often
and in that case they will be automatically disambiguated.
by
whitequark
1 year 5 months
applet.audio.yamaha_opx: fix off-by-one.
by
whitequark
1 year 5 months
revC2: Corrected the CAT24M01 part number.
by
esden
1 year 5 months
software: use proper `amaranth[builtin-yosys]` dependency.
PDM 2.8.1 has fixed the bug that prevented its use before.
by
whitequark
1 year 5 months
cli: in `glasgow voltage`, replace `Monitor` with `Vsense(range)`.
This makes it clearer exactly what is monitored.
by
whitequark
1 year 5 months
device.hardware: print causes of `set_voltage()` failure.
For example:
$ glasgow voltage
Port Vio Vlimit Vsense Monitor
A 0.0 5.5 0.0 0.0-5.5
B 0.0 3.3 0.0 0.0-5.5
$ glasgow voltage AB 5
E: g.cli: cannot set I/O port(s) AB voltage to 5.0 V (port B voltage limit is set to 3.3 V)
It is easy to miss the value in the Vlimit column. The display of
causes of the error avoids a source of frustration, and ensures that
voltage limit caused errors do not mislead the operator into thinking
that their device is faulty.
by
whitequark
1 year 5 months
Replace dependency `crc` with `amaranth.lib.crc`
Fixes GlasgowEmbedded/glasgow#371
by
Ian Bobbitt
1 year 5 months
CI: group all required workflows into one status check.
This allows more flexibility in running workflows conditionally.
by
whitequark
1 year 5 months
applet.internal.selftest: ensure CLI exits with code 1 on failure.
by
whitequark
1 year 5 months