Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Consider using TOML instead of YAML for pixi.lock #1172

Closed
Hofer-Julian opened this issue Apr 12, 2024 · 3 comments
Closed

Consider using TOML instead of YAML for pixi.lock #1172

Hofer-Julian opened this issue Apr 12, 2024 · 3 comments
Labels
✨ enhancement Feature request

Comments

@Hofer-Julian
Copy link
Contributor

Problem description

To my knowledge, the main reason YAML has been chosen for pixi.lock was to stay compatible with conda-lock. This goal has been abandoned by now: https://prefix.dev/blog/introducing_multi_env_pixi#the-new-pixilock-format-

The main advantage of YAML IMO is that it is nicer with deeply nested structures. This doesn't apply here. Compare e.g. one package in YAML vs TOML:

YAML

- kind: conda
  name: numpy
  version: 1.26.4
  build: py312he3a82b2_0
  subdir: osx-64
  url: https://conda.anaconda.org/conda-forge/osx-64/numpy-1.26.4-py312he3a82b2_0.conda
  sha256: 6152b73fba3e227afa4952df8753128fc9669bbaf142ee8f9972bf9df3bf8856
  md5: 96c61a21c4276613748dba069554846b
  depends:
  - libblas >=3.9.0,<4.0a0
  - libcblas >=3.9.0,<4.0a0
  - libcxx >=16
  - liblapack >=3.9.0,<4.0a0
  - python >=3.12,<3.13.0a0
  - python_abi 3.12.* *_cp312
  constrains:
  - numpy-base <0a0
  license: BSD-3-Clause
  license_family: BSD
  size: 6990646
  timestamp: 1707226178262

TOML

[[packages]]
build = "py312he3a82b2_0"
constrains = ["numpy-base <0a0"]
depends = ["libblas >=3.9.0,<4.0a0", "libcblas >=3.9.0,<4.0a0", "libcxx >=16", "liblapack >=3.9.0,<4.0a0", "python >=3.12,<3.13.0a0", "python_abi 3.12.* *_cp312"]
kind = "conda"
license = "BSD-3-Clause"
license_family = "BSD"
md5 = "96c61a21c4276613748dba069554846b"
name = "numpy"
sha256 = "6152b73fba3e227afa4952df8753128fc9669bbaf142ee8f9972bf9df3bf8856"
size = 6990646
subdir = "osx-64"
timestamp = 1707226178262
url = "https://conda.anaconda.org/conda-forge/osx-64/numpy-1.26.4-py312he3a82b2_0.conda"
version = "1.26.4"

One immediate advantage of TOML here is that the package namespace is easily visible. With YAML, you have to scroll all the way up to the beginning of the list. Not an easy task with large lock files.

tomllib is also part of the Python standard library, which makes reading TOML files more accessible than YAML.

Lastly, serde_yaml is archived and was never a fantastic option to begin with, IMO.
It depends on unsafe-libyaml which is a C to unsafe Rust transcribed library implementing an outdated YAML version.

@Hofer-Julian Hofer-Julian added the ✨ enhancement Feature request label Apr 12, 2024
@baszalmstra
Copy link
Contributor

We have been discussing this internally as well. The biggest issue I see is how we make parser backwards compatible but perhaps first trying to read the file as toml and if that fails try yaml is good enough.

@ruben-arts
Copy link
Contributor

I would like to move this discussion to rattler as it's a implementation detail and the code for it is in rattler.

@Hofer-Julian
Copy link
Contributor Author

but perhaps first trying to read the file as toml and if that fails try yaml is good enough

That's what I had in mind as well

@prefix-dev prefix-dev locked and limited conversation to collaborators Aug 23, 2024
@baszalmstra baszalmstra converted this issue into discussion #1896 Aug 23, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
✨ enhancement Feature request
Projects
None yet
Development

No branches or pull requests

3 participants