Closed gdahia closed 5 months ago
That does make sense. I can add a command like yen default 3.11
that simply puts a python3.11
symlink at the ~/.yen_pythons
folder.
It'll also show a warning if ~/.yen_pythons
is not already in PATH.
Currently yen only has one minor version for each python, so having to use a patch version won't be a problem (pythons don't have major changes between patch versions anyway).
Does that sound good?
Sounds great, even perfect if instead of always using that path, it used the envvar set YEN_PYTHON_PATH
!
Thanks a lot!
Yes, the env var will be respected. I'll build this then.
I've added the feature to the Python part of the code. I've released it as version 0.4.1.
Please do pip install -U yen
and test it to see if it works as expected?
It didn't work for me :(
I ran pip install -U yen
Collecting yen
Downloading yen-0.4.1-py3-none-any.whl (7.6 kB)
Collecting microvenv>=2023.2.0 (from yen)
Downloading microvenv-2023.5.post1-py3-none-any.whl (8.2 kB)
Collecting rich>=13.5.3 (from yen)
Downloading rich-13.7.0-py3-none-any.whl (240 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.6/240.6 kB 5.1 MB/s eta 0:00:00
Collecting markdown-it-py>=2.2.0 (from rich>=13.5.3->yen)
Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 19.2 MB/s eta 0:00:00
Collecting pygments<3.0.0,>=2.13.0 (from rich>=13.5.3->yen)
Downloading pygments-2.17.2-py3-none-any.whl (1.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 14.2 MB/s eta 0:00:00
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=13.5.3->yen)
Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Installing collected packages: pygments, microvenv, mdurl, markdown-it-py, rich, yen
Successfully installed markdown-it-py-3.0.0 mdurl-0.1.2 microvenv-2023.5.post1 pygments-2.17.2 rich-13.7.0 yen-0.4.1
[notice] A new release of pip is available: 23.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
and when I ran yen use 3.11
, I got
Traceback (most recent call last):
File "yen", line 8, in <module>
sys.exit(cli())
File "python3.10/site-packages/yen/cli.py", line 29, in cli
args = parser.parse_args(namespace=YenArgs)
File "/usr/lib/python3.10/argparse.py", line 1845, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "/usr/lib/python3.10/argparse.py", line 1878, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "/usr/lib/python3.10/argparse.py", line 2094, in _parse_known_args
stop_index = consume_positionals(start_index)
File "/usr/lib/python3.10/argparse.py", line 2050, in consume_positionals
take_action(action, args)
File "/usr/lib/python3.10/argparse.py", line 1955, in take_action
action(self, namespace, argument_values, option_string)
File "/usr/lib/python3.10/argparse.py", line 1238, in __call__
vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
AttributeError: 'mappingproxy' object has no attribute 'setdefault'
Oh, my bad there. It would be yen use -p 3.11
though! @gdahia
I'll fix the crash.
@gdahia Doing pip install -U yen
should fetch the latest one with the crash fixed. Can you confirm once that it is fixed?
Now it worked perfectly! Thank you very much for this!
For extra flexibility, it would be great if the path in which we create the symlink and the python installation path could be different, but this is a minor issue.
Again, thanks a lot!
Thanks for the project, I was looking for something like this for quite a while!
As the title of the issue suggests, I think it would be nice if, say, installing
python3.11
withyen
made apython3.11
executable available in.local
or$PATH
.Doing this would allow replacing
pyenv
completely forpoetry
, since shims are not needed forpoetry
to locate appropriate python versions. It would also not cause version collisions if it kept the whole version in the name (perhaps do something like, first python 3 installation claims the namepython3
, and then python 3.11.7 claimspython3.11
and python 3.11.9 claimspython3.11.9
?)Anyway, adding this feature would solve all my python problems.
Do you think that would be in the scope you want to take this project?