Skip to content

feat: add full support for TOML 1.1#6500

Open
Hofer-Julian wants to merge 12 commits into
mainfrom
toml-1-1
Open

feat: add full support for TOML 1.1#6500
Hofer-Julian wants to merge 12 commits into
mainfrom
toml-1-1

Conversation

@Hofer-Julian

Copy link
Copy Markdown
Contributor

Description

Fixes #6387

How Has This Been Tested?

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: {e.g., Claude, Codex, GitHub Copilot, ChatGPT, etc.}

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

@hunger

hunger commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

You seem to have covered the success-cases very successfully. Good work:-)

I think I found some corner-cases that still need fixing.

Take a look at this pixi.toml:

[workspace]
platforms = ["linux-64",
  # penguins!
  "win-64"]
channels = ["https://repo.example-com/ch/"]

dependencies = { numpy = "*",
  # more penguins
  scipy = "*" }

This command breaks the file: pixi workspace platform remove win-64. I think pixi remove scipy would also result in a broken file, but I get an error when I try on this syntax (works in "classic" syntax).

pixi workspace channel remove https://repo.example.com/ch/ (note: Exactly matches the toml file) fails to remove the channel with an error stating it does not exist. That looks like a normalization problem, those usually bring their friends :-)

Doing pixi w platform remove win-64 in this setup

platforms = [
  "linux-64", # penguins!
  "win-64"
]

removes the comment penguins! that obviously belongs to Linux. I had expected that to be kept in this setup.

I did miss e.g. feature removal. Is that covered already? Should that be covered?

@Hofer-Julian Hofer-Julian force-pushed the toml-1-1 branch 2 times, most recently from 493de53 to e8bc4fc Compare July 3, 2026 15:32
…diting manifests

Stress-testing the TOML 1.1 editing helpers surfaced several problems:

- removing an entry that precedes a dotted key left the dead entry's line
  comment dangling and dropped standalone comments, because a dotted key's
  line decor lives on its leaf key rather than the root segment
- overwriting a dotted entry collapsed its line and ate the previous
  entry's comment
- standalone comment lines stored in a removed entry's suffix (multiline
  containers without a trailing comma) were deleted
- removing an entry from a regular table deleted the standalone comments
  above it
- pixi remove looked up conda and pypi dependencies by the spelling the
  user typed, silently leaving differently spelled entries (hTTPx vs
  httpx, PyYAML vs pyyaml) in the document while reporting success
- pixi global add/remove looked up dependencies only under the normalized
  name, duplicating or missing differently spelled entries, and channel
  deduplication compared raw strings so URL channels with a trailing
  slash were added twice
- removing a pypi dependency panicked on pyproject dependency arrays that
  contain entries that are not valid pep508 strings

The new stress test crosses a corpus of hostile-but-valid TOML formatting
variants with every editing operation and checks that the output stays
valid TOML, matches a semantic model, and preserves comments according to
the crate's contract.
@Hofer-Julian Hofer-Julian marked this pull request as ready for review July 6, 2026 13:03
Handle CRLF line endings when checking whether decor starts on a fresh
line, so removing an entry no longer deletes the comments of surviving
entries in CRLF manifests. Keep the previous line's trailing comment in
place when inserting an array element, and keep standalone comment
lines on their own lines instead of flattening them behind the last
element when appending to arrays and inline tables.

Compare channels by their display name in add_channels so re-adding a
URL channel that only differs in spelling replaces the parsed entry
like it replaces the document entry. Recognize inline table entries
like { channel = "nvidia", priority = 1 } when checking whether a
channel is already listed in a pixi global manifest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support TOML 1.1

2 participants