Skip to main content

test release through poetry

Project description

poetry应用

github

官方文档

安装

pip install poetry

tips

poetry new创建一个项目脚手架,包括基本结构、pyproject.toml文件,基于每个人的项目目录不同,推荐在已有项目添加poetry管理,详见./test

poetry init在现有项目里创建pyproject.toml文件

poetry config --list查看config列表

poetry config virtualenvs.in-project true配置在项目内创建.venv

poetry config <key> <value>

poetry env use python3指定创建虚拟环境时使用的python解释器版本

运行环境指定

  • 执行poetry的命令并不需要激活虚拟环境,因为poetry会自动检测当前虚拟环境
  • 在当前目录对应虚拟环境中执行命令poetry run python test.py
  • 显示激活的虚拟环境poetry shell

依赖

安装某个包时,会在pyproject.toml文件中默认使用版本限定,比如colorama = "^0.4.1" ,当我执行 poetry update 时,colorama也许会更新到0.4.9,但绝不会更新到0.5.0,意思是在更新依赖时不会修改最左边非零的数字号版本,这样的默认设定可以确保不会更新到不兼容变动的版本。

poetry add flask安装最新稳定版本的flask

poetry add pytest --dev指定为开发依赖,会写到pyproject.toml中的[[tool.poetry.dev-dependencies]]区域

poetry add flask=2.22.0指定具体的版本

poetry install安装pyproject.toml文件中的全部依赖

poetry install --no-dev只安装非development环境的依赖,一般部署时使用

poetry show查看项目安装的依赖

poetry show -t树形结构查看项目安装的依赖

poetry update更新所有锁定版本的依赖

poetry update httprunner更新指定的依赖

poetry remove packages卸载依赖, 会将依赖包一起卸载

poetry env list --full-path查找当前项目的虚拟环境

发布流程

  1. poetry init原项目中同级目录执行 创建toml文件
  2. poetry build打包项目文件到dist/
  3. poetry publish

配置镜像源

pyproject.toml文件末尾追加以下内容

[[tool.poetry.source]]
name = "aliyun"
url = "http://mirrors.aliyun.com/pypi/simple"
default = true

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_release_test-0.0.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

poetry_release_test-0.0.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file poetry_release_test-0.0.0.tar.gz.

File metadata

  • Download URL: poetry_release_test-0.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.8.13 Linux/5.15.0-56-generic

File hashes

Hashes for poetry_release_test-0.0.0.tar.gz
Algorithm Hash digest
SHA256 be922550b3f1b683dad7d4a6539f0905b1f2c93b6fad8c925b9560ef0ef6f5d2
MD5 148d392778e08d1a6746e3ffd5d10675
BLAKE2b-256 22f35b57d44a74d32968e5fb476f49ddd8aa97441ada0cfa0e65b183030bc115

See more details on using hashes here.

File details

Details for the file poetry_release_test-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_release_test-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aeafaf264de9acb11b08d2281cfa6b3d022cf1371500a2da8fd8b4e13ebad155
MD5 3ad0ec5b875bb086f16ff1c55c370648
BLAKE2b-256 3db60bae9b9eb2b96f1ad3bc6db2e75344704ae5462dd78918e73cd411b61e25

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page