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

More task JSON #1344

Open
bollwyvl opened this issue May 7, 2024 · 0 comments
Open

More task JSON #1344

bollwyvl opened this issue May 7, 2024 · 0 comments
Labels
✨ enhancement Feature request

Comments

@bollwyvl
Copy link
Contributor

bollwyvl commented May 7, 2024

Problem description

Thank you for pixi!

In looking at automating some of the drawings from #1139 (and interactive features beyond), there are a few CLI features that would be very helpful to have as (related) schema-constrained JSON:

https://pixi.sh/latest/schema/taskinfo/schema.json

pixi task info --json [--environment] [TASK...]
{
  "project_info": {
    "manifest_path": "~/pyproject.toml",
    "last_updated": "2024-05-07T12:37:52Z",
    "pixi_folder_size": null,
    "version": null,
    "configuration": []
  },
  "tasks": [
    {
      "name": "preflight",
      "environment": "default",
      "can_be_skipped": true,
      "cmd": "...",
      "cwd": null,
      "last_run": {
        "start": "2024-05-07T12:38:51Z",
        "end": "2024-05-07T12:38:52Z",
        "returncode": 0
      },
      "depends_on": [],
      "inputs": [],
      "outputs": [
        {
          "glob": "build/preflight.txt",
          "matches": [
            {
              "path": "build/preflight.txt",
              "cached_hash": "b68ce7cc6f8228ef",
              "disk_hash": "b68ce7cc6f8228ef"
            }
          ]
        }
      ]
    },
    {
      "name": "build",
      "environment": "default",
      "can_be_skipped": false,
      "cmd": "...",
      "cwd": "build",
      "last_run": null,
      "depends_on": [
        {
          "task": "preflight"
        }
      ],
      "inputs": [
        {
          "pattern": "build/preflight.txt",
          "matches": [
            {
              "path": "build/preflight.txt",
              "cached_hash": "b68ce7cc6f8228ef",
              "disk_hash": "b68ce7cc6f8228ef"
            }
          ]
        }
      ],
      "outputs": [
        {
          "pattern": "build/built.txt",
          "matches": []
        }
      ]
    }
  ]
}

https://pixi.sh/latest/schema/trace/schema.json

The other would be trace-level information, which would pretty much preclude interactive stdin:

pixi run -v --jsonl [--environment] [TASK]

I'm imagining this would be streaming JSONL, rather than a big slug emitted at the end with the return code, very similar to run -v. I haven't looked at how deeply the stdout and stderr of started processes are being managed, but that's a pretty big one to be able to reason about (otherwise one has to do a lot of sniffing), and would get even more complex if parallel execution were added.

{ "time": "2024-05-07T12:38:51.1Z", "severity": "DEBUG", "type": "pixi::schema", "message": "https://pixi.sh/latest/schema/trace/schema.json" }
...
{ "time": "2024-05-07T12:38:51.1Z", "severity": "DEBUG", "type": "pixi::config", "message": "Global config not found at /etc/pixi/config.toml" }
...
{ "time": "2024-05-07T12:38:51.2Z", "severity": "INFO", "type": "pixi::executable_task", "task": {"name": "preflight", "environment": "default"}, "can_be_skipped": true }
...
{ "time": "2024-05-07T12:38:51.3Z", "severity": "INFO", "type": "pixi::executable_task", "task": {"name": "build", "environment": "default"}, "stdout": "..." }
...
{ "time": "2024-05-07T12:38:51.4Z", "severity": "INFO", "type": "pixi::executable_task", "task": {"name": "build", "environment": "default"}, "status_code": 0 }

Hopefully much of this would pretty much be taken care of by flipping a switch somewhere in the logging infrastructure, but I don't really know where to look. There are likely conventions (of which I'm not aware) for field naming, but things like dates as UTC ISO8601 are fairly predictable.

With the above, pretty much any task-oriented UI could be built on top of the pixi CLI.

Getting up to an understandable env definition (much less feature-oriented UI) will be... harder to reason about, for sure (been there)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement Feature request
Projects
None yet
Development

No branches or pull requests

1 participant