TinyTapeout / tt-support-tools

tools used by project repos to test configuration, generate OpenLane run summaries and documentation
Apache License 2.0
16 stars 14 forks source link

Draft: Package up as an installable #38

Closed KoviRobi closed 6 months ago

KoviRobi commented 7 months ago

This is draft, as it has some changes which would benefit more consideration/care before merging (and for a later tapeout, as it would involve some changes to the github actions too, if merged, and tt06 is just around the corner).

And it's here in case it's helpful, if not then no worries, feel free to just close it :) And the nix specific stuff doesn't have to live in this repo, but given openlane2 is also using nix, I thought perhaps it might be helpful.

I've wanted to package it up for convenience on my machine (plus also a Nix derivation as on NixOS the pip install won't work as it pulls in C libraries which expect e.g. /lib/ld-linux.so which doesn't exist there). That bit works fine, I've tested on my NixOS, as well as in a docker container with pip install git+https://github.com/KoviRobi/tt-support-tools@package-nix.

The small change is moving the stuff to be packaged up into a directory of its own -- I think python/poetry just requires this? For things which are not just a single script file anyway. I've also moved the data files, so they get packaged up, and now the def files get copied out so that the docker run can find them.

The big change is to do with versioning, as the script not being in the git repo anymore means that it cannot just run git. And poetry seems to insist on pep440 style versions. It doesn't seem to be happy with just taking the branch name (because tt06 doesn't match its regex), the thing that works would be using git tags, e.g. v7.0.0 for tt07, so that when installed it would be called e.g. tt-support-tools-7.0.0+7c36341.

(Also, there are nix flakes specific things about versioning, namely that tags or branch-names are not part of the git commit [but are rather, things attached to the git commit on top] so not reproduceable and aren't present. So currently there is a hardcoded version number in flake.nix but the commit hash in the flake.nix is always up to date, as that is part of the commit.)

Finally, the imports have changed to be for the package, rather than ad-hoc script imports (they don't have to be relative imports, I can change that very easily, but it would be e.g. tt_support_tools.project rather than just project). But this means that the github action python tt/tt_tool.py or ./tt/tt_tool.py won't work as the import won't work. Instead python -m tt.tt_support_tools will work though.

KoviRobi commented 7 months ago

Oh also I rebased onto latest tt06, the bump to gdstk requires qhull, I'll fix that now.

Edit: Fixed, was more complicated than needed because the python packages release had some missing files...

urish commented 6 months ago

Thanks for working on this!

From our PoV: the change is quite big and the benefit isn't worth the trouble of making these changes ATM.