Poetry

Poetry

Basic usage

Dependency management

  • poetry new my_project: Create a new project.
  • poetry add package_name: Add a package to the project.
  • poetry remove package_name: Remove a package from the project.
  • poetry update package_name: Update a package in the project.
  • poetry show: Show the list of installed packages.

Virtual Environment

By default, Poetry creates a virtual environment in {cache-dir}/virtualenvs. You can change the cache-dir value by editing the Poetry configuration. Additionally, you can use the virtualenvs.in-project configuration variable to create virtual environments within your project directory.

  • poetry run: Run a command in the virtual environment.
  • poetry shell: Start a shell in the virtual environment.
  • poetry env list: List the virtual environments.
最后更新于