fpgmaas/deptry

pre-commit hook for `cargo clippy` fails during local development

Closed this issue · 1 comments

Describe the bug

When running the following commands locally:

pdm install
pdm run pre-commit install
git add .
git commit -m 'test'

I get this output:

check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check toml...............................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
cargo fmt................................................................Passed
cargo clippy.............................................................Failed
- hook id: cargo-clippy
- exit code: 101

   Compiling pyo3-build-config v0.20.3
error: failed to run custom build command for `pyo3-build-config v0.20.3`

Caused by:
  process didn't exit successfully: `/Users/florian/git/deptry/target/debug/build/pyo3-build-config-3314ceeaf5b25712/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=PYO3_CONFIG_FILE
  cargo:rerun-if-env-changed=PYO3_NO_PYTHON
  cargo:rerun-if-env-changed=PYO3_ENVIRONMENT_SIGNATURE
  cargo:rerun-if-env-changed=PYO3_PYTHON
  cargo:rerun-if-env-changed=VIRTUAL_ENV
  cargo:rerun-if-env-changed=CONDA_PREFIX

  --- stderr
  error: failed to run the Python interpreter at /Users/florian/git/deptry/venv/bin/python: No such file or directory (os error 2)

It seems to look for the Python interpreter under venv, while it is located under .venv. The following command works fine:

pdm run pre-commit run -a

Maybe other contributors will run into the same. Let's find out why this is happening and what we should do to resolve it.

Closing, maybe it was just an issue with my environment. Not sure what caused it and what resolved it. If in the future someone else encounters the same, let's see if we can get a better list of steps to reproduce than I provided (i.e. all steps starting from a git clone).