LinuxCommandLibrary

poetry-self

Manage Poetry installation

TLDR

Install a package

$ poetry self add [package_name]
copy

Install dependencies from the Poetry installation's pyproject.toml file
$ poetry self install
copy

Lock dependencies from the Poetry installation's pyproject.toml file
$ poetry self lock
copy

Remove a package
$ poetry self remove [package_name]
copy

List all installed packages
$ poetry self show
copy

List all installed plugins
$ poetry self show plugins
copy

Sync the runtime environment with the Poetry installation's poetry.lock file
$ poetry self sync
copy

Update dependencies from the Poetry installation's pyproject.toml file
$ poetry self update
copy

SYNOPSIS

poetry self <subcommand> [<args>] [<options>]

PARAMETERS

--help, -h
    Display help information for the poetry self command or a specific subcommand.

--version
    Show the version of the poetry self utility itself (not the installed Poetry version).

--verbose, -v
    Increase the verbosity of messages during the operation.

--quiet, -q
    Suppress all output except for errors.

--dry-run
    Simulate the operation without actually making any changes to the installation.

--channel <channel>
    Specify the distribution channel to use for installations or updates (e.g., stable, preview).

DESCRIPTION

poetry self is an integral utility designed for the comprehensive management of the Poetry dependency manager installation itself. It empowers users to effortlessly inspect the currently installed Poetry version, streamline upgrades to the latest stable release, or precisely install a specific version tailored to particular project needs. This command acts as a crucial maintenance tool, ensuring your Poetry environment remains current and robust, thereby mitigating potential compatibility conflicts that can emerge from outdated versions. It centralizes self-management operations, simplifying the process of keeping Poetry optimized and consistent across diverse development projects. Utilizing poetry self contributes significantly to a stable, efficient, and reliable Python development workflow, ensuring that your development toolchain is always ready and up-to-date.

Beyond simple updates, poetry self also provides mechanisms for checking for new releases and even removing Poetry installations, making it a complete lifecycle manager for the tool.

CAVEATS

Installing or updating Poetry globally might require elevated privileges (e.g., using sudo) depending on the installation method and target directory.
Relying on poetry self for updates is generally recommended over system package managers (like apt or brew) if Poetry was initially installed via its official installer or pipx, to avoid conflicts and ensure the latest features.
An active internet connection is necessary for fetching new Poetry versions or updates.

SUBCOMMANDS OVERVIEW

The poetry self command provides several subcommands for specific management tasks:

install <version> [<options>]: Installs a specific version of Poetry. If no version is specified, it installs the latest stable version. Options include --channel for selecting a release channel, and --file for installing from a local archive.

update [<options>]: Upgrades the current Poetry installation to the latest available version in the configured channel. Use --preview to update to a preview release if available.

version: Displays the currently installed version of Poetry.

check [<options>]: Checks for new available Poetry releases without performing an update. Use --latest to check against the absolute latest release, ignoring the configured channel.

remove [<options>]: Uninstalls the Poetry application. The --purge option can be used to remove all associated configuration files and caches.

HISTORY

The poetry self functionality emerged from the community's need for a standardized, robust way to manage the Poetry application itself, separate from project-specific dependencies. Initially, users relied on manual downloads, pipx commands, or shell scripts for updates and installations. Recognizing the importance of self-sufficiency, the Poetry project integrated these capabilities into a dedicated self subcommand. This evolution centralized control over Poetry's lifecycle, improving user experience by providing a consistent interface for updates, installations, and version management, thereby reducing fragmentation and enhancing the overall stability of the development ecosystem.

SEE ALSO

poetry(1), pip(1), pipx(1), pyenv(1), curl(1)

Copied to clipboard