-
Notifications
You must be signed in to change notification settings - Fork 806
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
Use pybind11-stubgen for generating stubs #1821
Conversation
Responding here to track #1814 I manually had to create the folders However, by default in VSCode the stub info for me disappears by default (no error, but it's reported as Perhaps this is more of a Pylance thing now, where it doesn't know where to find the generated stubs? |
@tianyilim It works for me in Pylance under macOS M1. Are you sure that you are using the correct Python environment? ![]() Please do the following: Make sure you uninstall ALL of your previous GTSAM python bindings by doing Reinstall the python bindings. In VSCode, check bottom right if you are in the correct Python environment: ![]() Choose the correct one, then Cmd+Shift+P and say If this does not work, check:
|
Okay, I tried with a fresh conda environment and it seems to have worked: conda create --name gtsamStubs python=3.10 -y
conda activate gtsamStubs
cd gtsam/
git fetch -ap
git checkout fan/gen_stubs
mkdir build
python -m pip install -r python/dev_requirements.txt
python -m pip install pyparsing
cd build/
cmake .. -DGTSAM_BUILD_PYTHON=1
make python-install -j$(nproc) I now get similar output to when Previously, I was using the flags Thanks for the help! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I’ll try on my linux env and Mac to be sure - in conda env, then merge if works
I'm a bit lost. If the issue is |
Just in my experience |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for one thing, looks good to me.
@@ -25,6 +25,7 @@ | |||
#include <boost/serialization/nvp.hpp> | |||
#endif | |||
#include <memory> | |||
#include <algorithm> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah to fix latest clang 15 on Linux, I tested on my arch. (we are using std::find
)
Use
pybind11-stubgen
to generate the stubs, which is a stub generator specifically built forpybind11
types.Also changed the way stub is generated. Should hopefully fix the issues with
mypy
's generator.Tested locally on both VSCode and JupyterLab (macOS M1):