caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Louis Gesbert <louis.gesbert@ocamlpro.com>
To: Yawar Amin <yawar.amin@gmail.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Build-/Installation-Tools - not enogh of them?
Date: Fri, 30 Nov 2018 16:23:11 +0100	[thread overview]
Message-ID: <3335300.gsrt7Ya9Qa@agaric> (raw)
In-Reply-To: <CAJbYVJLR7GqHgUC02Yfge7yJhuKbTW8eEab4-oaccrGcMfP7=g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 9128 bytes --]

Thanks all for this input. While working on the intrinsics and details of the tools, it's easy to lose the big picture, and the very important point of view of the newcomers.

So first, as the main developper of opam 2.0, I'd like to say that we have been putting a lot of work in it, and a large part of the effort was to improve for convenience, and the many use-cases that weren't supported before — including, but not limited to, reproducible build environments, and project-local sandboxes, a.k.a. switches.

The documentation, however, is severly lacking at the moment on all these new features, and the preferred and simplest ways to accomplish all the basic tasks. For all asking about the detailed formats, we have a fairly complete manual [1], and the API should be fairly well documented [2], but indeed, it's way too detailed to be the first documentation you would get to.

Let me assure you however that everything is slowly getting into place for an easier approach for everyone. I'll go below through the "typical workflow" you propose, checking what is here or not, but let's first focus on the users rather than the developers:

- installing ocaml:
  indeed, if not easily available for your system, the easiest is to install opam, then just run `opam init`. (Yes, we should be explicit in the doc that _this_ is the command that will install the compiler)

- installing a given package, and assuming opam is installed and initialised:

   * if in the repository, just one `opam install` command should be all you need

   * otherwise, if your source is available somewhere and contains an opam package definition file, `opam pin URL` is everything you need (URL pointing to an archive, or a git repository, etc.). We could merge this use-case into `opam install` for better discoverability.

   * if not and/or you want to build the project manually from a clone, the support has been much improved in opam 2, so that you can for example document specific pinned dependencies, or a "locked" development state (see opam-lock [3] to do that automatically). Then e.g. `opam switch create . --locked` will recreate a local switch with the exact same development configuration, and install the project in it. `opam install . --locked` also works, if you don't want the local sandbox.

- it has been mentionned already in this thread, but the `opam bundle` plugin can make distribution easier by including the whole OCaml + opam + package environment in a single, self-building self-extracting archive. At the cost of rebuilding everything on installation. A new release is pending [4]. Yes, it's yet another tool, but with its straight-forward interface and everyting explained in its 100-lines, included manpage, I find the criticism uncalled for. Not a silver bullet by any means, but it fits some use-cases.

As for using wrapping Makefiles, they are nice for simple build-system calls, and I like them if only to document the entry-point, but shouldn't IMHO mess with the packaging system. Note also that the main purpose of `opam` files is actually to document the building commands of any project, taking into account all OS specificities, and in an easily understandable format. I personally find that having clear and simple build instructions arout the top of the README is enough.

Once properly documented from the opam side (huh), I expect project maintainers to be able to put simple setup + installation instructions at the top of their READMEs, so that users who don't care about OCaml or opam just need to copy-paste them to get the environment setup and the project compiled. As far as I understand it now, this is where the problem really stands. To avoid having to look anything up or learning about exotic build system, this is the best compromise IMHO.

I'd also like to point out that this is not specific to OCaml, and I believe all language package managers / build systems suffer from these issues: I for one struggle every time I have to use something building with NPM, and they don't generally provide Makefiles. Of course, with a tool as popular as NPM, the problem is less visible because you have to go through it anyway. So we do need to improve documentation and simplify basic workflows as much as possible, but expecting people to work with OCaml without learning any of the tooling is unrealistic (unless they stick to an online IDE or e.g. Learn-OCaml, and even that is tooling in some form).


Let me now go through your "typical workflow":

---

> cd some-ocaml-proj
> opam install # Switches compiler if necessary and installs and locally
> caches package dependencies

You can do this with `opam switch create .`
Since "if necessary" is pretty subjective, just run `opam install .` if you prefer to share the environment with other projects.

> opam build

`opam install .`

> opam run # Automatically builds if necessary

there is no package←→executable bijection, so I don't see how this would work? (same as for OS-level packages)
see below, but this might be `dune exec <command>`

> opam test # Ditto

indeed here we enter the domain where the separation between build system and packaging system can hurt. You can run `opam install . --with-test`, but probably want `dune runtest` instead.

> opam package # Ditto; --upload option can immediately upload to opam

at this point you must already have a package definition available ? Or do you mean creating a release archive ?
If your source is hosted on Github, you only need to push a tag and run `opam publish` (you otherwise need to provide an URL for the source archive and that's it).

> opam doc # Builds documentation with ocamldoc or whatever
> opam login -u user -p password

I am not sure what you have in mind here. `opam publish` will go through Oauth authentification with Github for submitting your new package.

---


As one last note, let me mention that we are right now discussing:
- better integration of opam and dune
- integration of system dependency handling ("depexts") into opam


Hope this helps, feedback and questions welcome.

Louis Gesbert — OCamlPro




[1] https://opam.ocaml.org/doc/Manual.html
[2] https://opam.ocaml.org/doc/api/index.html
[3] https://github.com/AltGr/opam-lock
[4] https://github.com/ocaml/opam-repository/pull/13064

> - Yawar Amin, 26/11/2018 11:41 -
> If anyone would like to chime in and say that OCaml build and packaging
> system is not that complicated, I would recommend first looking at
> https://github.com/rizo/awesome-ocaml#package-management . IMHO we need to
> seriously look at consolidating efforts around OPAM for package management,
> packaging, building, testing and running. All the serious language-specific
> package managers do it, it's a proven strategy and it simplifies life for
> the developer.
> 
> This could be a typical workflow:
> 
> cd some-ocaml-proj
> opam install # Switches compiler if necessary and installs and locally
> caches package dependencies
> opam build
> opam run # Automatically builds if necessary
> opam test # Ditto
> opam package # Ditto; --upload option can immediately upload to opam
> opam doc # Builds documentation with ocamldoc or whatever
> opam login -u user -p password
> 
> Regards,
> 
> Yawar
> 
> On Mon, Nov 26, 2018 at 5:15 AM Oliver Bandel <oliver@first.in-berlin.de>
> wrote:
> 
> > Hello,
> >
> > a while ago it looked like there were not enough build- and
> > installation-tools
> > for OCaml. I remember some discussions about that.
> >
> > Now it seems to me that there are a lot of them.
> > So, developers can pick the one they know about.
> >
> > For all these tools there might be good reasons to use them, and those
> > developers who looked at these tools and choose them for their projects,
> > will
> > know them well enough.
> >
> > The situation differs, if one wants to package the written software,
> > and one needs to know many of those tools, just to compile the stuff.
> > So, when one just wants to compile and install some software,
> > just for that, it would take much effort to learn the different
> > build-tools.
> >
> > So, packaging has become more complicated, even though for the developers
> > these tools may save time.
> >
> > It would be nice if people who used one of the many new building tools
> > could provide a Makefile that allows just to type
> > "make" and "make install", instead of expecting everyone who wants to
> > compile
> > the software to first learn just-another-build-tool.
> >
> > Also it would be good, to mention early, which installation tools
> > (make-dependencies)
> > are in use, and too mention needed packages (opam or others) to just build
> > the stuff.
> >
> > Thanks and regards,
> >   Oliver Bandel
> >
> > --
> > Caml-list mailing list.  Subscription management and archives:
> > https://sympa.inria.fr/sympa/arc/caml-list
> > https://inbox.ocaml.org/caml-list
> > Forum: https://discuss.ocaml.org/
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> >
> 
> 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2018-11-30 16:01 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 10:14 Oliver Bandel
2018-11-26 16:41 ` Yawar Amin
2018-11-26 16:57   ` Julia Lawall
2018-11-26 17:15     ` Yawar Amin
2018-11-26 20:33       ` Julia Lawall
2018-11-26 20:47         ` Yawar Amin
2018-11-26 20:54           ` Julia Lawall
2018-11-26 21:19             ` Yawar Amin
2018-11-26 21:29               ` Julia Lawall
2018-11-26 22:16                 ` SP
2018-11-27  5:24                   ` Malcolm Matalka
2018-11-28  0:20                     ` SP
2018-11-27  6:11                   ` Julia Lawall
2018-11-27  8:45                     ` SF Markus Elfring
2018-11-28  0:04                     ` SP
2018-11-27  9:27                 ` SF Markus Elfring
2018-11-27 10:08                   ` Julia Lawall
2018-11-27 10:28                     ` [Caml-list] Build-/Installation-Tools - not enough " SF Markus Elfring
2018-11-27 10:34                       ` Julia Lawall
2018-11-27 11:05                         ` Jean-Francois Monin
2018-11-27 11:00                           ` Kakadu
2018-11-27 13:18                             ` Malcolm Matalka
2018-11-28  1:52                               ` Francois Berenger
2018-11-28 15:21                             ` Ian Zimmerman
2018-11-27 13:07                     ` [Caml-list] Build-/Installation-Tools - not enogh " Jean-Marc Alliot
2018-12-06 12:21               ` Richard W.M. Jones
2018-12-06 16:10                 ` Yawar Amin
2018-12-06 20:18                   ` Richard W.M. Jones
2018-12-07  7:31                     ` Daniel Bünzli
2018-12-07  7:44                       ` [Caml-list] What happened to the 'ancient' library for OCaml? Francois Berenger
2018-12-07  8:24                         ` Richard W.M. Jones
2018-12-07  8:26                       ` [Caml-list] Build-/Installation-Tools - not enogh of them? Richard W.M. Jones
2018-12-07  9:01                         ` Daniel Bünzli
2018-12-07 13:22                       ` Stéphane Glondu
2018-12-08  0:58                         ` Daniel Bünzli
2018-12-13 23:45                           ` SP
2018-12-11  2:47                         ` Francois Berenger
2018-12-07 13:12                     ` Malcolm Matalka
2018-11-27 14:32             ` Anil Madhavapeddy
2018-11-27 14:35     ` Gerd Stolpmann
2018-11-30 15:23   ` Louis Gesbert [this message]
2018-11-26 22:44 ` Jaap Boender
2018-11-26 22:55   ` Simon Cruanes
2018-11-27 13:29     ` Oliver Bandel
2018-11-27 13:45       ` [Caml-list] Build-/Installation tools - not enough " SF Markus Elfring
2018-11-27 15:06       ` [Caml-list] Build-/Installation-Tools - not enogh " Simon Cruanes
2018-11-27 15:49         ` Oliver Bandel
2018-11-27 16:27           ` Daniel Bünzli
2018-11-27 17:46             ` Jaap Boender
2018-11-28 11:47               ` Jeremie Dimino
2018-12-01 15:12                 ` [Caml-list] How to start with the curren toolset? Hendrik Boom
2018-12-01 16:56                   ` Ian Zimmerman
2018-12-02 15:27                   ` Daniel Bünzli
2018-12-02 23:36                     ` David Allsopp
2018-12-03  2:19                     ` [Caml-list] let's give a try at opam-bundle Francois Berenger
2018-12-02 17:44                   ` [Caml-list] confusing message in opam installer Hendrik Boom
2018-12-02 17:50                     ` Julia Lawall
2018-12-05 19:07                       ` Raja Boujbel - OCamlPro
2018-11-27 16:27           ` [Caml-list] Build-/Installation tools - not enough of them? SF Markus Elfring
2018-11-27 17:09           ` [Caml-list] Build-/Installation-Tools - not enogh " Markus Mottl
2018-11-30 12:41             ` [Caml-list] <DKIM> " Vu Ngoc San
2018-12-07 15:19             ` [Caml-list] " oliver
2018-11-27 16:52       ` Hendrik Boom
2018-11-27 14:11     ` Jaap Boender
2018-11-27  2:33   ` Francois Berenger
2018-11-27 13:31     ` Oliver Bandel
2018-11-27 13:40 ` John F Carr
2018-11-30 16:31   ` Louis Gesbert
2018-12-01  5:01     ` Louis Roché
2018-12-03  0:16     ` Edwin Török

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3335300.gsrt7Ya9Qa@agaric \
    --to=louis.gesbert@ocamlpro.com \
    --cc=caml-list@inria.fr \
    --cc=yawar.amin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).