Skip to content

Conversation

@machshev
Copy link
Collaborator

@machshev machshev commented Jan 7, 2026

Looks like we rely on an API change introduced in Python 3.12 which means the render_static function fails on earlier versions of Python.

The importlib.resources.read_text(anchor, path) function takes an anchor which is the python module path (e.g. "dvsim.templates.static") and joins it to a file system relative path (e.g. "css/style.css"). Before Python 3.13 it seems that the path argument is actually only a filename argument. Which means we need to provide everything other than the file name itself as a python module path - "dvsim.templates.static.css" and "style.css".

This PR changes the function to use pathlib.Path to concatenate the paths, which deals with filesystem paths in an OS agnostic way. Then path.parts to get the path parts and join on "." to create the module path. While this may seem more complicated than need be, I'm avoiding doing manual string manipulation to make this more robust.

  • Add a unit test that calls the render function which highlights the issue
  • Update CI config to prevent fail fast on the python version matrix - this means we see which versions pass and which versions fail, which is useful debugging information.
  • Fix the bug

Fixes: #84

Signed-off-by: James McCorrie <[email protected]>
It's useful to have the tests run for all Python versions even if one
version has failed. Where there is a breaking change in the API it's
really useful to be able to see in which version it starts to fail.

Signed-off-by: James McCorrie <[email protected]>
@machshev machshev marked this pull request as ready for review January 8, 2026 11:04
@machshev machshev added this pull request to the merge queue Jan 8, 2026
Merged via the queue into lowRISC:master with commit 5b68d0d Jan 8, 2026
6 checks passed
@machshev machshev deleted the report_gen_bug branch January 8, 2026 12:13
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.

Report generation issue with Python 3.10

2 participants