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

pre-commit → error: found a virtual manifest at .../Cargo.toml instead of a package manifest #197

Open
Daniel-at-github opened this issue Dec 20, 2024 · 8 comments

Comments

@Daniel-at-github
Copy link

Using typstyle in pre-commit configured with:

  - repo: https://github.com/Enter-tainer/typstyle
    rev: v0.12.12
    hooks:
      - id: typstyle

I got this error:

(venv) user@kinoite:~/git/sample_repo $ pre-commit clean
Cleaned /var/home/user/.cache/pre-commit.
(venv) user@kinoite:~/git/sample_repo $ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/Enter-tainer/typstyle.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/Enter-tainer/typstyle.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/var/home/user/.cache/pre-commit/repoqbaocqma/rustenv-default/bin/cargo', 'install', '--bins', '--root', '/var/home/user/.cache/pre-commit/repoqbaocqma/rustenv-default', '--path', '.')
return code: 101
stdout: (none)
stderr:
    info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
    info: latest update on 2024-11-28, rust version 1.83.0 (90b35a623 2024-11-26)
    info: downloading component 'cargo'
    info: downloading component 'clippy'
    info: downloading component 'rust-docs'
    info: downloading component 'rust-std'
    info: downloading component 'rustc'
    info: downloading component 'rustfmt'
    info: installing component 'cargo'
    info: installing component 'clippy'
    info: installing component 'rust-docs'
    info: installing component 'rust-std'
    info: installing component 'rustc'
    info: installing component 'rustfmt'
    error: found a virtual manifest at `/var/home/user/.cache/pre-commit/repoqbaocqma/Cargo.toml` instead of a package manifest
Check the log at /var/home/user/.cache/pre-commit/pre-commit.log
@Enter-tainer
Copy link
Owner

hi @34j does pre-commit works on your side recently?

@QuadnucYard
Copy link
Collaborator

It seems that pre-commit could not specify binaries in a workspace.

It requires cargo install --bins --path crates/typstyle, but pre-commit fixes the path as --path ..

@34j
Copy link
Contributor

34j commented Dec 22, 2024

@Enter-tainer
Copy link
Owner

seems that pre-commit doesn't think it's a bug. Any idea how to fix this?

@34j
Copy link
Contributor

34j commented Dec 26, 2024

As noted in the above issue, using Docker would be a workaround. Building and uploading Docker image to Docker Hub instead of just providing Dockerfile might be nicer in that users need not to build images locally (automatically) but is quite tedious. It would depend on your choice. (Unfortunately I cannot work with this right now due to personal issues sorry

@QuadnucYard
Copy link
Collaborator

Could we write a custom pre-commit-hook instead of using a rust preset? Just like ruff.

@34j
Copy link
Contributor

34j commented Dec 29, 2024

In my understanding pre-commit-ruff uses prebuilt binaries available on PyPI but does that apply to this project

@ernieIzde8ski
Copy link

For end users, this can be fixed by specifying additional_dependencies in a local hook:

  - repo: local
    hooks:
      - id: typstyle
        name: typstyle
        description: Format files with typstyle
        entry: typstyle
        language: rust
        types: [file]
        additional_dependencies: ["cli:typstyle:0.12.14"]
        files: \.typ$
        args: [-i]

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

No branches or pull requests

5 participants