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

New Manifest.toml format: Pt 1. Teach Pkg new format, but default to old format #2561

Merged
merged 16 commits into from
Jun 7, 2021

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented May 12, 2021

Initial discussion in #2557

This is Part 1, which is intended to be backported to 1.6.2

  • Teach Pkg new manifest format with julia_version and manifest_format metadata fields, and package deps nested under a deps field
  • Still defaults to old format
  • Maintains format of any existing Manifest.toml
  • Warn if unknown manifest_format version is detected

Part 2: #2580

@IanButterworth IanButterworth requested a review from a team as a code owner May 12, 2021 02:54
@DilumAluthge DilumAluthge removed the request for review from a team May 12, 2021 03:00
@IanButterworth IanButterworth force-pushed the ib/new_manifest_minimum branch 2 times, most recently from 322e82e to dcebfee Compare May 12, 2021 04:16
@IanButterworth IanButterworth added the DO NOT MERGE Do not merge this PR! label May 13, 2021
@IanButterworth IanButterworth force-pushed the ib/new_manifest_minimum branch 2 times, most recently from 1fa2217 to 9bc451e Compare May 30, 2021 06:05
@IanButterworth IanButterworth force-pushed the ib/new_manifest_minimum branch from 9bc451e to 56cc7c2 Compare May 30, 2021 06:23
@IanButterworth
Copy link
Member Author

IanButterworth commented May 30, 2021

Updates:

  • Added julia_version and manifest_format fields
    The original idea was to keep this to just moving the packages to under a deps field, but I think it makes more sense from the Pkg call to properly version the format, and thus including manifest_format as a VersionNumber string seems the right way to do it. And introducing this new format as manifest format 2 it didn't seem to make sense to omit the julia_version field, given that's the main motivator for making this switch

  • Now the format of the manifest file is maintained when re-written.
    A @warn hints once (via maxlog=1) how the user can update to the new manifest format.
    image

Beyond reviewing, I think it would be good for others to try this PR out, on top of JuliaLang/julia#40765

Btw this is marked as do not merge to remind me that CI has been messed with.

@KristofferC
Copy link
Member

KristofferC commented May 30, 2021

Some thoughts:

  • I am not sure the warning should be added, at least not right away.
  • Perhaps there should be a good error when the manifest version is >= 3?
  • It would be good to add a test that shows that it is now possible to read the new format as well as that writing it works.

@IanButterworth
Copy link
Member Author

IanButterworth commented May 30, 2021

I am not sure the warning should be added, at least not right away.

I feel like a warning should be in 1.7 but maybe how this PR is right now isn't exactly what's needed for the backport to 1.6.2

For the backport I think it needs to default to writing to v1 format, and doesn't need to warn if it's maintaining a v2 manifest.

I can make the goal of this PR be the backport which can then be built on.

Perhaps there should be a good error when the manifest version is >= 3?

Perhaps a warning? "Unknown newer Manifest.toml format version detected, unexpected behavior may occur"

It would be good to add a test that shows that it is now possible to read the new format as well as that writing it works.

Yeah agreed. Also need to add tests to the Base PR

@IanButterworth IanButterworth force-pushed the ib/new_manifest_minimum branch from 56cc7c2 to d4a1e14 Compare May 30, 2021 19:20
@IanButterworth IanButterworth changed the title Core implementation of manifest format with package entries under deps field New Manifest.toml format: Pt 1. Teach Pkg new format, but default to old format May 30, 2021
@IanButterworth
Copy link
Member Author

Updated based on feedback.

In #2557 @davidanthoff suggested schemaversion for what is currently manifest_format. Would that be a better name?

Currently

# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.0-DEV.1199"
manifest_format = "2.0.0"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
...

@davidanthoff
Copy link

Just a minor question: does it make sense to use three-part versions for the manifest/schema version (whatever the name is, I don't really have a preference)? I think semver is not that useful for format versioning, or at least it is not entirely clear to me how one would use it for that. Maybe better to just use an integer for that and keep it simple?

@IanButterworth
Copy link
Member Author

IanButterworth commented May 30, 2021

Yeah three part is definitely excessive, but two might be useful. It only prints 3-part because that's the way VersionNumbers print in the TOML writer.

I'll convert to a 2-part string during the destructure before write. Also, happy to just do a single integer if others agree

Edit: Tests pass. The two "Run tests" ones are the only valid tests for now


Base.@kwdef mutable struct Manifest
julia_version::Union{Nothing,VersionNumber} = Base.VERSION
manifest_format::VersionNumber = v"1.0.0" # default to older flat format
Copy link
Member

Choose a reason for hiding this comment

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

Is the Manifest constructor actually ever called without these arguments being explicitly given? If not, I suggest the defaults are removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

src/manifest.jl Outdated Show resolved Hide resolved
@IanButterworth
Copy link
Member Author

CI needs re-running when the merged JuliaLang/julia#40765 works its way into the nightlies

@DilumAluthge
Copy link
Member

@KristofferC @StefanKarpinski Is this PR good to merge once CI turns green?

@KristofferC
Copy link
Member

LGTM now

@IanButterworth IanButterworth removed the DO NOT MERGE Do not merge this PR! label Jun 4, 2021
@IanButterworth
Copy link
Member Author

Windows has caught up, but there seems to be an unrelated issue popping up on MacOS sometimes #2596

@DilumAluthge DilumAluthge merged commit a3fc759 into JuliaLang:master Jun 7, 2021
@DilumAluthge
Copy link
Member

@fredrikekre or @IanButterworth Can you add this PR to the backports PR (#2592)?

IanButterworth added a commit to IanButterworth/Pkg.jl that referenced this pull request Jun 7, 2021
…old format (JuliaLang#2561)

* implement manifest format with deps field

* temporarily run CI on base PR

* simpler convert_flat_format_manifest

* default to old manifest format

* remove warning about maintaining old manifest format

* add unknown manifest format warning

* fix

* only print the major and minor part of the `manifest_format` to file

* add tests for manifest.toml formats

* add test for unknown manifest format warning

* provide manifest file path in warning, when available

* Revert "temporarily run CI on base PR"

This reverts commit d4a1e14.

* add support for unknown extra data in Manifest

* fixes

* add missing write_manifest method

* fix with windows-safe regex

Co-authored-by: KristofferC <[email protected]>
@IanButterworth
Copy link
Member Author

IanButterworth commented Jun 7, 2021

#2575 will need backporting before this. And might as well do #2581 too.
I just gave it a go and it needs a little help. I'll give it another go unless @fredrikekre gets there first

@IanButterworth IanButterworth deleted the ib/new_manifest_minimum branch June 7, 2021 03:21
@KristofferC
Copy link
Member

It would be good to clean up the commit message a bit when squash merging something big like this.

KristofferC pushed a commit that referenced this pull request Jun 10, 2021
…old format (#2561)

* implement manifest format with deps field

* temporarily run CI on base PR

* simpler convert_flat_format_manifest

* default to old manifest format

* remove warning about maintaining old manifest format

* add unknown manifest format warning

* fix

* only print the major and minor part of the `manifest_format` to file

* add tests for manifest.toml formats

* add test for unknown manifest format warning

* provide manifest file path in warning, when available

* Revert "temporarily run CI on base PR"

This reverts commit d4a1e14.

* add support for unknown extra data in Manifest

* fixes

* add missing write_manifest method

* fix with windows-safe regex

Co-authored-by: KristofferC <[email protected]>
(cherry picked from commit a3fc759)

New manifest format: Fix `upgrade_manifest` and raw dict entry for nothing (#2610)

(cherry picked from commit b8bea6c)
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.

5 participants