Skip to content
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

Suggestion to extend the vision with Volta-style shims #23

Open
shamrin opened this issue Mar 24, 2023 · 4 comments
Open

Suggestion to extend the vision with Volta-style shims #23

shamrin opened this issue Mar 24, 2023 · 4 comments

Comments

@shamrin
Copy link

shamrin commented Mar 24, 2023

Posy looks very promising, great work!

@njsmith, do you want to push the vision even further that what you have in the README? Posy could provide shims for python / python3 / pip. Like this:

$ ls -l $(which python)
/path/to/python -> /path/to/posy-shim
$ ls -l $(which pip)
/path/to/pip -> /path/to/posy-shim

In other words, do what Volta does for Node and npm.

This means the existing project workflow could be simply:

$ cd project/
$ python main.py  # (if needed) installs python and deps from pyproject.toml, and then runs main.py

And the new project could be configured as follows:

$ mkdir project && cd project/
$ posy init --python 3.11.1  # pins python version in pyproject.toml
$ pip install some-dependency  # installs dependency in project environment
$ editor main.py  # write some code
$ python main.py  # invokes main.py with pinned python and with project dependencies in scope

(Optional) Do the same with tools

$ cd project/  # project that has black version 23.1.0
$ black --version
23.1.0
$ cd another-project/  # project that has black version 22.10.0
$ black --version
22.10.0

(Volta also does it, see "Using project tools" section in "Understanding Volta" page).

@njsmith
Copy link
Owner

njsmith commented Mar 26, 2023 via email

@njsmith
Copy link
Owner

njsmith commented Mar 27, 2023

oh forget to say the main point: I'm totally open to doing this if it turns out to make sense. UX is the kind of thing you have to experiment with :-)

@shamrin
Copy link
Author

shamrin commented Mar 29, 2023

Thank you for your reply @njsmith! Yeah, separate posy command has its advantages: direct, short, no magic.

Another possible improvement is to provide pip stub, to prevent xkcd Python environment mess:

$ pip
error: `pip` command disabled, use `posy install` instead

@njsmith
Copy link
Owner

njsmith commented Mar 29, 2023

Posy does use the magic marker file that's supposed to tell pip not to mess with its environments: https://github.com/njsmith/posy/blob/cfea84949d057664e0ec1f2f88dbccc701630ce1/src/data-files/EXTERNALLY-MANAGED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants