[Docs] disabling pep 582
On my existing project i tried to make it use virtual environment, but pdm refused saying that i am using PEP 582 mode
$ pdm init
pyproject.toml already exists, update it now.
Please enter the Python interpreter to use
0. [email protected] (/usr/bin/python)
1. [email protected] (/home/u1/.local/share/pdm/python/[email protected]/bin/python3)
2. [email protected] (/usr/bin/python3.12)
3. [email protected] (/usr/bin/python3.11)
4. [email protected] (/usr/bin/python3.10)
5. [email protected] (/usr/bin/python2.7)
Please select (0): 1
INFO: You are using the PEP 582 mode, no virtualenv is created.
For more info, please visit https://peps.python.org/pep-0582/
There is no info in the command output oh why i am forced to use pep 582
I tried to look for documentation on how to disable it, but the pep 582 page does not have anything to say about it: https://pdm-project.org/en/latest/usage/pep582/
As it turns out, my config has python.use_venv = False and i had to set it to True
Suggested solution
- Add hint to change prefernces via pdm config when running
pdm init:
INFO: You are using the PEP 582 mode, no virtualenv is created.
INFO: You can change the configuration with `pdm config python.use_venv true`
For more info, please visit https://peps.python.org/pep-0582/
- Add Note with instruction to disable pep 582 to the documentation page at https://pdm-project.org/en/latest/usage/pep582/
Just for fun tried to use that "chat with the docs" powered by Llamaindex. It was expectedly useless:
how to disable pep 582?
Yes, to disable PEP 582, you can either remove the
__pypackages__directory from the project root or use a virtual environment instead. It is also worth noting that PEP 582 has been rejected and is not recommended for use.
It is a bit disruptive for a non-default option. You should know what it means when you change the config.
It is a bit disruptive for a non-default option. You should know what it means when you change the config.
Currently when you already opted-in to the non-default behavior, you see one unhelpful INFO line. Would that really hurt to add second more informative line? It does not affect / disrupt the default behavior at all, because no additional info for venv is needed to display.