Closed aborgna-q closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 90.40%. Comparing base (
2199b48
) to head (201eb0b
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Spinoff of #454
Replaces the validator python library with a small binary that calls out to
hugr-cli validate
.cargo install
lets us download tools likehugr-cli
and use them for local development, but the support for locally scoped tools is quite flaky. By default, tools are installed in a global directory using the latest version available. It can be forced to use a local target directory via an env variable /cargo
config (which didn't always work while I was testing it), and version selection can only be done by passing explicit arguments to the cmd. As there is no centralCargo.toml
(or similar) config for it, this relies on every usage point always passing exactly the same arguments. Updating the tool version / patching in a git ref ends up being quite error prone.The solution in this PR is inspired by cargo's own
xtask-
subcrates. These are internal crates meant to run some external tool, while centrally defining the dependency versions and artifact paths.The new
validator
bin crate here checks ifhugr-cli
is installed, and callscargo install
with the appropriate parameters otherwise, before running the tool. The version to install matches the one configured inCargo.toml
. This ensures we control the validation in the same way as all the other hugr dependencies (e.g. thehugr
dep used inexecute_llvm
).Running
cargo run
now acts the same as executing a locally-versionedhugr-cli
.drive-by: Created a cargo workspace.
note: I temporarily disabled the tests that required the "collections" extension definition. This will get fixed once we merge #454, I just didn't want to wire in a hacky solution that'll get dropped in the next PR.
Closes #390