Picks the right package manager for you.
Don't make me think about which package manager to use when I clone a project from other people. OnePM will pick the right package manager by searching for the lock files and/or the project settings in pyproject.toml
.
This project is created in the same spirit as @antfu/ni.
Supported package managers: pip, pipenv, poetry, pdm, uv
Install with pipx
:
pipx install onepm
Or use pdm global install:
pdm add -g onepm
pi
# (venv) pip install . or pip install -r requirements.txt
# pipenv install
# poetry install
# pdm install
pi requests
# (venv) pip install requests
# pipenv install requests
# poetry add requests
# pdm add requests
pu
# not available for pip
# pipenv update
# poetry update
# pdm update
pr ...args
# (venv) ...args
# pipenv run ...args
# poetry run ...args
# pdm run ...args
pun requests
# pip uninstall requests
# pipenv uninstall requests
# poetry remove requests
# pdm remove requests
pa
# pip
# pipenv
# poetry
# pdm
If the package manager agent is pip, OnePM will enforce an activated virtualenv, or a .venv
under the current directory.
OnePM also provides shim for the package managers like corepack,
so you don't need to install package managers yourself. To enable it, install OnePM with shims
extra:
pipx install --include-deps onepm[shims]
OnePM reads the package-manager
field under [tool.onepm]
table in pyproject.toml
, and install the required package manager with the correct version in an isolated environment.
[tool.onepm]
package-manager = "poetry"
Or you can restrict the version range:
[tool.onepm]
package-manager = "poetry>=1.1.0"
For Python package management, OnePM is all you need.
onepm install
: Install the package manager configured in project fileonepm use $SPEC
: Use the package manager given by the requirement speconepm update|up
: Update the package manager used in the projectonepm cleanup [$NAME]
: Clean up installations of specified package manager or allonepm list|ls $NAME
: List all installed versions of the given package manager