Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganise Python code using pyproject.toml #294

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Timmmm
Copy link
Contributor

@Timmmm Timmmm commented Oct 4, 2024

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 do pip3 install riscv_opcodes then they will just be able to run riscv_opcodes ....

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.
@aswaterman
Copy link
Member

Solution to a non-problem IMO.

@Timmmm
Copy link
Contributor Author

Timmmm commented Oct 5, 2024

We use riscv-opcodes in our Python flow and it's extremely awkward to use as-is. It would significantly easier if we could just install it as a package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants