Skip to content

配置#

颜色主题#

PDM 使用的默认主题如下:

Key 默认样式
primary cyan
success green
warning yellow
error red
info blue
req bold green

您可以使用 pdm config 命令更改主题颜色。例如,要将 primary 颜色更改为 magenta

1
pdm config theme.primary magenta

或者使用十六进制颜色代码:

1
pdm config theme.success '#51c7bd'

可用配置#

可以通过 pdm config 命令检索和修改以下配置项。

Environment Variable Overrides

如果设置了相应的 env var,则该值将优先于配置文件中保存的值。

Config Item Description Default Value Available in Project Env var
cache_dir The root directory of cached files /home/docs/.cache/pdm No PDM_CACHE_DIR
log_dir The root directory of log files /home/docs/.local/state/pdm/log No PDM_LOG_DIR
check_update Check if there is any newer version available True No PDM_CHECK_UPDATE
build_isolation Isolate build environment from the project environment True Yes PDM_BUILD_ISOLATION
request_timeout The timeout for network requests in seconds 15 No PDM_REQUEST_TIMEOUT
global_project.fallback Use the global project implicitly if no local project is found False No
global_project.fallback_verbose If True show message when global project is used implicitly True No
global_project.path The path to the global project /home/docs/.config/pdm/global-project No
global_project.user_site Whether to install to user site False No
strategy.update The default strategy for updating packages reuse Yes
strategy.save Specify how to save versions when a package is added minimum Yes
strategy.resolve_max_rounds Specify the max rounds of resolution process 10000 Yes PDM_RESOLVE_MAX_ROUNDS
strategy.inherit_metadata Inherit the groups and markers from parents for each package True Yes
install.parallel Whether to perform installation and uninstallation in parallel True Yes PDM_INSTALL_PARALLEL
install.cache Cache wheel installation and only put symlinks in the library root False Yes
install.cache_method Specify how to create links to the caches(symlink/hardlink) symlink Yes
python.providers List of python provider names for findpython [] Yes
python.use_pyenv Use the pyenv interpreter True Yes
python.use_venv Use virtual environments when available True Yes PDM_USE_VENV
python.install_root The root directory to install python interpreters /home/docs/.local/share/pdm/python No
pypi.url The URL of PyPI mirror, defaults to https://pypi.org/simple https://pypi.org/simple Yes PDM_PYPI_URL
pypi.verify_ssl Verify SSL certificate when query PyPI True Yes
pypi.username The username to access PyPI Yes PDM_PYPI_USERNAME
pypi.password The password to access PyPI Yes PDM_PYPI_PASSWORD
pypi.ca_certs Path to a CA certificate bundle used for verifying the identity of the PyPI server No
pypi.ignore_stored_index Ignore the configured indexes False Yes PDM_IGNORE_STORED_INDEX
pypi.client_cert Path to client certificate file, or combined cert/key file No
pypi.client_key Path to client cert keyfile, if not in pypi.client_cert No
pypi.json_api Consult PyPI's JSON API for package metadata False Yes PDM_PYPI_JSON_API
venv.location Parent directory for virtualenvs /home/docs/.local/share/pdm/venvs No
venv.backend Default backend to create virtualenv virtualenv Yes PDM_VENV_BACKEND
venv.in_project Create virtualenv in .venv under project root True Yes PDM_VENV_IN_PROJECT
venv.prompt Define a custom template to be displayed in the prompt when virtualenv isactive. Variables project_name and python_version are available forformatting {project_name}-{python_version} Yes PDM_VENV_PROMPT
venv.with_pip Install pip when creating a new venv False Yes PDM_VENV_WITH_PIP
theme.primary Theme color for primary cyan No
theme.success Theme color for success green No
theme.warning Theme color for warning yellow No
theme.error Theme color for error red No
theme.info Theme color for info blue No
theme.req Theme color for req bold green No
pypi.<name>.url The URL of custom package source https://pypi.org/simple Yes
pypi.<name>.username The username to access custom source Yes
pypi.<name>.password The password to access custom source Yes
pypi.<name>.type index or find_links index Yes
pypi.<name>.verify_ssl Verify SSL certificate when query custom source True Yes
repository.<name>.url The URL of custom package source https://pypi.org/simple Yes
repository.<name>.username The username to access custom repository Yes
repository.<name>.password The password to access custom repository Yes
repository.<name>.ca_certs Path to a PEM-encoded CA cert bundle (used for server cert verification) The CA certificates from certifi Yes
repository.<name>.verify_ssl Verify SSL certificate when uploading to repository True Yes