Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 of 5 tasks
Jazzinghen opened this issue Jun 19, 2024 · 3 comments
Open
2 of 5 tasks

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

Jazzinghen opened this issue Jun 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Jazzinghen
Copy link

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 <[email protected]>" 
]

[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: ]
@Jazzinghen Jazzinghen added bug Something isn't working needs triage labels Jun 19, 2024
@JamesParrott
Copy link

JamesParrott commented Jun 19, 2024

The dev version of the toml library used by this tool has supported Toml 1.0.0-rc1 (that allows mixed types in arrays) since 2019.
It's currently on v3.0.0 https://github.com/iarna/iarna-toml/releases/tag/v3.0.0

This tool must pull the previous version from NPM that's 4 years old. v2.2.5 must enforce Toml 0.5.0 rules, which forbid mixed types in an Array, as the error says.

https://www.npmjs.com/package/@iarna/toml

I don't know if the builder or typescript compiler can pull in packages from Github instead of npm. But if so, fixing this should just need a version bump here and elsewhere:

"@iarna/toml": "^2.2.5",

@aparnajyothi-y
Copy link

Hello @Jazzinghen, Thank you for creating this issue and we will look into it :)

@Jazzinghen
Copy link
Author

@aparnajyothi-y
Thank you for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants