Skip to content

add pixi schema CLI #4338

@bollwyvl

Description

@bollwyvl

As always, thanks for pixi!

elevator pitch

Add some pixi CLI features to emit JSON schema for key pixi files and other features.

references

motivation

As the number of pixi features which provide --json output expands, it may
make sense for a user's installed pixi to be able to tell them exactly,
conclusively, what kind of JSON to expect.

This would make it far easier for external tools to predictably integrate with
pixi, and, crucially, detect when big changes happen.

design ideas

Some potential CLI experiences (not mutually exclusive):

  • a top-level pixi schema subcommand:

    $ pixi schema
    
    No schema key given, please provide one of:
    
    Key         Describes
    lock        a pixi.lock file
    manifest    a pixi.toml file
    pyproject   a pyproject.toml file
    schema      output of `pixi schema --json`
    task-list   output of `pixi task list --json`
    tree        output of `pixi tree --json` 
    # ...
  • a --schema, a neighbor to --json:

    pixi list --json --schema
    pixi task list --json --schema
    # ...

The generated schemata should have most of the properties of the existing, hand-made
manifest schema for downstreams over time:

  • provide $schema (probably stick with draft7)
  • provide $id which would resolve to a versioned URL on the docs site
  • be sensibly sorted and indented between versions
  • be self-contained and not references other URLs

A key enabler, mentioned in a few places, is schemars, already in Cargo.lock as a dependency of uv.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew featureshelp wantedMaintainers would like community input

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions