### Install Poetry Preview Version Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-04-04-poetry-0-7-0-is-out.md Install a prerelease version of Poetry by passing the `--preview` flag to the standalone installer script. ```bash python get-poetry.py --preview ``` -------------------------------- ### Install All Extras Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Installs all optional dependencies (extras) for the project. ```bash poetry install --all-extras ``` -------------------------------- ### Install Poetry with the New Installer (Linux/macOS/WSL) Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Install Poetry using the new standalone installer by piping the script to a Python 3 interpreter. This is the recommended method for most users on Linux, macOS, and Windows Subsystem for Linux. ```bash # Linux, macOS, Windows (WSL) $ curl -sSL https://install.python-poetry.org | python3 - ``` -------------------------------- ### Install Optional Group Dependencies Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-08-01-announcing-poetry-1-2-0a2.md Use the `poetry install --with` command to install dependencies from optional groups. Ensure compatibility with other dependencies. ```bash poetry install --with docs ``` -------------------------------- ### Install Only Default Dependencies Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-08-01-announcing-poetry-1-2-0a2.md Install only the default, non-grouped dependencies using the `poetry install --default` command. ```bash poetry install --default ``` -------------------------------- ### Define Conditional Dependencies with Markers Source: https://github.com/python-poetry/website/blob/main/content/blog/2019-12-12-announcing-poetry-1-0-0.md Specify complex installation conditions for dependencies using environment markers. This example shows a dependency that is only installed for Python 2.7 or Windows. ```toml [tool.poetry.dependencies] pathlib2 = { version = "^2.2", markers = "python_version ~= '2.7' or sys_platform == 'win32'" } ``` -------------------------------- ### Install Poetry with Standalone Installer Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-04-04-poetry-0-7-0-is-out.md Use this command to install Poetry using the recommended standalone installer script. It isolates Poetry and its dependencies. ```bash curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python ``` -------------------------------- ### Install Only Specific Dependency Groups Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Use the `poetry install --only` command to install only the specified dependency groups, excluding the main group if desired. This example installs only 'docs' and 'test' groups. ```bash poetry install --only docs,test ``` -------------------------------- ### Install Poetry's Runtime Environment Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Ensures all configured packages are installed into Poetry's runtime environment. Use `--sync` to ensure installed dependencies exactly match the lock file. ```bash $ poetry self install $ poetry self install --sync ``` -------------------------------- ### Install Poetry with the New Installer (Windows PowerShell) Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Install Poetry using the new standalone installer in Windows PowerShell. This command downloads the script and executes it with a Python interpreter. ```powershell # Windows (Powershell) (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - ``` -------------------------------- ### Enable Compile Bytecode on Install Source: https://github.com/python-poetry/website/blob/main/content/blog/2023-02-27-announcing-poetry-1-4-0.md To compile bytecode during package installation with the new modern installer, use the --compile flag. ```bash poetry install --compile ``` -------------------------------- ### Install Project Without Dependencies Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Installs the project without any of its dependencies. ```bash poetry install --only-root ``` -------------------------------- ### Install Poetry with install-poetry.py Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-05-21-announcing-poetry-1-2-0a1.md Use this command to install or update Poetry using the new installation script. It replaces the deprecated `get-poetry.py` script. ```bash curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - ``` -------------------------------- ### Install Project Without Dependencies Source: https://github.com/python-poetry/website/blob/main/content/history.md Use the `--only-root` flag with `poetry install` to install a project without its dependencies. This is useful for specific deployment scenarios. ```bash poetry install --only-root ``` -------------------------------- ### Install Dependencies with Specific Groups Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Installs dependencies, selecting specific groups to include with `--with` or exclude with `--without`. Use `--only` to strictly install only specified groups. ```bash poetry install --with --without poetry install --only ``` -------------------------------- ### Verify Poetry Installation Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-10-17-poetry-0-12-0-is-out.md Run this command in a new shell after installation to confirm Poetry is accessible via your PATH. ```bash poetry --version ``` -------------------------------- ### Show Installed Poetry Plugins Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-05-21-announcing-poetry-1-2-0a1.md List all currently installed Poetry plugins by running the 'poetry plugin show' command. ```bash poetry plugin show ``` -------------------------------- ### Install Prerelease Versions of Poetry Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-04-13-poetry-0-8-0-is-out.md Installs a prerelease version of Poetry. Use this if you need to test upcoming features or bug fixes. ```bash poetry self:update --preview ``` -------------------------------- ### Default and Grouped Dependencies Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-08-01-announcing-poetry-1-2-0a2.md This example shows how to define default dependencies and a separate group for testing dependencies in pyproject.toml. ```toml [tool.poetry.dependencies] httpx = "*" pendulum = "*" [tool.poetry.group.test.dependencies] pytest = "^6.0.0" pytest-mock = "*" ``` -------------------------------- ### Install Specific Poetry Version Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-04-04-poetry-0-7-0-is-out.md Install a specific version of Poetry using the standalone installer script by providing the desired version number with the `--version` flag. ```bash python get-poetry.py --version 0.7.0 ``` -------------------------------- ### Poetry Plugin Implementation Example Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-05-21-announcing-poetry-1-2-0a1.md Example of a custom Poetry plugin class. The `activate` method is called upon loading and can manipulate Poetry's configuration and state using the provided `Poetry` and `IO` objects. ```python from cleo.io.io import IO from poetry.plugins.plugin import Plugin from poetry.poetry import Poetry class MyPlugin(Plugin): def activate(self, poetry: Poetry, io: IO): version = self.get_custom_version() io.write_line(f"Setting package version to {version}") poetry.package.set_version(version) def get_custom_version(self) -> str: ... ``` -------------------------------- ### Install project with yanked releases Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-23-announcing-poetry-1-2-0rc1.md If a project depends on yanked releases, Poetry will display a warning during the installation process. ```bash $ poetry install [...] Warning: The file chosen for install of cryptography 37.0.3 (cryptography-37.0.3-cp36-abi3-manylinux_2_24_x86_64.whl) is yanked. Reason for being yanked: Regression in OpenSSL. ``` -------------------------------- ### Install Poetry using Pip Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-04-04-poetry-0-7-0-is-out.md An alternative method to install Poetry using pip. Be aware that this may lead to dependency conflicts as it installs Poetry's dependencies system-wide. ```bash pip install --user poetry ``` -------------------------------- ### Install and use a specific Python version Source: https://github.com/python-poetry/website/blob/main/content/blog/2025-02-15-announcing-poetry-2-1-0.md These experimental commands allow you to install a Python version (e.g., 3.13) if it's not already present and then set it as the default for your project environments. ```bash poetry python install 3.13 poetry env use 3.13 ``` -------------------------------- ### Install Project with Yanked Release Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Installing a project that depends on yanked releases will also raise a warning. This example demonstrates the warning during a `poetry install` command. ```bash poetry install ``` -------------------------------- ### Create New Project with Specified README Format Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Creates a new project, specifying the format for the README file. ```bash poetry new --readme ``` -------------------------------- ### Initialize pyproject.toml with Poetry Source: https://github.com/python-poetry/website/blob/main/content/blog/2018-05-28-poetry-0-10-0-is-out.md Use the `init` command to interactively create a `pyproject.toml` file for a new or existing project. ```bash poetry init ``` -------------------------------- ### Configure Installer to Skip Binary Distributions Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Configure the `installer.no-binary` setting to opt out of binary distributions for selected dependencies. This can be set globally or locally for a specific project. Use `:all:` to skip all binaries, specific package names to skip individual ones, or `:none:` to disable this setting. ```bash $ poetry config --local installer.no-binary :all: ``` ```bash $ poetry config --local installer.no-binary httpx,uvicorn ``` ```bash $ poetry config --local installer.no-binary :none: ``` -------------------------------- ### Show Configured Package Sources Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Displays information on all configured sources for the project. Optionally, limit output to one or more sources by specifying them by name. ```bash $ poetry source show $ poetry source show pypi-test ``` -------------------------------- ### Build Poetry Website with Local Docs Source: https://github.com/python-poetry/website/blob/main/README.md Use this command to build the Poetry website locally, specifying a path to a local Poetry repository for documentation. This allows for development with custom or unreleased documentation. ```sh make site POETRY_REPO=../path/to/local/poetry/repo ``` -------------------------------- ### Install Only Specific Groups Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-08-01-announcing-poetry-1-2-0a2.md Install only specified dependency groups, excluding default dependencies, with the `poetry install --only` command. ```bash poetry install --only docs ``` -------------------------------- ### Update Poetry to 1.0.5 Source: https://github.com/python-poetry/website/blob/main/content/blog/2020-02-29-announcing-poetry-1-0-5.md Use this command to update your Poetry installation to the latest version if installed via the official installer. ```bash poetry self update ``` -------------------------------- ### Build the Poetry Website Locally Source: https://github.com/python-poetry/website/blob/main/README.md Run this command to build and serve the Poetry website locally. It fetches or symlinks documentation and concurrently runs asset compilation and the Hugo server. ```sh make site ``` -------------------------------- ### Install Dependencies Excluding Groups Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-08-01-announcing-poetry-1-2-0a2.md Exclude specific dependency groups during installation using the `poetry install --without` command. ```bash poetry install --without test,docs ``` -------------------------------- ### Update Poetry to Latest Version Source: https://github.com/python-poetry/website/blob/main/content/blog/2020-01-10-announcing-poetry-1-0-2.md Use this command to update your Poetry installation to the latest version if installed via the official installer. ```bash $ poetry self update ``` -------------------------------- ### Configure pyproject.toml with PEP 621 project section Source: https://github.com/python-poetry/website/blob/main/content/blog/2025-01-05-announcing-poetry-2-0-0.md Example of a pyproject.toml file demonstrating the use of the PEP 621 'project' section, replacing some 'tool.poetry' fields. ```toml [project] name = "poetry-demo" version = "0.1.0" description = "" authors = [ {name = "Sébastien Eustace", email = "sebastien@eustace.io"} ] readme = "README.md" requires-python = ">=3.8" [tool.poetry] packages = [{include = "poetry_demo"}] [build-system] requires = ["poetry-core>=2.0"] build-backend = "poetry.core.masonry.api" ``` -------------------------------- ### Pass configuration settings to build systems Source: https://github.com/python-poetry/website/blob/main/content/blog/2025-02-15-announcing-poetry-2-1-0.md Use the --config-settings parameter with key-value pairs to pass custom configurations to build systems like poetry-core. This is useful for advanced build options. ```bash poetry build --config-settings local-version=some-local ``` -------------------------------- ### Configure setup.py Generation Source: https://github.com/python-poetry/website/blob/main/content/blog/2023-02-27-announcing-poetry-1-4-0.md To maintain the legacy behavior of generating a stub setup.py file, explicitly set 'generate-setup-file' to true in your pyproject.toml. This option will be deprecated in future versions. ```toml [tool.poetry.build] generate-setup-file = true ``` -------------------------------- ### Show Packages in Poetry's Runtime Environment Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Lists all configured runtime environment packages. ```bash $ poetry self show ``` -------------------------------- ### List Installed Poetry Plugins Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md View all currently installed and discovered plugins within your Poetry environment. This helps in managing and verifying plugin installations. ```bash poetry self show plugins ``` -------------------------------- ### Configure installer to not re-resolve dependencies Source: https://github.com/python-poetry/website/blob/main/content/blog/2025-01-05-announcing-poetry-2-0-0.md Disable the default re-resolution of dependencies during installation from a lock file. This can speed up installations, especially for deep dependency trees. ```bash poetry config installer.re-resolve false ``` -------------------------------- ### Add Dependency with Extras Source: https://github.com/python-poetry/website/blob/main/content/blog/2019-12-12-announcing-poetry-1-0-0.md Use the `add` command to install a package and specify extras directly within the package name. This simplifies dependency management by avoiding the need for the `--extras` flag. ```bash poetry add "requests[security]" ``` -------------------------------- ### Install with --remove-untracked Source: https://github.com/python-poetry/website/blob/main/content/blog/2020-10-01-announcing-poetry-1-1-0.md Use the --remove-untracked option with the install command to keep your environment in sync with the poetry.lock file, ensuring only required packages are installed. ```shell poetry install --remove-untracked ``` -------------------------------- ### Poetry show with --why Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Shows how to use the `--why` flag to determine why a specific dependency is required. ```bash poetry show --why requests ``` -------------------------------- ### Specify license and license files using PEP 639 Source: https://github.com/python-poetry/website/blob/main/content/blog/2025-09-14-announcing-poetry-2-2-0.md This TOML configuration demonstrates how to specify project license and license files according to PEP 639, using SPDX expressions for the license. ```toml [project] # ... license = "MIT" license-files = [ "*-LICENSE", "CONTRIBUTORS", "MY-SPECIAL-LICENSE-DIR/**/*" ] ``` -------------------------------- ### Enable System Git Client (Experimental) Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-31-announcing-poetry-1-2-0.md Set `experimental.system-git-client` to `true` to revert Poetry to using the system's `git` command instead of the native Python Git client (Dulwich). This may be necessary for specific lock file configurations or if abbreviated Git commit SHAs are used. ```bash poetry config experimental.system-git-client true ``` -------------------------------- ### Upgrade Poetry using pipx Source: https://github.com/python-poetry/website/blob/main/content/blog/2026-01-18-announcing-poetry-2-3-0.md Use this command to upgrade your Poetry installation if it was installed via pipx. ```bash pipx upgrade poetry ``` -------------------------------- ### Disable Modern Installer Source: https://github.com/python-poetry/website/blob/main/content/blog/2023-02-27-announcing-poetry-1-4-0.md If you encounter issues with the new modern installer, you can disable it by setting 'installer.modern-installation' to 'false' in your configuration. ```bash poetry config installer.modern-installation false ``` -------------------------------- ### Update to Poetry 1.2.0rc2 Source: https://github.com/python-poetry/website/blob/main/content/blog/2022-08-26-announcing-poetry-1-2-0rc2.md Use this command to update to the latest preview release if you have Poetry installed via the official installer. ```bash $ poetry self update --preview ``` -------------------------------- ### Disable Experimental New Installer Source: https://github.com/python-poetry/website/blob/main/content/blog/2020-10-01-announcing-poetry-1-1-0.md If you encounter issues with the new installer, you can disable it by setting the 'experimental.new-installer' configuration option to false. ```bash poetry config experimental.new-installer false ``` -------------------------------- ### Publish project to PyPI with Poetry Source: https://github.com/python-poetry/website/blob/main/layouts/home.html Use this command to upload your project's distribution files to PyPI. Ensure your project is configured with publishing credentials. ```bash $ poetry publish ``` -------------------------------- ### Add a Poetry Plugin with pip Source: https://github.com/python-poetry/website/blob/main/content/blog/2021-05-21-announcing-poetry-1-2-0a1.md If Poetry was installed with pip, use 'pip install --user' to add plugin packages. ```bash pip install --user poetry-plugin ```