Open nmichlo opened 1 month ago
Would happily help contribute towards this if I know where to start and desired scope. Although probably most beneficial for larger companies struggling to maintain deps across projects rather than standard users.
pydependence
is probably the most flexible implementation that I know of currently, and can aim to replicate some of its functionality, possibly with a more simplified interface to start. e.g. just single repo resolution, and can then extend towards different starting scopes and multiple project resolution?
UV is in an amazing place to solve the python import traversal and scanning issue for larger projects. There are existing projects that have tried to do this (and I've recently implemented one of them myself that tries to fix some of the issues, but there are still usability issues that I think UV is in a great place to solve).
Existing Projects
Projects that I know of that have tried to do this include:
Problems
The main problem with past projects that generate dependencies from imports are that they usually have some combination of the following:
PIL
topillow
, orcv2
toopencv-python
and/oropencv-python-contrib
lazy_import("torch.nn")
<< custom but could support with hooksdef my_fn(): import torch.nn
if TYPE_CHECKING: import torch.nn
tests
could be in multiple repos, orgoogle.protobuf
notgoogle
is installed by something specific, or packages that provide multiple modulesPartially resolved
I tried to resolve many of these issues with
pydependence
above, but there are still problems that I think UV could solve:Why in UV:
Is this something that UV would ever be open to and maybe a design discussion could be started? Possibly with a reduced set of features to start?
Possible Implementation (based on pydependence)
The fact that UV can resolve deps separately from the import scanning means that a lot of the complexity is removed from such project as you just need to, UV also has much of this support functionality already stable and used in other parts of the codebase as far as I can tell. The general algorithm from
pydependence
is:Help on implementation
Its possible I could assist in an implementation.