Skip to content

Cannot parse version number from TOML 1.0.0 pyproject.toml file #897

Description

@Jazzinghen

Description:
When providing a pyproject.toml that uses TOML 1.0.0 entries as python-version-file the action fails due to an error within the TOML parser.

Action version:
v5.1.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

  • Python 3.10 (the one installed by default)
  • Python 3.12 (the target version)

Repro steps:
Create a pyproject.toml file using a mixed list (here is the default value for Poetry Dynamic Versioning):

[tool.poetry]
name = "test_package"
description = "Test package to setup python on Github"
requires-python = ">=3.12"
license = ""
keywords = []
authors = [
    "Jazzinghen <jazzinghen@test.com>" 
]

[build-system]
requires = ["poetry-core>=1.8.0", "poetry-dynamic-versioning>=1.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry-dynamic-versioning]
enable = false
strict = true
style = "pep440"
pattern = "default-unprefixed"
tag-branch = "origin/main"

[tool.poetry-dynamic-versioning.substitution]
folders = [{ path = "src" }]
patterns = [
  "(^__version__\\s*(?::.*?)?=\\s*['\"])[^'\"]*(['\"])",
  "(^release\\s*(?::.*?)?=\\s*['\"])[^'\"]*(['\"])",
  { value = "(^__version_tuple__\\s*(?::.*?)?=\\s*\\()[^)]*(\\))", mode = "tuple" },
]

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

Run the action using the file as "Python version file".

Expected behavior:
The action installs Python >=3.12 in the job's container.

Actual behavior:
The action fails with the following error:

 Error: Inline lists must be a single type, not a mix of string and inline-table at row 27, col 84, pos 757:
26:    "(^release\\s*(?::.*?)?=\\s*['\"])[^'\"]*(['\"])",
27>   { value = "(^__version_tuple__\\s*(?::.*?)?=\\s*\\()[^)]*(\\))", mode = "tuple" },
                                                                                       ^
28: ]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions