#### Other tools
- [`pdm venv`](https://pdm-project.org/latest/reference/cli/#venv)
#### Purpose
Create a virtual environment.
#### Notes
Requires [[Virtual environment location]] landing.
- Create a virtual environment in `.venv` next to `pyproject.toml` (this should be the same as what `py run` would do if it was pointed at a project to create a virtual environment)
- Provide a way to point to a preexisting or already active virtual environment
- Be able to specify an alternative location
- Provide the command to create the shell code to activate the virtual environment?
- Probably not because if I did things right it won't be necessary
- `--with-pip`; default
- Install pip either into the virtual environment or use the `.pyz`
- `=cached`: write a `.pth` that connects to `pip.pyz` as maintained for [[#`py ready`]] and then add a `bin/pip` command
- What if the Python version isn't supported?
- Convert to a local install via https://bootstrap.pypa.io/pip/ and `get-pip.py` or `ensurepip`?
- Find the appropriate `pip.pyz` based on version support from PyPI simple index data?
- `pip.pyz` errors out with a generic `1` exit code
- Don't worry about it and let them take care of it themselves since they are using an unsupported version of Python?
- `=local`: install into the virtual environment
- Can you just unpack `pip.pyz` and then add `bin/pip`?
- It lacks any packaging-related files, so no `.dist-info`
- Is this necessary? Should users be told to rely on `-m venv` if they need a separate copy of pip?
- Only necessary if you need a specific version of pip or running a Python version too old for the current `pip.pyz`
- Both cases are rather unique
- `get-pip.py` from https://bootstrap.pypa.io/pip/ will do a local install
- Could use `ensurepip` (although what if a Linux distro left it out?is missing it?)
- Is supporting global vs local even reasonable?
- This only works if you either use the other commands that trigger pip to be updated or provide a specific command to update pip
- Might just be best to make sure to download `get-pip.py` if necessary
- Need an easy way to run entry points?
- Other tools use their `run` command to accomplish this
- Could have [[#`py tool`]] , [[#`py exec`]], or [[#`py run`]] handle this
- Only really necessary in the face of a `.venv` file or convenience to leave off `.venv/bin/`