Reorganise Python code using pyproject.toml #294
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 required moving all of the data files into the package, and reading them using importlib. This gives a much nicer file structure. It does require Python 3.7 but that is over 6 years old and easy to install on old Linux distros like RHEL 8.
Note: This is a draft; I haven't quite finished the bit that actually reads the opcode files, but I wanted to get feedback to see if you're ok with this approach first.
Especially the bit about creating a venv. Python's native tooling is kind of terrible so this is not easy to avoid. If you install rye then it becomes a bit better; you can run
rye run riscv_opcodes ...
and it will take care of the venv automatically. Also end-users won't see the pain - if they dopip3 install riscv_opcodes
then they will just be able to runriscv_opcodes ...
.