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

docs: Add a FAQ section about recompilation due to IDE #4183

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wyfo
Copy link
Contributor

@wyfo wyfo commented May 13, 2024

fixes #1708

@wyfo
Copy link
Contributor Author

wyfo commented May 13, 2024

I've chosen to put this question in first position, because I think it may be the most common issue encountered by users, as most of of them use an IDE with background cargo check causing the issue.

Copy link

codspeed-hq bot commented May 13, 2024

CodSpeed Performance Report

Merging #4183 will not alter performance

Comparing wyfo:faq_rebuild (11441cb) with main (10152a7)

Summary

✅ 68 untouched benchmarks

A solution can be to set a fixed `PYO3_PYTHON` environment variable for each build. You can for example write a cargo [configuration file](https://doc.rust-lang.org/cargo/reference/config.html), e.g. `.cargo/config.toml`, with
```toml
[env]
PYO3_PYTHON = "venv/bin/python" # or any other Python path like "/usr/bin/python"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the Python interpreter is one solution. Do we want to discuss the alternative to have rust-analyzer use a separate target directory, c.f. rust-lang/rust-analyzer#6007, as well?

IIRC, this is often recommended to avoid build directory lock contention and appears to be more general approach and does not have the downside of having to fix the interpreter? OTOH, fixing the interpreter might actually a good thing to avoid build and test errors and such coming from unexpected Python environments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the Python interpreter is one solution. Do we want to discuss the alternative to have rust-analyzer use a separate target directory, c.f. rust-lang/rust-analyzer#6007, as well?

Indeed, I didn't considered this solution, and it may be indeed a better alternative.

OTOH, fixing the interpreter might actually a good thing to avoid build and test errors and such coming from unexpected Python environments?

Yes, but it's kind of unrelated to this question of the FAQ. If users encounter issues caused by unexpected Python interpreters, then I think it will be worth to add a dedicated question in the FAQ.

I will update the answer to mention target directory as the first solution.

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 this pull request may close these issues.

pyo3 crate recompiled on (every?) build
2 participants