PyO3 / PyO3/pyo3

Rust analyzer fails to pick up Pyo3 proc-macros

Open
#4,914 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

Bug Description

When using pyo3 inside VSCode with rust-analyzer, rust-analyzer fails to compile the proc macros. See the attacked image.

Image

Steps to Reproduce
  1. Create a new virtual environment with python -m venv .venv
  2. Activate the new virtual environment
  3. Install Maturin with pip install maturin
  4. Create a new maturin project with maturin init --name foo
  5. Open the lib.rs file and see rust-analyzer complaining
Backtrace

Your operating system and version

Windows 10 10.0.19045 Build 19045

Your Python version (python --version)

Python 3.12

Your Rust version (rustc --version)

rustc 1.84.1 (e71f9a9a9 2025-01-27)

Your PyO3 version

0.23.3

How did you install python? Did you use a virtualenv?

python -m venv .venv

Additional Info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report from lib.rs by following the listed venv, Maturin, and VSCode steps, using the reported Windows, Python, Rust, and PyO3 versions. Start by examining the rust-analyzer diagnostics around the generated Maturin project; done means the PyO3 proc-macros are compiled or otherwise recognized without the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.