% poetry --help
Description:
Lists commands.
Usage:
list [options] [–] []
Arguments:
namespace The namespace name
Options:
-h
, --help
, Display help for the given command. When no command is given display help for the list command.-q
, --quiet
, Do not output any message.-V
, --version
, Display this application version.
--ansi
, Force ANSI output.
--no-ansi
, Disable ANSI output.-n
, --no-interaction
, Do not ask any interactive question.
--no-plugins
, Disables plugins.
--no-cache
, Disables Poetry source caches.-C
, --directory=DIRECTORY
, The working directory for the Poetry command (defaults to the current working directory).-v|vv|vvv
, --verbose
, Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
Help:
The list command lists all commands:
poetry list
You can also display the commands for a specific namespace:
poetry list test
Available commands:
- about Shows information about Poetry.
- add Adds a new dependency to pyproject.toml and installs it.
- build Builds a package, as a tarball and a wheel by default.
- check Validates the content of the pyproject.toml file and its consistency with the poetry.lock file.
- config Manages configuration settings.
- export Exports the lock file to alternative formats.
- help Displays help for a command.
- init Creates a basic pyproject.toml file in the current directory.
- install Installs the project dependencies.
- list Lists commands.
- lock Locks the project dependencies.
- new Creates a new Python project at
- publish Publishes a package to a remote repository.
- remove Removes a package from the project dependencies.
- run Runs a command in the appropriate environment.
- search Searches for packages on remote repositories.
- shell Spawns a shell within the virtual environment.
- show Shows information about packages.
- update Update the dependencies as according to the pyproject.toml file.
- version Shows the version of the project or bumps it when a valid bump rule is provided.
cache
- cache clear Clears a Poetry cache by name.
- cache list List Poetry’s caches.
debug
- debug info Shows debug information.
- debug resolve Debugs dependency resolution.
- env info Displays information about the current environment.
- env list Lists all virtualenvs associated with the current project.
- env remove Remove virtual environments associated with the project.
- env use Activates or creates a new virtualenv for the current project.
- self add Add additional packages to Poetry’s runtime environment.
- self install Install locked packages (incl. addons) required by this Poetry installation.
- self lock Lock the Poetry installation’s system requirements.
- self remove Remove additional packages from Poetry’s runtime environment.
- self show Show packages from Poetry’s runtime environment.
- self show plugins Shows information about the currently installed plugins.
- self update Updates Poetry to the latest version.
source
- source add Add source configuration for project.
- source remove Remove source configured for the project.
- source show Show information about sources configured for the project.
伊织 2024-05-14(二)
个人觉得这个体验和 rust - cargo 很相似
poetry 核心之一:使项目环境隔离,意味着始终和本地全局 Python 环境隔离
poetry 首先会检查当前项目是否在虚拟环境中运行:如果是将直接使用它,而不创建新的;如果不是,poetry 将使用它已创建的或创建一个全新的虚拟环境
默认情况下,poetry 将尝试使用当前激活的 Python 版本为当前项目创建虚拟环境
如果当前 Python 版本可能和项目的 Python ...
Poetry 是一个包管理和打包的工具。
在 Python 中,对于初学者来说,打包系统和依赖管理是非常复杂和难懂的。即使对于经验丰富的开发者,一个项目总是要同时创建多个文件: setup.py
,requirements.txt,setup.cfg , MANIFEST.in ,还有最新的 Pipfile,十分繁琐。因此, poetry 将所有的配置都放置在一个 toml 文件(pyproject.toml)中,这些配置包括:依赖管理、构建、打包、发布。
Poetry 的灵感来自于其他语言的一些工具
这会将`virtualenvs.in-project`设置为`true`,并将其写入`$POETRY_HOME/config.toml`文件中。
2. 直接编辑`$POETRY_HOME/config.toml`文件,设置相应的环境变量。例如:
[env]
PYTHONPATH = "/path/to/my/python/modules"
这会将`PYTHONPATH`设置为`/path/to/my/python/modules`。
请注意,`$POETRY_HOME`是一个环境变量,它指向Poetry的用户目录。默认情况下,它位于`~/.poetry`目录下。你可以通过`echo $POETRY_HOME`命令来查看`$POETRY_HOME`的值。