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

Novice user experience #196

Open
xldenis opened this issue Mar 6, 2023 · 6 comments
Open

Novice user experience #196

xldenis opened this issue Mar 6, 2023 · 6 comments

Comments

@xldenis
Copy link

xldenis commented Mar 6, 2023

I'm just trying out drom for a small project and wanted to open an issue with the various problems / issues I'm encountering. I hope this will be useful for the maintainers.

  1. The README in this project contains no example of the installation / usage of drom. I think a simple: opam install drom; drom new project; drom build example would be great. Could also be on the website homepage.
  2. My drom generated project fails to build with the following error:
drom: Entering directory '/Users/xavier/Code/why3-tools'
# Run eval $(opam env) to update the current shell environment
[NOTE] It seems you have not updated your repositories for a while. Consider updating them with:
       opam update

[ERROR] Package conflict!
  * Missing dependency:
    - ocaml-base-compiler = 4.10.0 | ocaml-system < 4.10.1~ | ocaml-variants < 4.10.1~
    unmet availability conditions: '!(os = "macos" & arch = "arm64")'
    unmet availability conditions, e.g. 'sys-ocaml-version = "4.10.0"'
    unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'

No solution found, exiting
Error: Command 'opam install -y ocaml.4.10.0' exited with error code 20

I would have expected drom to set up my project specific opam switch and load it if necessary.

  1. No lockfiles? One of the biggest things I was hoping drom would do is fix one of the major issues with opam by enabling lock files by default but this does not seem to be the case?
  2. No way to specify pinned dependencies in package.toml?
@lefessan
Copy link
Member

Thanks for your feedback !

  1. Good advice ! I am going to improve the README.md in a few days with such a simple example.
  2. I don't really understand the error. By default, drom sets up a local Opam switch _opam, but not a local opam installation (it still relies on $HOME/.opam/). Version 4.10.0 of OCaml is not available on macos anymore ?
  3. I didn't know how cargo dealt with lockfiles until recently. It sounds quite easy to implement, I will try in the next day before the official release of 0.9.0.
  4. I think the current way would be to use
[fields]
opam-trailer = """
pin-depends: [...]
"""

@xldenis
Copy link
Author

xldenis commented Mar 10, 2023

Thanks for your feedback !

  1. Good advice ! I am going to improve the README.md in a few days with such a simple example.

  2. I don't really understand the error. By default, drom sets up a local Opam switch _opam, but not a local opam installation (it still relies on $HOME/.opam/). Version 4.10.0 of OCaml is not available on macos anymore ?

It was probably never available for ARM macs, might I suggest to defaulting for the latest stable ocaml when generating a fresh project? It seems like that should be the correct choice in new projects.

  1. I didn't know how cargo dealt with lockfiles until recently. It sounds quite easy to implement, I will try in the next day before the official release of 0.9.0.

Awesome! This is one of the core features of cargo/bundler to me.

If there were an additional way to prevent any manually installed opam packages from infecting the build that would be ideal (though probably harder).

The core problem I'm hoping to solve is that I should be able to clone a project on any random machine that has installed drom, run drom build and have a working compilation.
No missing deps, bad pins etc...

  1. I think the current way would be to use

[fields]

opam-trailer = """

pin-depends: [...]

"""

Do you think it would make sense if the package.toml adopts a similar dependency syntax to rust, in cargo you can have

Lib-foo = { version = "blah", git = "url" }

To specify a git dependency. I would imagine that drom handles creating the pin if necessary.

@lefessan
Copy link
Member

I think the current way would be to use: opam-trailer = "[...]

Actually, after revisiting the code, I think it does not work for pin-depends. drom creates an opam file gathering information from all the other opam files to install the dependencies, so the opam-trailer is not considered.

Clearly, the solution is around what you propose, Lib-foo = { version = "blah", git = "url" } that would generate the corresponding pin-depend in the opam files.

@lefessan
Copy link
Member

In the new master version:

  • Lockfiles:

    • opam is always called with --locked to use lockfiles
    • opam lock is called after dependency installation, and a file $PROJECT-deps.opam.locked is created in the root directory. If it is present at the next install (or committed in git), it will be used by opam install --locked
  • For pin-depends, I used libXXX = { pin = "https://..." }, and libXXX = { pin = "...", version = "=VERSION" } for versioned pinning. This should generate pin-depends field in the corresponding opam file.

@lefessan
Copy link
Member

Oups, PR not merged yet...

@lefessan
Copy link
Member

Now, it was merged :-)

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

No branches or pull requests

2 participants