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

Drop the local validator #390

Closed
Tracked by #391
aborgna-q opened this issue Aug 19, 2024 · 0 comments · Fixed by #455
Closed
Tracked by #391

Drop the local validator #390

aborgna-q opened this issue Aug 19, 2024 · 0 comments · Fixed by #455
Assignees

Comments

@aborgna-q
Copy link
Collaborator

aborgna-q commented Aug 19, 2024

Use the hugr cli tool instead. If we wish to maintain feature-parity we'll need to export an extension definition for tket2 and include it here (via git subtrees?).

See CQCL/tket2#556

@aborgna-q aborgna-q self-assigned this Sep 5, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 6, 2024
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 like `hugr-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 central `Cargo.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 if `hugr-cli` is installed,
and calls `cargo install` with the appropriate parameters otherwise,
before running the tool. The version to install matches the one
configured in `Cargo.toml`. This ensures we control the validation in
the same way as all the other hugr dependencies (e.g. the `hugr` dep
used in `execute_llvm`).

Running `cargo run` now acts the same as executing a locally-versioned
`hugr-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

---------

Co-authored-by: Craig Roy <croyzor@users.noreply.github.com>
Co-authored-by: Agustin Borgna <agustinborgna@quantinuum.com>
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 a pull request may close this issue.

1 participant