-
Notifications
You must be signed in to change notification settings - Fork 455
Update tutorial to use autolocking #12859
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
base: main
Are you sure you want to change the base?
Update tutorial to use autolocking #12859
Conversation
|
Unfortunately I had to remove a lot of output where the solution was displayed, because with autolocking the solution is not displayed anymore. I've opened #12865 to discuss how to improve the user experience in that case, giving a users a way to figure out which packages + versions were selected by the solver. |
c435b75 to
eb5bcf5
Compare
| packages are published in the opam-repository occasionally, Dune might pick | ||
| different solutions over time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't a very robust account of the dynamics at play. Whether or not new packages are published, different builds can end up with different dependencies based on a number of factors: the system run on, the which repos are pinned, whether or not the user has had connectivity, whether packages are marked unavailable, etc. I think it's better to just describe the core need that motivates locking. And you do that in the next paragraph. So maybe this sentence can be removed?
aad05d3 to
15a0e31
Compare
Sudha247
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to have this updated!
Some remarks below. I also found mentions of dune pkg lock in howto/use-opam-alongside-dune-package-management.rst and howto/homebrew-package.rst which we might want to check.
9e4d89d to
598ff93
Compare
|
Is this ready for another review? Or is it still being worked on? |
|
Yes, I welcome some reviews so maybe we can get it merged in time for 3.21. |
Signed-off-by: Marek Kubica <[email protected]>
Signed-off-by: Marek Kubica <[email protected]>
Signed-off-by: Marek Kubica <[email protected]>
Signed-off-by: Marek Kubica <[email protected]>
598ff93 to
eebe860
Compare
| longer than usual, as the dependencies need to be built first. Subsequent | ||
| builds where all dependencies have been built before will be just as fast as | ||
| before. | ||
| Since this is the first time we have run the build system after enabling package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this is getting folded in the collapsible dune-workspace. I'm not sure that is intended?
Sudha247
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone through the tutorial once to validate we get the expected results, and we do. I think this is good to go.
shonfeder
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few more suggestions, but they don't need to blocking.
| In this file we let Dune know to enable package management in the current | ||
| workspace. This way Dune will know that it is expected to install the | ||
| dependencies automatically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(re)reading this, the anthropomorphism of Dune stands out to me. I think we can be more direct, and know attributing any "knowing" ;)
| In this file we let Dune know to enable package management in the current | |
| workspace. This way Dune will know that it is expected to install the | |
| dependencies automatically. | |
| In this file we direct Dune to enable package management in the current | |
| workspace. This configures Dune to manage the declared dependencies automatically. |
|
|
||
| which will download and install the new dependencies and build our project as | ||
| before. | ||
| This will recongnize that the project depends on new packages. Thus it will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does 'this' refer to here?
| (lock_dir | ||
| (repositories overlay1 upstream1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, that is awkward :( seems to be leaking implementation details, but that can be addressed in some followup.
| Dune resolves dependencies by creating an internal lock directory | ||
| automatically. However, if an manually created lock directory exists in the | ||
| source, Dune will use that one instead. The default name of said lock directory | ||
| is `dune.lock`, and it can be created manually: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, it is confusing to talk about these internal implementation details in docs like this. Users shouldn't care what dune with its private dirs, they just need to know the user-facing behavior and properties. Referring to a "lock" directory that doesn't actually server to lock anything is going to get people confused, I predict.
| Dune resolves dependencies by creating an internal lock directory | |
| automatically. However, if an manually created lock directory exists in the | |
| source, Dune will use that one instead. The default name of said lock directory | |
| is `dune.lock`, and it can be created manually: | |
| If a lock directory exists in the source, Dune will use that to fix the exact version and source of dependencies. The default name of said lock directory | |
| is `dune.lock`. Lock directories are created with: |
| ## Create a lock directory manually | ||
|
|
||
| Dune resolves dependencies by creating an internal lock directory | ||
| automatically. However, if an manually created lock directory exists in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At minimum:
| automatically. However, if an manually created lock directory exists in the | |
| automatically. However, if a manually created lock directory exists in the |
|
|
||
| Whenever Dune encounters a `dune.lock` folder, it will use the set of | ||
| dependencies defined in the lock. It contains all the metadata about package | ||
| names and versions, their dependencies & source locations that are necesary to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| names and versions, their dependencies & source locations that are necesary to | |
| names and versions, their dependencies and source locations that are necessary to |
| Whenever Dune encounters a `dune.lock` folder, it will use the set of | ||
| dependencies defined in the lock. It contains all the metadata about package | ||
| names and versions, their dependencies & source locations that are necesary to | ||
| build the projects dependencies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| build the projects dependencies. | |
| build the project's dependencies. |
| The lock directory will not be updated until a new lock directory is created, | ||
| by rerunning `dune pkg lock`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The lock directory will not be updated until a new lock directory is created, | |
| by rerunning `dune pkg lock`. | |
| The lock directory will not be updated until `dune pkg lock` is rerun. |
| export the configuration of a switch. | ||
| ::: | ||
|
|
||
| Deleting the lock directory switches Dune back into automatically determining |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid possible confusion with switch in the note above:
| Deleting the lock directory switches Dune back into automatically determining | |
| Deleting the lock directory will cause Dune to fall back to automatically determining |
Updates to the tutorial to use autolocking (plus explain how to manually lock).
Closes #12796