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

Add pixi update --json #1437

Closed
pavelzw opened this issue May 24, 2024 · 9 comments · Fixed by #1446
Closed

Add pixi update --json #1437

pavelzw opened this issue May 24, 2024 · 9 comments · Fixed by #1446
Labels
✨ enhancement Feature request

Comments

@pavelzw
Copy link
Contributor

pavelzw commented May 24, 2024

Problem description

#73 (comment)

I would like to create an internal dependabot replacement that calls pixi update and generates some markdown diffs. I planned to make the json-to-md renderer open source after that :)
I don't think it would make sense to let pixi create markdown directly since eventual dependabot/renovate config will probably do their own implementation.

@pavelzw pavelzw added the ✨ enhancement Feature request label May 24, 2024
@baszalmstra
Copy link
Contributor

What would you like to output of this command to look like?

@pavelzw
Copy link
Contributor Author

pavelzw commented May 24, 2024

{
  "py38": {
    "linux-64": {
      "python": {
        "before": {
          "version": "3.9.0",
          "build": "h12debd9_0"
        },
        "after": {
          "version": "3.9.0",
          "build": "h12debd9_0"
        },
        "changed": "no" // one of no, build, major, minor, patch, added, removed
        // if added or removed, the before or after are null
      },
      "polars": {
        "before": {
          "version": "0.10.0",
          "build": "py38h1f7f2b9_0"
        },
        "after": {
          "version": "0.10.1",
          "build": "py38h1faeeb9_1"
        },
        "changed": "patch"
      }
...

how about something like this?

@baszalmstra
Copy link
Contributor

Seems simple enough!

Just the changed is a bit more complex. Not all versions are semver based and both the version and the build number can be changed at the same time. Do you really need this field?

@pavelzw
Copy link
Contributor Author

pavelzw commented May 24, 2024

I would also be fine with no, added, removed, newer, older, changed or no, added, removed, changed and i would do the version magic with a custom tool.

@baszalmstra
Copy link
Contributor

But wouldnt this already be present from the fact that "before" and "after" exist or not?

  • added - only "after"
  • removed - only "before"
  • changed - "after" and "before"
  • no - package not present? Or neither and "after" or a "before"

@pavelzw
Copy link
Contributor Author

pavelzw commented May 24, 2024

yes, that's a bit smarter than my idea 😅 then let's not include changed at all

@pavelzw
Copy link
Contributor Author

pavelzw commented May 24, 2024

we probably also need to add pypi dependencies there:

{
  "py38": {
    "linux-64": {
      "python": {
        "before": {
          "version": "3.9.0",
          "build": "h12debd9_0"
        },
        "after": {
          "version": "3.9.0",
          "build": "h12debd9_0"
        },
        "type": "conda"
      },
      "polars": {
        "before": {
          "version": "0.10.0"
        },
        "after": {
          "version": "0.10.1"
        },
        "type": "pypi"
      }
...

how about this?

@baszalmstra
Copy link
Contributor

Sure thing!

@pavelzw
Copy link
Contributor Author

pavelzw commented May 26, 2024

Almost done with the markdown generator 🤩
One other thing I would love to have: an indicator whether the dependency is explicit (i.e. defined in our pixi.toml) or not.

{
  "py38": {
    "linux-64": {
      "python": {
        "before": {
          "version": "3.9.0",
          "build": "h12debd9_0"
        },
        "after": {
          "version": "3.9.0",
          "build": "h12debd9_0"
        },
        "type": "conda",
        "explicit": true
      },
      "polars": {
        "before": {
          "version": "0.10.0"
        },
        "after": {
          "version": "0.10.1"
        },
        "type": "pypi",
        "explicit": false
      }
...

@baszalmstra baszalmstra mentioned this issue May 27, 2024
2 tasks
ruben-arts pushed a commit that referenced this issue Jun 7, 2024
Fixes #1437

Schema:

```json
{
  "environment": {
    "linux-64": [
    {
        "name": "zstd",
        "before": {
          "version": "1.5.5",
          "build": "hfc55251_0"
        },
        "after": {
          "version": "1.5.6",
          "build": "ha6fb4c9_0"
        },
        "type": "conda"
        "explicit": false
      }
    ]
  }
}
```

@pavelzw Let me know what you think!

I changed to an array instead of a dictionary because a package changing
from conda to pypi is represented as a removal followed by an insert.

The `explicit` flag is only present if its value is `true`. 

@ruben-arts This is missing a test! Waiting for Pavel to give me the
green light first.

### TODO:
- [x] Documentation, add it to the reference/cli.md
- [x] Full record spec in json output
jjjermiah pushed a commit to jjjermiah/pixi that referenced this issue Jun 11, 2024
Fixes prefix-dev#1437

Schema:

```json
{
  "environment": {
    "linux-64": [
    {
        "name": "zstd",
        "before": {
          "version": "1.5.5",
          "build": "hfc55251_0"
        },
        "after": {
          "version": "1.5.6",
          "build": "ha6fb4c9_0"
        },
        "type": "conda"
        "explicit": false
      }
    ]
  }
}
```

@pavelzw Let me know what you think!

I changed to an array instead of a dictionary because a package changing
from conda to pypi is represented as a removal followed by an insert.

The `explicit` flag is only present if its value is `true`. 

@ruben-arts This is missing a test! Waiting for Pavel to give me the
green light first.

### TODO:
- [x] Documentation, add it to the reference/cli.md
- [x] Full record spec in json output
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

Successfully merging a pull request may close this issue.

2 participants