In anticipation of the forthcoming OCaml 5 release—and hot on the heels of its beta release—we are thrilled to announce the alpha release of the OCaml Platform Installer.
As a reminder, the OCaml Platform is the recommended toolchain for developers to work with OCaml.
The Platform Installer allows the user to easily setup OCaml’s development environment, both for a first-time installation and for any new opam switches.
You can try it now by following the installation instructions, but TL;DR, you can install it with
$ bash < <(curl -sL https://github.com/tarides/ocaml-platform-installer/releases/latest/download/installer.sh)
And run it to install the Platform in your opam switch with
$ ocaml-platform
Don’t hesitate to open an issue if you encounter any problem!
Update of the Platform State
As part of the work on the Installer, we’ve updated the state of the Platform to make it up to date and clarify the requirements to include a project in the Platform. Here are some of the notable changes:
-
odoc
has been promoted from Incubate to Active - OCamlformat has been promoted from Incubate to Active
-
ppxlib
and other metaprogramming frameworks have been removed from the Platform (andppxlib
is now documented as the official way to do metaprogramming, as part of the official OCaml documentation)
You can see the complete changes on the corresponding PR.
In parallel, we also want to make the Platform more open and transparent. To do this, we want to provide a clear governance model that can be driven by the community. The governance model should answer questions like:
- How can I incubate my project in the Platform?
- Who decides when a project can be promoted?
- How to discuss changes that would impact multiple Platform projects?
We’re currently following the OCaml.org’s governance, but are exploring new ways to govern the OCaml Platform.
We are leaning toward an RFC process for this, but we are still discussing the alternatives and how this could take shape. We will continue to experiment on the best governance model for the Platform with the project maintainers in the coming months, and we will publish the resulting governance on OCaml.org.
Platform Installer
The Platform Installer provides the best way to install OCaml and the recommended development tools for both newcomers and existing users.
Simplicity. It aims at replacing the existing installation steps with a much simpler workflow.
To install the Platform Installer ocaml-platform
, you can run:
$ bash < <(curl -sL https://github.com/tarides/ocaml-platform-installer/releases/latest/download/installer.sh)
This script will install opam, if not already present in the system, and the latest version of ocaml-platform
.
Then, to install the Platform tools:
$ ocaml-platform
If opam is not initialised, this command will initialise it. Then it will proceed to installing the Platform tools in the current opam switch.
For first-time users, the above two lines will set them up with a working environment that’s complete enough to hack comfortably with OCaml.
Speed. In order to speed up the process of installing development tools, the Installer caches the binaries to avoid for redundant compilation. For instance, you will only need to compile ocamlformat
once per version of the tool.
However, some tools such as Merlin depend on the OCaml version. For those, the Installer’s cache distinguishes the binaries, depending on the version of the tool as well the OCaml version it was compiled with.
Integration. The Installer integrates the development tools it installs as opam packages to make it fully aware of what has been installed. The binary provided by the Installer for the dune
tool will allow the installation of any package with a Dune dependency without reinstalling it.
However, some development tools include libraries in their opam package that are not provided by the Installer. In this case, installing the original opam package for the tool will replace the one provided by ocaml-platform
.
The opam packages installed by ocaml-platform
are dependency-free. This means that installing specific versions of your development tools will never mess with the actual dependencies of your project!
The Tools Installed
The list of tools installed by ocaml-platform
will ultimately be the platform tools listed in the Platform Docs as either Active and Incubate. Currently, this list is still incomplete for different reasons, such as keeping installation time short for new users, the number of dependencies, or other technical constraints.
The set of installed tools already provides a complete working environment, with:
- A build system: Dune
- A documentation generator:
odoc
- A code formatter: OCamlformat
- A release helper:
dune-release
- Editor integration:
ocaml-lsp
and Merlin.
Next Steps
There’s still a lot to do!
Governance. As mentioned above, we should have a clear governance model for how incubation and promotions happen in the Platform, who decides, and which criterias are applied. This should obviously be an open process driven by the community; however, we want to make sure that we propose a governance model that will work well, so we’re still discussing alternatives and experimenting on some options. We’d love your input on this, so expect a Discuss post with a proposed governance model for the Platform soon. Don’t hesitate to reach out to us before then if you want to get involved!
Editor Integration. While the Installer is a step forward towards a simple way to install OCaml, the UX for newcomers can still be improved. We plan to integrate the Installer to the official VSCode plugin. This will provide a way to get a complete development environment in only a few clicks directly in the editor. We will also explore how to make the setup of Emacs and Vim more straighforward.
Remote Cache. In order to further reduce the time taken to start hacking on a project, we are working on a remote cache for the Installer. The cache will be populated by a CI and would remove the need for compiling the tools locally. The local cache and compilation mechanism would still be used as a fallback if the remote repo is down or incomplete (such as for a pinned compiler).
Acknowledgments
Thank you to the developers and alpha-testers who contributed to the Plaform Installer project, particularly the Tarides engineers who have been driving the development:
We’d also like to thank our major funder Jane Street for supporting our work to improve OCaml’s installation experience!