Hi Petrus / all,
I can’t seem to get code autocomplete in the Jpype wrapper to work for autocompletion using VScode. It works if I import in a Jupyter notebook and start the JVM, but I thought it should work just writing a script since the library has all the stubs generated. Any ideas? Thanks!
Hi,
Autocompletion for orekit_jpype in VSCode works on my machine, although a few docstrings are missing (in this case, the stubs only contain the method name and input/output types).
What OS, Python version do you have, and what environment do you use? A venv?
The following stub-only packages should be available in the lib/python3.12/site-packages folder of your venv, they are installed together with orekit_jpype after running pip install orekit_jpype:
java-stubsorg-stubs, containing thehipparchusandorekitstubs
Cheers
Clément
Hi Clément,
Thanks. I’m on MacOS 14 using Python 3.9, orekit-jpype=12.1.2 with a venv managed by Poetry. I have my Poetry venv as my selected interpreter in VSCode and I verified that java-stubs, org-stubs, hipparchus-stubs are in the venv’s site-packages directory, but I don’t see orekit-stubs. However, even the org stubs don’t seem to be working for me (org.hipparchus gives nothing on autocomplete, for example).
I also tried a fresh plain Python venv with only orekit-jpype installed and have the same behavior.
Bumping this issue… I’ve tried switching to a newer version of Python (3.11), using the venv module directly instead of Poetry, installing into a venv from source as described in the README, all with no success. site-packages contains both org-stubs (with orekit-stubs and hipparchus-stubs) and java-stubs.
Other folks at my workplace have the same issue, so I’m inclined to say that the stubs in the orekit_jpype package as it’s distributed in general don’t work with VSCode’s default settings… is it possible that you have some setting in your VSCode environment that enables the stubs to work? Maybe you’re using a different language server (I’m using Pylance)?
Hi Derek,
You mentioned the folders org-stubs/orekit-stubs and org-stubs/hipparchus-stubs, are you sure they are not named org-stubs/orekit and org-stubs/hipparchus instead? See here: org-stubs · master · Orekit / orekit_jpype · GitLab
Are you colleagues all using MacOS?
Silly question, is VSCode configured to use your venv?
Orekit jpype’s stubs normally follow the PEP 561 standard for stub-only package, but maybe there is a mistake somewhere.
Hello,
Did you find any updates on this issue? I am also experiencing it. Even when importing at the start of the script I get warnings such as:
Import "org.orekit.propagation.events" could not be resolved from sourcePylancereportMissingModuleSource
I tried changing some VSCode settings but even with the stubs it struggles to find it. @yzokras did you do any additional configuration?
I tried using the Zed code editor and it does autocomplete and detect imports. Although with Zed I also had some issues in handling JPype @JImplements for instance.
Thanks,
Pedro