Backends
A backend in usethis refers to the package manager that usethis delegates to when performing certain operations. The backend handles tasks like installing dependencies, managing lockfiles, and working with virtual environments. By knowing which package manager your project uses, usethis can automate these steps for you and tailor its instructions accordingly.
Available Backends
uv
The uv backend is recommended for new projects. When the uv backend is active, usethis will:
- Install and uninstall dependencies automatically using
uv addanduv remove. - Generate and update lockfiles.
- Give instructions using
uv runto run tools likeruff,pytest, etc.
poetry
The poetry backend supports Poetry-managed projects. When the poetry backend is active, usethis will:
- Install and uninstall dependencies automatically using
poetry addandpoetry remove. - Configure default dependency groups via
[tool.poetry.group.GROUPNAME]with theoptionalflag. - Give instructions using
poetry runto run tools likeruff,pytest, etc.
none
The none backend means no package manager is being used by usethis. When this backend is active, usethis will still configure tools and update configuration files, but it will not install or uninstall any dependencies for you. Instead, the console output will display instructions for you to follow up on manually.
How the Backend is Selected
By default, usethis auto-detects the appropriate backend using the following logic:
- If Poetry usage is detected (via the presence of a
poetry.lockfile, apoetry.tomlfile, or a[tool.poetry]section inpyproject.toml), thepoetrybackend is selected. - If
uvusage is detected (e.g. via the presence of auv.lockfile), theuvbackend is selected. - If no
pyproject.tomlexists yet anduvis available on your system, theuvbackend is selected. - Otherwise, the
nonebackend is used.
You can override this auto-detection by passing the --backend option to any usethis command:
uvx usethis tool ruff --backend=none
To check which backend usethis would use for your project, run:
uvx usethis show backend