4 Commits

Author SHA1 Message Date
Andrew Waterman
26e2c04c91 Reorganise Python code using pyproject.toml (#378)
Add pyproject.toml (the modern alternative to requirements.txt), making this a proper Python package that can be installed via pip and potentially uploaded to PyPI.

This also loads the files using `importlib.resources` and installs them into the wheel. This means that when you create a wheel using `uv build` it will still be able to load all the opcodes and CSV files.

To avoid moving those resource files in the source repo, the Python build backend (hatchling) is instructed to move them to the right place when building a wheel, and the `resource_root()` function checks in both places so it always works. This is a little hacky but it works.

CI builds source and binary wheels (not actually binary) that can be uploaded to PyPI. If we do upload them then using this project is as simple as

```
uvx riscv_opcodes -c 'rv*'
```

Co-authored-by: Tim Hutt <timothy.hutt@codasip.com>
2025-10-13 16:24:22 -07:00
Andrew Waterman
56546ec382 don't depend on matplotlib unless -svg is passed on command line (#376)
* Suppress wrong import position warnings

* don't depend on matplotlib unless -svg is passed on command line

cc @tomaird
2025-10-09 17:32:14 -07:00
Andrew Waterman
ddba97b829 Fix CI by decoupling extension count from hatch count (#367)
Not sure this is the best fix, but I need to do something to unbreak CI.

cc @christian-herber-nxp
2025-09-03 18:53:30 -07:00
Christian Herber
767b74181f Adding support to generate an svg from opcodes (#364)
* Adding support to generate an svg from opcodes

* Attempt to fix linting issues

* Adding matplotlib dependency to precommit hooks

* Update linting changes

* Added typed tuples

* Fixing further linting issue (WiP)

* Resolved all linting issue

Matplotlib types cannot be resolved by the linter.
Matplotlib calles are ignored for type checking

* Adding matplotlib to dependencies and svg to output for coverage
2025-08-08 13:42:05 -07:00