Skip to content

TOML parsing issue #5577

@mforbes

Description

@mforbes

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Commands I ran and their output:

$ pixi lock
Error:   x Missing table in manifest pyproject.toml:
  | Any of the following sections is required:
  | * tool.pixi.workspace
  | * tool.pixi.project
  | * tool.pixi.package
   ,-[/Users/mforbes/tmp/python/pixi/toml_issue/pyproject.toml:1:1]
 1 | [project]
   : ^
 2 | authors = []
   `----
  help: Check your manifest for a [tool.pixi.*] table. See https://pixi.sh/latest/python/pyproject_toml for more
        information.

pixi.toml/pyproject.toml file that reproduces my issue:

[project]
authors = []
dependencies = []
name = "toml_issue"
requires-python = ">= 3.11"
version = "0.1.0"

[tool.pixi]
workspace.channels = ["conda-forge"]
workspace.platforms = ["osx-arm64"]

pixi info output:

System
------------
       Pixi version: 0.65.0
        TLS backend: rustls
           Platform: osx-arm64
   Virtual packages: __unix=0=0
                   : __osx=14.8.3=0
                   : __archspec=1=m1
          Cache dir: /Users/mforbes/Library/Caches/rattler/cache
       Auth storage: /Users/mforbes/.rattler/credentials.json
   Config locations: /Users/mforbes/.pixi/config.toml

Global
------------
            Bin dir: /Users/mforbes/.pixi/bin
    Environment dir: /Users/mforbes/.pixi/envs
       Manifest dir: /Users/mforbes/.pixi/manifests/pixi-global.toml

Issue description

The TOML parser Pixi uses does not respect the TOML spec. The specified file should be equivalent to the following (which works):

[project]
authors = []
dependencies = []
name = "toml_issue"
requires-python = ">= 3.11"
version = "0.1.0"

[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["osx-arm64"]

Both produce the same JSON with e.g. the python toml library:

>>> import toml
>>> toml.load('pyproject.toml')
{'project': {'authors': [], 'dependencies': [], 'name': 'toml_issue', 'requires-python': '>= 3.11', 'version': '0.1.0'}, 'tool': {'pixi': {'workspace': {'channels': ['conda-forge'], 'platforms': ['osx-arm64']}}}}

Expected behavior

Pixi should not raise an error and should behave as with the second file.

Metadata

Metadata

Assignees

No one assigned

    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