• Official documentation: https://python-poetry.org/docs/
  • Put the virtual directory inside the project

    poetry config virtualenvs.in-project true
  • Discover the python interpreter for virtual environments such as pyenv

    poetry config virtualenvs.prefer-active-python true
  • Package domestic mirror (pyproject.toml)

    [[tool.poetry.source]]
    name = "aliyun"
    url = "https://mirrors.aliyun.com/pypi/simple/"
    default = true
    [[tool.poetry.source]]
    name = "douban"
    url = "https://pypi.doubanio.com/simple/"
    default = true
  • Specify third-party packages for a specific platform (linux)

    [tool.poetry.dependencies]
    python = "~3.8.8"
    fastapi = { version = "~0.65.3", extras = ["all"] }
    gunicorn = { version = "~20.1.0", platform = "linux"}
  • poetry export requirements.txt

    poetry export -f requirements.txt --output requirements.txt
    poetry export --without-hashes -f requirements.txt --output requirements.txt
This article is from qbit snap

qbit
268 声望279 粉丝

引用和评论

0 条评论