moonrepo / python-plugin

A proto WASM plugin for Python.
MIT License
3 stars 1 forks source link

pip packages that include executables are not available #27

Open davidwinter opened 3 months ago

davidwinter commented 3 months ago

Apologies if I've misunderstood what to expect - I'm a user coming from asdf and attempting to migrate to proto due to it's cross-platform nature - amazing work everyone!

I was expecting that if I was to run pip install cpplint or similiar, which normally would provide the cpplint executable available within my path immediately afterwards. I can see the file within ~/.proto/tools/python/3.12.3/install/bin though it's not available on my path. I've tried proto regen but to no avail.

Any advice or guidance would be much appreciated. Thanks.

Proto: 0.36.2 Python plugin: 0.10.1 Python version: 3.12.3

milesj commented 3 months ago

@davidwinter We do create pip files, but only shims: https://github.com/moonrepo/python-plugin/blob/master/src/proto.rs#L153

Is ~/.proto/shims in your PATH?

davidwinter commented 3 months ago

@milesj it is 👍

>: echo $PATH
/Users/davidwinter/.proto/shims /Users/davidwinter/.proto/bin /Users/davidwinter/.cargo/bin <...snip>
milesj commented 3 months ago

@davidwinter Oh I misread the post, I thought pip wasn't available, not the tool it installed.

So proto doesn't update PATH with the location of globally installed binaries. For some tools like rust and deno this is super easy since the install path is always the same, but others like python changes between versions. We haven't figured out a nice way to handle this yet that works with shims.

davidwinter commented 3 months ago

@milesj no worries. That's a shame though. I wonder what mechanism asdf uses for achieving this - unless you're already aware?

davidwinter commented 3 months ago

The value from this output for Global packages directory is that hardcoded or something? A reason we couldn't use this for the tool?

>: proto tool info python
python - Python

Plugin
  Version: 0.10.1
  URL: https://github.com/moonrepo/python-plugin/releases/download/v0.10.1/python_plugin.wasm

Inventory
  Store: ~/.proto/tools/python
  Executable: ~/.proto/tools/python/3.12.3/install/bin/python3.12
  Global packages directory: ~/.proto/tools/python/3.12.3/install/bin
  Binaries:
    - ~/.proto/bin/python (primary)
    - ~/.proto/bin/python3 
  Shims:
    - ~/.proto/shims/python (primary)
    - ~/.proto/shims/pip 
    - ~/.proto/shims/python3 
  Installed versions:
    - 3.12.3
milesj commented 3 months ago

We do have a list of global paths that we check for, but we have no way to inject that into the PATH currently.

milesj commented 3 months ago

I'll look into how mise is handling things. The only thing I'm worried about is the initial overhead of having to download wasm plugins.

milesj commented 2 months ago

If you're still using proto, the next release attempts to solve this. I published an alpha:

https://github.com/moonrepo/proto/releases

And some info on the command/workflow:

https://moonrepo.dev/docs/proto/commands/activate

davidwinter commented 2 months ago

Amazing - thanks - I'll give this a try tomorrow 👍