Closed5

poetryからryeに移行する

いばらきいばらき

pyproject.tomlを書き換える

  1. [tool.poetry]を[project]にする
pyproject.toml
- [tool.poetry]
+ [project]
  1. authorsの形式を変更
pyproject.toml
- authors = ["ibaraki <ibaraki@example.com>"]
+ authors = [{ name = "ibaraki", email = "ibaraki@example.com" }]
  1. pythonのバージョン指定の変更
pyproject.toml
- [tool.poetry.dependencies]
- python = "~3.11"
+ requires-python = ">=3.11,<3.12"
  1. dependenciesの変更
pyproject.toml
- [tool.poetry.dependencies]
- boto3 = "^1.28.62"
+ dependencies = [
+     "boto3>=1.28.62,<2",
+ ]
  1. dev-dependenciesの変更
pyproject.toml
- [tool.poetry.dev-dependencies]
- pytest = "^5.2"
+ [tool.rye]
+ managed = true
+ dev-dependencies = [
+     "pytest>=5.2,<6",
+ ]
  1. build-systemの変更
pyproject.toml
[build-system]
- requires = ["poetry-core>=1.0.0"]
- build-backend = "poetry.core.masonry.api"
+ requires = ["hatchling"]
+ build-backend = "hatchling.build"
  1. scriptsの変更
pyproject.toml
- [tool.poetry]
- packages = [
-     { include="scripts", from="." },
- ]
- [tool.poetry.scripts]
+ [project.scripts]
start = "scripts.func_start:main"
test = "scripts.test:main"
いばらきいばらき

最終的にはこんな感じ

pyproject.toml
[project]
name = "sample-app"
version = "0.1.2"
description = ""
authors = [{ name = "ibaraki", email = "ibaraki@example.com" }]
readme = "readme.md"
requires-python = ">=3.11,<3.12"
dependencies = [
    "boto3>=1.28.62,<2",
    "fastapi>=0.63.0,<1",
    "gunicorn>=20.0.4,<20",
    "uvicorn[standard]>=0.13.3,<1",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
    "pytest>=5.2,<6",
    "autopep8>=1.5.5,<2"
]

[project.scripts]
start = "scripts.func_start:main"
test = "scripts.test:main"
このスクラップは2023/11/09にクローズされました