In Rust
use pyo3::prelude::*;
#[pyfunction]
/// Returns the answer to life, the universe, and all the rest
pub fn get_answer() -> usize {
42
}
#[pymodule]
fn answers(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_answer, m)?)?;
Ok(())
}
Built with maturin develop in my current python environment, but also checked doing
maturin build && pip install [wherever_that_wheel_went]
In Python
import answers
my_answer = answers.get_answer()
Now if you go to that python code in VSCode and hover over get_answer, the floating tip will not show the docstring. If I go to ipython and explicitly ask for __doc__, it's there, though.
What am I missing?
This is a known problem since the end of last year. I was able to understand some of what that guy was saying by trying to read it as Latin with general success. Check your configuration settings, and the asker mentioned it might have been a mac issue, are you running mac? The fact that it works one place and not the other made me think it was the fault of Pylance but I know from experience that doesn't always follow. Will update answer with additional info as it arises. The question