-
Notifications
You must be signed in to change notification settings - Fork 795
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
Switching between cargo check
and cargo clippy
forces pyo3 to rebuild
#1551
Comments
There are a few places where clippy lints are ignored like so: #[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))] In most other places in the codebase, clippy lints are ignored like so: #[allow(clippy::cast_lossless)] I tried replacing the instances of the former with the latter and to my surprise it did not resolve the issue. |
@davidhewitt The problem is similar. I confirmed that |
Thanks @nitsky that's useful information. I believe I have a fix for you in #1557 which will provide two additional ways to avoid the rebuilds:
|
@davidhewitt thank you very much for your work in #1557, that was a good idea to wrap all env var accesses with a function that prints rerun-if-changed. Unfortunately, I still observe that switching between rust-lang/cargo#7431 It turns out that cargo appends |
I think not rebuilding when We've now got the two mitigations implemented above: either encourage users to work in a virtualenv, or ask them to set I think the We could imagine that in the future In my eyes PyO3's build script is behaving as well as possible given the functionality |
So a hacky solution would be to have a separate build script that is rerun always - well, always if the environment changes at least - (so it needs to be in a separate crate?), let this script do the interpreter selection magic, write the selected interpreter it to a file, and use But maybe cargo can just be fixed to not touch PATH if it already contains what it wants to add. |
I'm having this issue as well, but it's not Path that causes it for me, it seems to be VIRTUAL_ENV. I'm using VSCode 1.83.1, Rust-analyzer using clippy. I ran the builds with the fingerprint, and if I don't modify any files (auto-save is on) then A workaround would be cool if there's not a fix yet. Your operating system and version Your Python version (python --version) Your Rust version (rustc --version) Your PyO3 version edit: I was able to solve this by using a command prompt external to vscode with my venv activated. So it's something that VSCode is doing. |
@Kaiyotech did you ever figure it out? Same happening here. |
Hi, I observe that switching between
cargo clippy
andcargo check
forces pyo3 and all downstream crates to rebuild.💥 Reproducing
cargo new --lib example && cd example
Cargo.toml
to includepyo3 = { version = "0.13", features = ["extension-module"] }
.cargo check
.cargo check
again, observe no rebuild.cargo clippy
.cargo check
again, observepyo3
and all downstream crates rebuild.🌍 Environment
rustc --version
): rustc 1.51.0 (2fd73fabe 2021-03-23)version = "0.x.y"
withgit = "https://github.com/PyO3/pyo3")?
: yesThe text was updated successfully, but these errors were encountered: