Skip to content

pkg: dune watch mode with autolocking #11614

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

Open
maiste opened this issue Apr 7, 2025 · 0 comments
Open

pkg: dune watch mode with autolocking #11614

maiste opened this issue Apr 7, 2025 · 0 comments
Assignees
Labels
feature-request User wanted features package management proposal RFC's that are awaiting discussion to be accepted or rejected rule Internal dune rules

Comments

@maiste
Copy link
Collaborator

maiste commented Apr 7, 2025

I'm opening this PR to discuss the best way to introduce the auto locking inside the watch-mode. Being able to auto-lock the dependencies will developing would be really useful. The solution I have in mind would remove some of the problem that were raised.

The solution would consist in 3 stages:

  1. First, we would need to track the dune.lock directory as a target of the dune pkg lock command and as an input for the dune build command. We could use the "promote" mechanism to make it changes the file in the source directory. This is what is currently used by dune fmt and we could imagine dune pkg lock following the same pattern.
  2. The next stage would be that in watch mode, when you change the dependencies in a dune-project or *.opam file, it would update the generated dune.lock entry only for the new package. We would provide the exact version we already have for the other packages. If it fails to build, we would ask the user to manually run dune pkg lock because it would mean a "strong" upgrade.
  3. To prevent the user from going into this auto lock mode, @Alizter suggested guarding it with an ``--auto-lock` flag. IMO, this is a good idea. It would allow users to quickly add their dependencies when beginning a project and later remove the flag when they don't expect to introduce dependencies.

Solving being the costly part in the process, doing it only with the flag would prevent it from happening when users don't expect it.

I have started to dig a bit in the code on how to do this. However, before going further, I would like to get your feedback on this @rgrinberg. WDTY of this solution?

@maiste maiste added feature-request User wanted features package management proposal RFC's that are awaiting discussion to be accepted or rejected rule Internal dune rules labels Apr 7, 2025
@maiste maiste assigned maiste and Leonidas-from-XIV and unassigned rgrinberg May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request User wanted features package management proposal RFC's that are awaiting discussion to be accepted or rejected rule Internal dune rules
Projects
None yet
Development

No branches or pull requests

3 participants