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

feat: update --json #1446

Merged
merged 10 commits into from
Jun 7, 2024
Merged

Conversation

baszalmstra
Copy link
Contributor

@baszalmstra baszalmstra commented May 27, 2024

Fixes #1437

Schema:

{
  "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:

  • Documentation, add it to the reference/cli.md
  • Full record spec in json output

src/cli/update.rs Outdated Show resolved Hide resolved
@pavelzw
Copy link
Contributor

pavelzw commented May 27, 2024

Sounds good! Thanks ❤️ I'll update my diff tool 🚀

@wolfv
Copy link
Member

wolfv commented May 27, 2024

I am wondering if we should add a schema version just to be safe?

@pavelzw
Copy link
Contributor

pavelzw commented May 27, 2024

Schema version sounds good 👍🏻

@pavelzw
Copy link
Contributor

pavelzw commented May 28, 2024

https://github.com/pavelzw/pixi-diff-to-markdown is compatible with this version 👍🏻

i'll add some docs soon on how to ideally use this

@pavelzw
Copy link
Contributor

pavelzw commented May 28, 2024

Here are my ideas of how to use this in GitHub: pavelzw/pixi-pycharm#21

Either as a reusable workflow hosted in the prefix-dev org or as a simple example in the docs. The latter would be a bit more flexible, so I'm leaning a bit towards the latter.

@ruben-arts ruben-arts marked this pull request as draft May 30, 2024 05:42
@baszalmstra
Copy link
Contributor Author

I changed the output slightly, it now outputs the changed values as they appear in the lock-file.

    {
        "name": "typing_extensions",
        "before": {
          "version": "4.11.0",
          "url": "https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.11.0-pyha770c72_0.conda",
          "sha256": "a7e8714d14f854058e971a6ed44f18cc37cc685f98ddefb2e6b7899a0cc4d1a2",
          "md5": "6ef2fc37559256cf682d8b3375e89b80",
          "size": 37583,
          "timestamp": 1712330089194
        },
        "after": {
          "timestamp": 1717287863652,
          "size": 39706,
          "version": "4.12.1",
          "url": "https://conda.anaconda.org/conda-forge/noarch/typing_extensions-4.12.1-pyha770c72_0.conda",
          "sha256": "c50d61fe29cd2752943358037ee1107a60b44b8d32c464d18308d668b6494573",
          "md5": "26d7ee34132362115093717c706c384c"
        },
        "type": "conda"
      },

@baszalmstra
Copy link
Contributor Author

The schema is now:

{
    "version": 1,
    "environments": {
    	"<name>": {
			"<platform>": [
			    {
					"name": "<package_name>",
					"type": "conda"|"pypi"
					"before": {...} | null,
					"after": {...} | null,
					"explicit": bool,
				}
			]
        }
    }
}

@baszalmstra baszalmstra marked this pull request as ready for review June 7, 2024 11:44
@ruben-arts ruben-arts enabled auto-merge (squash) June 7, 2024 14:24
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read it, Ran it, Loved it, Liked it, Merged it!

@ruben-arts ruben-arts merged commit 418da69 into prefix-dev:main Jun 7, 2024
27 checks passed
jjjermiah pushed a commit to jjjermiah/pixi that referenced this pull request 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
tdejager added a commit that referenced this pull request Jun 18, 2024
depends on #1446

i'm still experimenting a bit with the output format, though, so the cli
interface of pixi-diff-to-markdown is not super stable yet. should we
include an updater in this repository as well?

---------

Co-authored-by: Tim de Jager <tdejager89@gmail.com>
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.

Add pixi update --json
4 participants