[Bug]: Import resolution breaks with --editable on `uv`, `rye` packaage managers
Closed this issue ยท 1 comments
Contact Details
๐ฆ Package Version
latest
๐๏ธ Framework Version
N/A
๐ Describe the Bug
The issue occurs when installing the package in editable mode using either uv
or rye
, with a virtual environment activated, and only affects the LSP only: both Pyright and Pylance(vscode) produce the same effect.
Things tried unsuccessfully:
- Using a different setuptools version
- A similar issue suggested a fix happened in the latest Pyright release, though it did not seem to address this issue in particular
- Manipulating import paths
- Numerous
[tool.setuptools]
configurations - ...
What's going on under the hood though?
Installing a package in editable mode creates a link under site-packages
, with a file named something similar to __editable__.agentops-0.3.14.finder.__path_hook__
, which contains the absolute path to the package that has just been installed as --editable
. It is also a hook, as the name suggests, that would eventually take care of modifying your PYTHONPATH
Since I was able to get a type hint with that filename (rather than agentops
), it suggests the hook did not run at installation, for whatever unknown reason that I did not consider investigating further.
setuptools
may be hard to get straight since it's the lowest level of a package builder you get. I personally try to stay away from it to avoid problems, as it takes time and patience to get straight especially for the use case we're dealing with here.
What solved the issue instantly without further changes was switching to hatchling, a modern build system adopted across astral.sh
tools and that I personally use across python projects.
b60e653#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R1-R3
๐ค Contribution
- Yes, I'd be happy to submit a pull request with these changes.
- I need some guidance on how to contribute.
- I'd prefer the AgentOps team to handle this update.
Closing this issue, as uv
is going to be the new standard and it should solve this on its own