Skip to content

pyproject.toml を PEP 621 形式に移行 #7

Description

@apokamo

概要

Poetry 2.x で [tool.poetry] 形式が非推奨となり、PEP 621 の [project] 形式への移行が推奨されている。

現在の警告

Warning: [tool.poetry.name] is deprecated. Use [project.name] instead.
Warning: [tool.poetry.version] is set but 'version' is not in [project.dynamic].
Warning: [tool.poetry.description] is deprecated. Use [project.description] instead.
Warning: [tool.poetry.readme] is set but 'readme' is not in [project.dynamic].
Warning: [tool.poetry.license] is deprecated. Use [project.license] instead.
Warning: [tool.poetry.authors] is deprecated. Use [project.authors] instead.
Warning: [tool.poetry.keywords] is deprecated. Use [project.keywords] instead.
Warning: [tool.poetry.classifiers] is set but 'classifiers' is not in [project.dynamic].
Warning: [tool.poetry.homepage] is deprecated. Use [project.urls] instead.
Warning: [tool.poetry.urls] is deprecated. Use [project.urls] instead.

移行内容

現在の形式

[tool.poetry]
name = "jquants-api-client"
version = "0.0.0"
description = "J-Quants API Client Library"
authors = ["J-Quants Project Contributors <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
keywords = ["jquants", "api", "client", "J-Quants"]
classifiers = [...]
homepage = "https://github.com/J-Quants/jquants-api-client-python"

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/J-Quants/jquants-api-client-python/issues"

[tool.poetry.dependencies]
python = "^3.11"
...

移行後の形式(PEP 621)

[project]
name = "jquants-api-client"
description = "J-Quants API Client Library"
authors = [{name = "J-Quants Project Contributors", email = "[email protected]"}]
license = {text = "Apache-2.0"}
readme = "README.md"
keywords = ["jquants", "api", "client", "J-Quants"]
requires-python = ">=3.11"
dynamic = ["version", "classifiers"]
dependencies = [
    "requests>=2.32.0",
    ...
]

[project.urls]
Homepage = "https://github.com/J-Quants/jquants-api-client-python"
"Bug Tracker" = "https://github.com/J-Quants/jquants-api-client-python/issues"

[tool.poetry]
packages = [{include = "jquantsapi"}]

[tool.poetry.group.dev.dependencies]
...

[tool.poetry-dynamic-versioning]
enable = true
style = "pep440"

参考

注意事項

  • poetry-dynamic-versioning との互換性を確認
  • [project.dynamic]versionclassifiers を追加
  • 依存関係の記法が異なる(^3.11>=3.11,<4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions