OCaml Changelog

RSS

Read the latest releases and updates from the OCaml ecosystem.

opam 2.3.0

Feedback on this post is welcomed on Discuss!

As mentioned in our talk at the OCaml Workshop 2024, we decided to switch to a time-based release cycle (every 6 months), starting with opam 2.3.

As promised, we are very pleased to announce the release of opam 2.3.0, and encourage all users to upgrade. Please read on for installation and upgrade instructions.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Major breaking change: extra-files

When loading a repository, opam now ignores files in packages' files/ directories which aren't listed in the extra-files field of the opam file. This was done to simplify the opam specification where we hope the opam file to be the only thing that you have to look at when reading a package specification. It being optional to list all files in the extra-files: field went against that principle. This change also reduces the surface area for potential file corruption as all extra-files must have checksums.

This is a breaking change and means that if you are using the files/ directory without listing them in the extra-files: field, you need to make sure that all files in that directory are included in the extra-files field. The resulting opam file remains compatible with all previous opam 2.x releases.

If you have an opam repository, you should make sure all files are listed so every packages continues to work without any issue, which can be done automatically using the opam admin update-extrafiles command.

Major changes

  • Packages requiring an unsupported version of opam are now marked unavailable, instead of causing a repository error. This means an opam repository can now allow smoother upgrade in the future where some packages can require a newer version of opam without having to fork the repository to upgrade every package to that version as was done for the upgrade from opam 1.2 to 2.0

  • Add a new opam list --latests-only option to list only the latest versions of packages. Note that this option respects the order options were given on the command line. For example: --available --latests-only will first list all the available packages, then choose only the latest packages in that set; while --latests-only --available will first list all the latest packages, then only show the ones that are available in that set

  • Fix and improve opam install --check, which now checks if the whole dependency tree of the package is installed instead of only the root dependencies

  • Add a new --verbose-on option to enable verbose output for specified package names. Thanks to @desumn for this contribution

  • Add a new opam switch import --deps-only option to install only the dependencies of the root packages listed in the opam switch export file

  • opam switch list-available no longer displays compilers flagged with avoid-version/deprecated unless --all is given, meaning that pre-release or unreleased OCaml packages no longer appear to be the latest version

  • opam switch create --repositories now correctly infers --kind=git for URLs ending with .git rather than requiring the git+https:// protocol. This is consistant with other commands such as opam repository add. Thanks to @Keryan-dev for this contribution

  • opam switch set-invariant now displays the switch invariant using the same syntax as the --formula flag

  • The builtin-0install solver was improved and should now be capable of being your default solver instead of builtin-mccs+glpk. It was previously mostly only suited for automated tasks such as Continuous Integration. If you wish to give it a try, simply calling opam option solver=builtin-0install (call opam option solver= restores the default)

  • Most of the unhelpful conflict messages were fixed. (#4373)

  • Fix an opam 2.1 regression where the initial pin of a local VCS directory would store untracked and ignored files. Those files would usually be cleaned before building the package, however git submodules would not be cleaned and would cause issues when paired with the new behaviour added in 2.3.0~alpha1 which makes opam error when git submodules fail to update (it was previously a warning). (#5809)

  • Fix the value of the arch variable when the current OS is 32bit on a 64bit machine (e.g. Raspberry Pi OS). (#5949)

  • opam now fails when git submodules fail to update instead of ignoring the error and just showing a warning

  • opam's libraries now compile with OCaml >= 5.0 on Windows

  • Fix the installed packages internal cache, which was storing the wrong version of the opam file after a build failure. This could be triggered easily for users with custom repositories with non-populated extra-files. (#6213)

  • Several improvements to the pre-built release binaries were made:

    • The Linux binaries are now built on Alpine 3.20
    • The FreeBSD binary is now built on FreeBSD 14.1
    • The OpenBSD binary is now built on OpenBSD 7.6 and loses support for OpenBSD 7.5 and earlier
    • Linux/riscv64 and NetBSD/x86_64 binaries are now available

And many other general, performance and UI improvements were made and bugs were fixed. You can take a look to previous blog posts. API changes and a more detailed description of the changes are listed in:

This release also includes PRs improving the documentation and improving and extending the tests.

Please report any issues to the bug-tracker.

We hope you will enjoy the new features of opam 2.3!

Feedback on this post is welcomed on Discuss!

We're happy to announce the first and hopefully only release candidate of opam 2.3.0.

This version does not have any significant change compared to the previous 2.3.0~beta2 release and we hope the final release to also have no significant change. Regardless, we invite users to test this version to make sure there isn't any regressions.

Unless a regression is spotted or another problem arises, we hope to have the final release of 2.3.0 out on the 12th of November.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~rc1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~rc1"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

Dune 3.16.1

We're happy to announce the release of Dune 3.16.1.

This is a patch release that fixes an issue with OCaml.5.3.0 and C++ flags.

See full changelog

Fixed

  • Call the C++ compiler with -std=gnu++11 when using OCaml >= 5.0 (#10962, @kit-ty-kate)

    Added

Feedback on this post is welcomed on Discuss!

We're happy to announce the second beta release of opam 2.3.0.

As this version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

Compared to the previous 2.3.0~beta1 release, the main change is:

  • Fix a regression in the detection of the current terminal size that leads to opam output that tries to fit itself into 80 columns regardless of the current terminal size (#6243).

  • A NetBSD/x86_64 pre-built release binary is now available

You can view the full list of changes, including API changes, in the release note.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~beta2"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~beta2"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

Feedback on this post is welcome on Discuss!

We're happy to announce the first beta release of opam 2.3.0. Compared to the previous 2.3.0~alpha1 release, you can view the full list of changes in the release note.

This version is a beta, so we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

  • Fix an opam 2.1 regression where the initial pin of a local VCS directory would store untracked and ignored files. Those files would usually be cleaned before building the package; however, Git submodules would not be cleaned and would cause issues when paired with the new behaviour added in 2.3.0~alpha1, which makes an opam error when Git submodules fail to update (it was previously a warning). (#5809)

  • Fix a regression which would make opam crash on platforms where getconf LONG_BIT is not available (e.g., OpenBSD). (#6215)

  • Fix the installed packages internal cache, which was storing the wrong version of the opam file after a build failure. This could be triggered easily for users with custom repositories with non-populated extra-files. (#6213)

  • Fix a regression in lint W59 with local URLs that are not archives. (#6218)

  • Fix the compilation of opam on Windows with OCaml >= 5.0 (again)

  • Several improvements to the prebuilt release binaries were made:

    • The Linux binaries are now built on Alpine 3.20
    • The FreeBSD binary is now built on FreeBSD 14.1
    • The OpenBSD binary is now built on OpenBSD 7.6 and loses support for OpenBSD 7.5 and older
    • A Linux/riscv64 binary is now available

API changes are denoted in the release note linked above. This release also includes a couple of PRs improving and extending the tests.

Try It!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~beta1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~beta1"

or download manually from the GitHub "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

We are happy to announce the joint release of Merlin 5.2.1-502 and 4.17.1. This release adds many new features to Merlin including the ability to add hints to a source tree, serch for values using a type signature and expanding PPX annotations to preview their source code. There are also bug fixes for both the Merlin binary and editor modes.

More information can be found in the Discuss announcement.

Contributions are always welcome at Merlin | Issues

See full changelog
  • merlin binary
    • A new WRAPPING_PREFIX configuration directive that can be used to tell Merlin what to append to the current unit name in the presence of wrapping (ocaml/merlin#1788)
    • Add -unboxed-types and -no-unboxed-types as OCaml ignored flags (ocaml/merlin#1795, fixes ocaml/merlin#1794)
    • Destruct: Refinement in the presence of optional arguments (ocaml/merlin#1800 ocaml/merlin#1807, fixes ocaml/merlin#1770)
    • Implement new expand-node command for expanding PPX annotations (ocaml/merlin#1745)
    • Implement new inlay-hints command for adding hints on a source tree (ocaml/merlin#1812)
    • Implement new search-by-type command for searching values by types (ocaml/merlin#1828)
    • Canonicalise paths in occurrences. This helps deduplicate the results and
    • Show more user-friendly paths. (ocaml/merlin#1840)
    • Fix dot-merlin-reader ignoring SOURCE_ROOT and STDLIB directives (ocaml/merlin#1839, ocaml/merlin#1803)
  • editor modes
    • Vim:
      • Fix Python-3.12 syntax warnings in merlin.py (ocaml/merlin#1798)
      • Dead code / doc removal for previously deleted MerlinPhrase command (ocaml/merlin#1804)
    • Emacs:
      • Improve the way that result of polarity search is displayed (#1814)
      • Add merlin-search-by-type, merlin-search-by-polarity and change the behaviour of merlin-search to switch between by-type or by-polarity depending on the query (ocaml/merlin#1828)

Hello folks! πŸ‘‹

We'd like to welcome everyone to try and play with the Dune Developer Preview! πŸŽ‰

This experimental nightly release of dune includes a lot of improvements, including the much expected package management features, and it can be installed from that website or by using the new installation script:

$ curl -fsSL https://get.dune.build/install | bash

In a few seconds you should be ready to OCaml by calling dune:

Installing the Dune Developer Preview|690x442

You can also watch and share this demo on X and Mastodon.

Please try it out and let us know what you think πŸ™

πŸ“… You can book a feedback call with us here

πŸ“ You can submit feedback using this form

πŸ› You can submit issues to Github on ocaml/dune

Changes since last update

The Dune shared cache has been enabled by default. We're starting off by caching all downloads and dependencies.

We have improved support for dev tools. We're working to streamline this but in the latest binary you can:

  • Configure your LSP (in Neovim, Vim, Emacs, etc) to call dune tools exec ocamllsp to get LSP support for your projects out of the box – this may take a little bit the first time it builds the LSP for a compiler version, but it's pretty much instant afterwards.

  • Call dune fmt to get your project formatted – remember to add an .ocamlformat file if you don't have one yet. An empty one is enough.

  • Call dune ocaml doc to get documentation built

What's next?

We're looking forward to streamlining the DX, working on better dependency locks, and looking into supporting Windows.

In particular, we're considering work on a few things:

  • dune create <repo> – to let the community create templates that can be easily used from within dune
  • dune pkg fetch – to prefetch packages and prepare a repository for working in offline mode
  • dune build @deps - to build all dependencies, useful for staged builds in Dockerfiles
  • dune pkg add <name> - to make adding packages straightforward
  • a short-hand syntax for pins on github
  • and more!

If you've got any ideas, we'd love to hear them, so please open a feature request on Github πŸ™

Other updates

FunOCaml Presentation

At FunOCaml we had a last-minute opportunity to present the work being done on Dune and we used it to introduce the Developer Preview to the community, and even tested Package Management live with suggestions from the audience (thanks @anmonteiro and Paul-Elliot for participating!) – you can watch it on Twitch.

New design

We're working with @Claire_Vandenberghe on redesigning the Developer Preview website so that it'd feel like a seamless extension of OCaml.org – in this current iteration we've made it easier to get started and we're putting the FAQ front and center.

We'll be iterating on this design in the coming weeks until it fits perfectly within the OCaml.org design system 🎨

You can check the new website here: https://preview.dune.build

Upcoming Blog posts

In the near future we'll be publishing blog posts about the Developer Preview and Package Management, which we're working on with @professor.rose πŸ‘

Feedback on this post is welcomed on Discuss!

As mentioned in our talk at the OCaml Workshop 2024, we decided to switch to a time-based release cycle (every 6 months), starting with opam 2.3.

As promised, we are happy to announce the first alpha release of opam 2.3.0. You can view the full list of changes in the release note.

This version is an alpha, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Major breaking change

When loading a repository, opam now ignores files in packages' files/ directories which aren't listed in the extra-files field of the opam file. This was done to simplify the opam specification where we hope the opam file to be the only thing that you have to look at when reading a package specification. The optionality of the extra-files: field goes against that principle. This change also reduces the surface area for potential file corruption as it ensures that extra-files are checked against their checksums.

This is a breaking change and means that if you are using the files/ directory without the extra-files: field, you need to make sure that all files in that directory are listed in the extra-files field. Once done, the resulting opam file is backward-compatible and you don't need to worry about anything else.

If you have an opam repository, you should make sure all files are listed so every packages continues to work without any issue, which can be done automatically using the opam admin update-extrafiles command.

Major changes

  • Packages requiring an unsupported version of opam are now marked unavailable, instead of causing a repository error. This means an opam repository can now allow smoother upgrade in the future where some packages can require a newer version of opam without having to fork the repository to upgrade every package to that version as was done for the upgrade from opam 1.2 to 2.0

  • Add a new opam list --latests-only option to list only the latest versions of packages. Note that this option is respects the order options were given on the command line. For example: --available --latests-only will first list all the available packages, then choose only the latest packages in that set; while --latests-only --available will first list all the latest packages, then only show the ones that are available in that set

  • Fix and improve opam install --check, which now checks if the whole dependency tree of the package is installed instead of only the root dependencies

  • Add a new --verbose-on option to enable verbose output for specified package names. Thanks to @desumn for this contribution

  • Add a new opam switch import --deps-only option to install only the dependencies of the root packages listed in the opam switch export file

  • opam switch list-available will now not display compilers flagged with avoid-version/deprecated unless --all is given, meaning that the "trunk" build of OCaml no longer appears to be the latest version

  • opam switch create --repos now accepts git URLs suffixed with .git instead of requiring the git+https:// protocol prefix. This is consistant with other commands such as opam repository add. Thanks to @Keryan-dev for this contribution

  • opam switch set-invariant now displays the switch invariant using the same syntax as the --invariant flag

  • The builtin-0install solver was improved and should now be capable of being your default solver instead of builtin-mccs+glpk. It was previously mostly only suited for automated tasks such as Continuous Integration. If you wish to give it a try, simply call opam option solver=builtin-0install

  • Most of the unhelpful conflict messages were fixed

  • Fix the value of the arch variable when the current OS is 32bit on a 64bit machine (e.g. Raspberry Pi OS)

  • opam now fails when git submodules fail to update instead of ignoring the error and just showing a warning

  • opam's libraries now compile with OCaml >= 5.0 on Windows

Various performance and other improvements were made and bugs were fixed. API changes are denoted in the release note linked above. This release also includes a handful of PRs improving the documentation and more two dozen PRs improving and extending the tests.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.3.0~alpha1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.3.0~alpha1"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

As we prepare for the public beta, we're ramping up the DX interviews and ensuring the first few users will have a fun, productive experience with the Developer Preview.

πŸ“₯ If you signed up for the Dev Preview back in May, check your inbox for a link and instructions to schedule your DX interview with us.

Here's a sample video on (Mastodon or X) where you can see us building the Riot project on a machine that does not have OCaml installed. It is pretty neat!

Seriously, big shoutout to the Dune team at Tarides[0] and Jane Street[1] who have been doing a phenomenal job πŸ‘ ✨ 🐫

So here's what getting started with OCaml looks like using the Dune Developer Preview as of today (August 19 2024):

  1. get dune from our binary distribution – we'll soon make this public!
  2. run dune pkg lock in your favorite project
  3. run dune build

That's it. No need to install anything else! Dune will see that lock file, fetch, and build all necessary dependencies.

πŸ—ΊοΈ These are some strong steps towards the OCaml Platform vision for 2026 that we are actively working towards. If you have any thoughts or feedback please let us know!

There are more improvements coming that will help remove friction to get started and create a delightful experience. Both of these things we strongly believe will help onboard new users to the OCaml world.

Here's a few in the works:

  • Various DX improvements – from new outputs to simplified workflows, we want to make using Dune just delightful.

  • Bundled support for dev tools (OCamlFormat, odoc, LSP) – the default toolset will be available without any extra steps! Just call dune fmt and it works. No need to manually install anything else.

  • Automatic dependency locking – when building, and even in watch mode, Dune will lock your dependencies by default and keep the lock up to date.

  • Cross-project caching – by default we'll enable a local Dune cache across the system, so you never rebuild the same dependency, even across projects.

  • Signed binaries with certificates of origin – we care deeply about security and want to make sure that any binary we ship can be easily verified and tracked back to its sources.

Stay tuned! πŸ‘‹

PS: here's a longer video on (Mastodon or X) showing you the setup for OCaml from zero, creating a new project, and adding a dependency, all within ~5 minutes

[0] @emillon @Leonidas @gridbugs @tmattio @maiste . Ambre Suhamy, Alpha Diallo [1] @rgrinberg

opam 2.2.1

Feedback on this post is welcomed on Discuss!

We are pleased to announce the release of opam 2.2.1.

We've fixed a couple of regressions and would like to encourage users of opam 2.2 to upgrade.

Changes

The three main changes are:

  • Fixe a regression in opam install --deps-only where the direct dependencies were not set as root packages (spotted in the wild by @rjbou and also reported on Discuss)
  • Fix a regression when fetching Git packages where the resulting Git repository could lead to unexpected outputs of Git commands, by disabling shallow clone by default except when fetching opam repositories (#6145)
  • Mitigate curl/curl#13845 by falling back from --write-out to --fail if exit code 43 is returned by Curl. In particular, this fixes opam init when run from cmd/PowerShell on Windows 11 23H2 (#6120)

A couple more improvements and additions to the testsuite were made. You can view the full list of changes in the release note.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

(or via winget upgrade OCaml.opam) or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Happy hacking!

We are pleased to announce the release of OCaml LSP 1.19.0. This version brings official support for OCaml 5.2. It also includes a new custom query to get

documentation and a fix regarding the handling of OCamlFormat processes.

See full changelog

Features

Fixes

  • Kill unnecessary OCamlFormat processes with sigterm rather than sigint or sigkill (ocaml/ocaml-lsp#1343)

The Ppxlib dev team is happy to announce the release of ppxlib.0.33.0.

This release's main feature is a series of improvement to flags controlling unused value/module/type warnings silencing. The ppxlib driver generates warning silencing items to prevent [@@deriving ...] generated code to trigger unused code warnings. Three warnings are disabled that way:

  • Warning 32: unused value
  • Warning 60: unused module
  • Warning 34: unused type The first two are disabled for values and modules generated by the deriver while the third is disabled for the types in the type declaration to which the [@@deriving ...] attribute is attached. This feature was added a long time ago to avoid manually disabling those warnings when working with derivers that generate a set of values and modules only to use a subset of those. Alternatively, the unused type warning silencing was added to allow defining an alias type only to be consumed by a deriver (e.g., type error = [`Not_found | `Invalid_arg] [@@deriving to_string]). We since then believe that we should not disable warnings lightly, as this behaviour makes it difficult to find and remove deadcode. The right approach in those situations should be to fix the PPX derivers so that they are more configurable and can be used without triggering such warnings. We will start to move toward removing this feature, but since it is still useful in some places, we came up with a plan to do this iteratively. In ppxlib.0.31.0 we added the -unused-code-warnings driver flag and the ?unused_code_warnings Deriving.V2.make optional argument to control whether to silence Warnings 32 and 60. When both are set to true, by the user and the deriver authors, the warnings are not silenced. As of ppxlib.0.33.0, these also control the silencing of Warning 34 (unused type). force can now be passed to the -unused-code-warnings flag in order to disable warnings silencing, regardless of the derivers opting in. This allows users to test whether their codebase and their set of derivers rely on warning silencing or not and to use those results to eliminate deadcode and/or report issues upstream to the derivers they use. We also added a separate -unused-type-warnings flag that works similarly to -unused-code-warnings (i.e., depends on the value of the ?unused_code_warnings argument), but it only controls Warning 34 silencing, as it turns out it is less likely to cause unwanted warnings than with the other two. This will allow users to disable it more easily, without having to deal with Warnings 32 and 60 straight away. We want to encourage users to try those on their codebase in order to see the impact it has. Did you have deadcode lying around that slipped past undetected? Does this trigger unwanted warnings because of deriver's generated code? The plan is to give the ecosystem some time to try those features and adapt by fixing individual derivers and flipping setting ?unused_code_warnings to true as they do. After a while, we will swap the default value of the driver flag to true so that only derivers that haven't opted in will enable warning silencing. Then as time goes we will swap the default of the Deriving.make argument so that derivers will instead have to explicitly opt out to get the warning silencing. Finally, once we are confident the ecosystem is in a good enough state, we will remove this feature altogether.

ppxlib.0.33.0 also comes with a couple of new features for PPX authors:

  • A couple new Ast_builder functions: elist_tail and plist_tail that can be used to build list expressions and patterns with a custom tail: elist_tail [expr1; expr2] tail_expr returns the expression for expr1::expr2::tail_expr.
  • Context_free.special_function', a new version of special_function that allows passing a Longident.t directly rather that relying on parsing the string argument to a Longident.t.

Finally, the release includes a few bug fixes to Longident.parse and Code_path.main_module_name and fixes the location-check flag so it is not required to also pass -check to enable location checks. It also fixes the 5.2 migrations locations, as we used to build nodes with inconsistent locations when migrating Pexp_function nodes.

We would like to thank our external contributors who have been a huge part of this release: @octachron, @vg-b, and @jchavarri, and a special mention to @mbarbin, who has not only contributed a lot to the warning silencing features but has been extensively testing and providing very useful feedback on them.

And of course, as usual, we'd like to thank the OCaml Software Foundation who has been funding my work on Ppxlib and on this release, making all of this possible!

See full changelog
  • Fix a bug where Code_path.main_module_name would not properly remove extensions from the filename and therefore return an invalid module name. (#512, @NathanReb)

  • Add -unused-type-warnings flag to the driver to allow users to disable only the generation of Warning 34 silencing structure items when using [@@deriving ...] on type declarations. (#511, @mbarbin, @NathanReb)

  • Make the -unused-code-warnings driver flag also control Warning 34 silencing for type declarations with [@@deriving ...] attached. (#510, @mbarbin, @NathanReb)

  • Add -unused-code-warnings=force driver command-line flag argument. (#490, @mbarbin)

  • Add new functions Ast_builder.{e,p}list_tail that take an extra tail expression/pattern argument parameter compared to Ast_builder.{e,p}list, so they can build ASTs like a :: b :: c instead of only [ a; b ]. (#498, #502, @v-gb, @NathanReb)

  • Fix Longident.parse so it also handles indexing operators such as .!(), .%(;..)<-, or Vec.(.%()) (#494, @octachron)

  • Add a special_function' variant that directly takes a Longident.t argument in order to avoid the issue with Longident.t covering distinct syntactic classes that cannot be easily parsed by a common parser (#496, @octachron).

  • Keep location ranges consistent when migrating Pexp_function nodes from 5.2+ to older versions (#504, @jchavarri)

  • Fix -locations-check behaviour so it is no longer required to pass -check and can enable location checks. (#506, @NathanReb)

We are pleased to announce the release of OCaml LSP 1.18.0. This version comes with a lot of fixes and new features.

Notable features that are included in this release are:

  • Improved hover behavior with less noisy hovers on some parse tree nodes such as keywords, comments, etc., along with support for hovering over PPX annotations and preview the generated code.
  • Some additional custom queries, particularly TypeEnclosing
  • Folding ifthenelse expressions
  • A new configuration option to control Dune diagnostics
  • Improved document symbols

...and many fixes to a handful of issues.

Feedback is very much welcomed on the the Discuss Announcement post and do not hesistate to report issues in the issue tracker.

See full changelog

Features

  • Introduce a configuration option to control Dune diagnostics. The option is called duneDiganostics, and it may be set to { enable: false } to disable diagnostics. (ocaml/ocaml-lsp#1221)

  • Support folding of ifthenelse expressions (ocaml/ocaml-lsp#1031)

  • Improve hover behavior (ocaml/ocaml-lsp#1245)

    Hovers are no longer displayed on useless parse tree nodes such as keywords, comments, etc.

    Multiline hovers are now filtered away.

    Display expanded PPXs in the hover window.

  • Improve document symbols (ocaml/ocaml-lsp#1247)

    Use the parse tree instead of the typed tree. This means that document symbols will work even if the source code doesn't type check.

    Include symbols at arbitrary depth.

    Differentiate functions / types / variants / etc.

    This now includes PPXs like let%expect_test or let%bench in the outline.

  • Introduce a destruct-line code action. This is an improved version of the old destruct code action. (ocaml/ocaml-lsp#1283)

  • Improve signature inference to only include types for elements that were absent from the signature. Previously, all signature items would always be inserted. (ocaml/ocaml-lsp#1289)

  • Add an update-signature code action to update the types of elements that were already present in the signature (ocaml/ocaml-lsp#1289)

  • Add custom ocamllsp/merlinCallCompatible request (ocaml/ocaml-lsp#1265)

  • Add custom ocamllsp/typeEnclosing request (ocaml/ocaml-lsp#1304)

Fixes

  • Detect document kind by looking at Merlin's suffixes config.

    This enables more LSP features for non-.ml/.mli files. Though it still depends on Merlin's support. (ocaml/ocaml-lsp#1237)

  • Correctly accept the --clientProcessId flag. (ocaml/ocaml-lsp#1242)

  • Disable automatic completion and signature help inside comments (ocaml/ocaml-lsp#1246)

  • Includes a new optional/configurable option to toggle syntax documentation. If toggled on, allows display of syntax documentation on hover tooltips. Can be controlled via environment variables and by GUI for VS code. (ocaml/ocaml-lsp#1218)

  • For completions on labels that the LSP gets from Merlin, take into account whether the prefix being completed starts with ~ or ?. Change the label completions that start with ? to start with ~ when the prefix being completed starts with ~. (ocaml/ocaml-lsp#1277)

  • Fix document syncing (ocaml/ocaml-lsp#1278, ocaml/ocaml-lsp#1280, fixes ocaml/ocaml-lsp#1207)

  • Stop generating inlay hints on generated code (ocaml/ocaml-lsp#1290)

  • Fix parenthesising of function types in SignatureHelp (ocaml/ocaml-lsp#1296)

  • Fix syntax documentation rendering (ocaml/ocaml-lsp#1318)

opam 2.2.0

Feedback on this post is welcomed on Discuss!

We are very pleased to announce the release of opam 2.2.0, and encourage all users to upgrade. Please read on for installation and upgrade instructions.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Changes

Major change: Windows support

After 8 years' effort, opam and opam-repository now have official native Windows support! A big thank you is due to Andreas Hauptmann (@fdopen), whose WODI and OCaml for Windows projects were for many years the principal downstream way to obtain OCaml on Windows, Jun Furuse (@camlspotter) whose initial experimentation with OPAM from Cygwin formed the basis of opam-repository-mingw, and, most recently, Jonah Beckford (@jonahbeckford) whose DkML distribution kept - and keeps - a full development experience for OCaml available on Windows.

OCaml when used on native Windows requires certain tools from the Unix world which are provided by either Cygwin or MSYS2. We have engineered opam init so that it is possible for a user not to need to worry about this, with opam managing the Unix world, and the user being able to use OCaml from either the Command Prompt or PowerShell. However, for the Unix user coming over to Windows to test their software, it is also possible to have your own Cygwin/MSYS2 installation and use native Windows opam from that. Please see the previous blog post for more information.

There are two "ports" of OCaml on native Windows, referred to by the name of provider of the C compiler. The mingw-w64 port is GCC-based. opam's external dependency (depext) system works for this port (including providing GCC itself), and many packages are already well-supported in opam-repository, thanks to the previous efforts in opam-repository-mingw. The MSVC port is Visual Studio-based. At present, there is less support in this ecosystem for external dependencies, though this is something we expect to work on both in opam-repository and in subsequent opam releases. In particular, it is necessary to install Visual Studio or Visual Studio BuildTools separately, but opam will then automatically find and use the C compiler from Visual Studio.

Major change: opam tree / opam why

opam tree is a new command showing packages and their dependencies with a tree view. It is very helpful to determine which packages bring which dependencies in your installed switch.

$ opam tree cppo
cppo.1.6.9
β”œβ”€β”€ base-unix.base
β”œβ”€β”€ dune.3.8.2 (>= 1.10)
β”‚   β”œβ”€β”€ base-threads.base
β”‚   β”œβ”€β”€ base-unix.base [*]
β”‚   └── ocaml.4.14.1 (>= 4.08)
β”‚       β”œβ”€β”€ ocaml-base-compiler.4.14.1 (>= 4.14.1~ & < 4.14.2~)
β”‚       └── ocaml-config.2 (>= 2)
β”‚           └── ocaml-base-compiler.4.14.1 (>= 4.12.0~) [*]
└── ocaml.4.14.1 (>= 4.02.3) [*]

Reverse-dependencies can also be displayed using the new opam why command. This is useful to examine how dependency versions get constrained.

$ opam why cmdliner
cmdliner.1.2.0
β”œβ”€β”€ (>= 1.1.0) b0.0.0.5
β”‚   └── (= 0.0.5) odig.0.0.9
β”œβ”€β”€ (>= 1.1.0) ocp-browser.1.3.4
β”œβ”€β”€ (>= 1.0.0) ocp-indent.1.8.1
β”‚   └── (>= 1.4.2) ocp-index.1.3.4
β”‚       └── (= version) ocp-browser.1.3.4 [*]
β”œβ”€β”€ (>= 1.1.0) ocp-index.1.3.4 [*]
β”œβ”€β”€ (>= 1.1.0) odig.0.0.9 [*]
β”œβ”€β”€ (>= 1.0.0) odoc.2.2.0
β”‚   └── (>= 2.0.0) odig.0.0.9 [*]
β”œβ”€β”€ (>= 1.1.0) opam-client.2.2.0~alpha
β”‚   β”œβ”€β”€ (= version) opam.2.2.0~alpha
β”‚   └── (= version) opam-devel.2.2.0~alpha
β”œβ”€β”€ (>= 1.1.0) opam-devel.2.2.0~alpha [*]
β”œβ”€β”€ (>= 0.9.8) opam-installer.2.2.0~alpha
└── user-setup.0.7

Special thanks to @cannorin for contributing this feature.

Major change: with-dev-setup

There is now a way for a project maintainer to share their project development tools: the with-dev-setup dependency flag. It is used in the same way as with-doc and with-test: by adding a {with-dev-setup} filter after a dependency. It will be ignored when installing normally, but it's pulled in when the package is explicitly installed with the --with-dev-setup flag specified on the command line.

For example

opam-version: "2.0"
depends: [
  "ocaml"
  "ocp-indent" {with-dev-setup}
]
build: [make]
install: [make "install"]
post-messages:
[ "Thanks for installing the package"
  "as well as its development setup. It will help with your future contributions" {with-dev-setup} ]

Major change: opam pin --recursive

When pinning a package using opam pin, opam looks for opam files in the root directory only. With recursive pinning, you can now instruct opam to look for .opam files in subdirectories as well, while maintaining the correct relationship between the .opam files and the package root for versioning and build purposes.

Recursive pinning is enabled by the following options to opam pin and opam install:

  • With --recursive, opam will look for .opam files recursively in all subdirectories.
  • With --subpath <path>, opam will only look for .opam files in the subdirectory <path>.

The two options can be combined: for instance, if your opam packages are stored as a deep hierarchy in the mylib subdirectory of your project you can try opam pin . --recursive --subpath mylib.

These options are useful when dealing with a large monorepo-type repository with many opam libraries spread about.

New Options

  • opam switch -, inspired by git switch -, makes opam switch back to the previously selected global switch.

  • opam pin --current fixes a package to its current state (disabling pending reinstallations or removals from the repository). The installed package will be pinned to its current installed state, i.e. the pinned opam file is the one installed.

  • opam pin remove --all removes all the pinned packages from a switch.

  • opam exec --no-switch removes the opam environment when running a command. It is useful when you want to launch a command without opam environment changes.

  • opam clean --untracked removes untracked files interactively remaining from previous packages removal.

  • opam admin add-constraint <cst> --packages pkg1,pkg2,pkg3 applies the given constraint to a given set of packages

  • opam list --base has been renamed into --invariant, reflecting the fact that since opam 2.1 the "base" packages of a switch are instead expressed using a switch invariant.

  • opam install --formula <formula> installs a formula instead of a list of packages. This can be useful if you would like to install one package or another one. For example opam install --formula '"extlib" |"extlib-compat"' will install either extlib or extlib-compat depending on what's best for the current switch.

Miscellaneous changes

  • The UI now displays a status when extracting an archive or reloading a repository
  • Overhauled the implementation of opam env, fixing many corner cases for environment updates and making the reverting of package environment variables precise. As a result, using setenv in an opam file no longer triggers a lint warning.
  • Fix parsing pre-opam 2.1.4 switch import files containing extra-files
  • Add a new sys-ocaml-system default global eval variable
  • Hijack the "%{var?string-if-true:string-if-false-or-undefined}%" syntax to support extending the variables of packages with + in their name (conf-c++ and conf-g++ already exist) using "%{?pgkname:var:}%"
  • Fix issues when using fish as shell
  • Sandbox: Mark the user temporary directory (as returned by getconf DARWIN_USER_TEMP_DIR) as writable when TMPDIR is not defined on macOS
  • Add Warning 69: Warn for new syntax when package name in variable in string interpolation contains several '+' (this is related to the "hijack" item above)
  • Add support for Wolfi OS, treating it like Alpine family as it also uses apk
  • Sandbox: /tmp is now writable again, restoring POSIX compliance
  • Add a new opam admin: new add-extrafiles command to add/check/update the extra-files: field according to the files present in the files/ directory
  • Add a new opam lint -W @1..9 syntax to allow marking a set of warnings as errors
  • Fix bugs in the handling of the OPAMCURL, OPAMFETCH and OPAMVERBOSE environment variables
  • Fix bugs in the handling of the --assume-built argument
  • Software Heritage fallbacks is now supported, but is disabled-by-default for now. For more information you can read one of our previous blog post

And many other general and performance improvements were made and bugs were fixed. You can take a look to previous blog posts. API changes and a more detailed description of the changes are listed in:

This release also includes PRs improving the documentation and improving and extending the tests.

Please report any issues to the bug-tracker.

We hope you will enjoy the new features of opam 2.2! πŸ“―

We are pleased to announce the release of Merlin 5.1-502. This is an important release that brings a lot of backend changes and a major new feature: project-wide occurrences queries.

Try it by running dune build @ocaml-index (since dune 3.16.0) and performing a reference query!

More information can be found in the discuss announcement and the wiki.

See full changelog
  • merlin binary
    • Support project-wide occurrences queries using index files (ocaml/merlin#1766)
      • The file format is described in library Merlin_lib.index_format
      • Two new configuration directives are introduced:
        • SOURCE_ROOT that is used to resolve relative paths found in the indexes.
        • INDEX that is used to declare the list of index files Merlin should use when looking for occurrences.
    • A new UNIT_NAME configuration directive that can be used to tell Merlin the correct name of the current unit in the presence of wrapping (ocaml/merlin#1776)
    • Perform incremental indexation of the buffer when typing. (ocaml/merlin#1777)
    • merlin-lib.commands: Add a find_command_opt alternative to find_command that does not raise (ocaml/merlin#1778)
    • Prevent uid clashes by not returning PWO for defs located in the current interface file (ocaml/merlin#1781)
    • Reset uid counters when restoring the typer cache so that uids are stable across re-typing (ocaml/merlin#1779)
    • Improve the behavior on occurrences when the cursor is on a label / constructor declaration (ocaml/merlin#1785)
  • editor modes
    • emacs: add basic support for project-wide occurrences (ocaml/merlin#1766)
    • vim: add basic support for project-wide occurrences (ocaml/merlin#1767, @Julow)

Feedback on this post is welcomed on Discuss!

We are very excited to announce the first (and hopefully only) release candidate for opam 2.2.0.

We've squashed a few more bugs and we consider this to be ready for the final release. You can view the full list of changes in the release note.

We invite users to test it one final time just in case there are any previously unnoticed bugs!

Changes

  • Fix opam upgrade wanting to keep rebuilding the compiler (as now it contains an x-env-path-rewrite field)
  • Provide defaults so opam init -y no longer asks questions on Windows
  • Fix OpamConsole.menu when there are more than 9 options (can happen on Windows)

A couple more improvements were made and bugs were fixed. The single API change is also denoted in the release note. This release also includes PRs extending the tests.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~rc1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"

or download manually from the Github "Releases" page to your PATH.

  1. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features of opam 2.2!

Dune 3.16.0

We're happy to announce the release of Dune 3.16.0.

Among the list of chances, this release contains improvements to Melange support and a way to look for references in a whole project using Merlin and OCaml LSP.

See full changelog

Added

  • Allow libraries with the same (name ..) in projects as long as they don't conflict during resolution (via enabled_if). (#10307, @anmonteiro, @jchavarri)

  • dune describe pp now finds the exact module and the stanza it belongs to, instead of guessing the name of the preprocessed file. (#10321, @anmonteiro)

  • Print the result of dune describe pp with the respective dialect printer. (#10322, @anmonteiro)

  • Add new flag --context to dune ocaml-merlin, which allows to select a Dune context when requesting Merlin config. Add dune describe contexts subcommand. Introduce a field generate_merlin_rules for contexts declared in the workspace, that allows to optionally produce Merlin rules for other contexts besides the one selected for Merlin (#10324, @jchavarri)

  • Melange: add include paths for private library .cmj files during JS emission. (#10416, @anmonteiro)

  • dune ocaml-merlin: communicate additional directives SOURCE_ROOT, UNIT_NAME (the actual name with wrapping) and INDEX with the paths to the index(es). (#10422, @voodoos)

  • Add a new alias @ocaml-index that uses the ocaml-index binary to generate indexes that can be read by tools such as Merlin to provide project-wide references search. (#10422, @voodoos)

  • Merlin: add optional (merlin_reader CMD) construct to (dialect) stanza to configure a Merlin reader (#8567, @andreypopp)

Changed

  • Melange: treat private libraries with (package ..) as public libraries, fixing an issue where import paths were wrongly emitted. (#10415, @anmonteiro)

  • Install .glob files for Coq theories too (#10602, @ejgallego)

Fixed

  • Don't try to document nonexistent libraries in doc-new target (#10319, fixes #10056, @jonludlam)

  • Make dune-site's load_all function look for META files so that it doesn't fail on empty directories in the plugin directory (#10458, fixes #10457, @shym)

  • Fix incorrect warning for libraries defined inside nonexistant directories using (subdir ..) and used by executables using dune-build-info (#10525, @rgrinberg)

  • Don't try to take build lock when running coq top --no-build (#10547, fixes #7671, @lzy0505)

  • Make sure to truncate Dune's lock file after locking and unlocking so that users cannot observe incorrect PID's (#10575, @rgrinberg)

  • MDX: link MDX binary with byte_complete. This fixes (libraries) with foreign archives on Linux. (#10586, fixes #10582, @anmonteiro)

  • Virtual libraries: fix an issue where linking an executable involving several virtual libries would cause an error. (#10581, fixes #10460, @rgrinberg)

We are pleased to announce the release of Merlin 4.16-414 and 4.16-501.

These releases expose additional functions for packages using merlin-lib that need to manually parse merlin commands.

See full changelog
  • merlin binary
    • Addition of a merlin-lib.commands library which disassociates the execution of commands from the new_protocol, from the binary, allowing it to be invoked from other projects (ocaml/merlin#1758)
    • merlin-lib.commands: Add a find_command_opt alternative to find_command that does not raise (ocaml/merlin#1778)

Feedback on this post is welcomed on Discuss!

We are very pleased to announce the third and final beta release of opam 2.2.0.

We've done our best to polish everything and squash as many bugs as possible in order to be ready for the final release. You can view the full list of changes in the release note.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we near the stable release.

Changes

  • Greatly enhance the opam init user experience on Windows, and the number of recognised configurations
  • New option opam init --cygwin-extra-packages=CYGWIN_PKGS --cygwin-internal-install, to specify additional packages for the internal Cygwin installation
  • Redirect the opam root to C:\opamroot\opam-xxx when the opam root contains spaces on Windows
  • Out-of-the-box UTF-8 paged --help on Windows
  • Fix a performance regression when calling opam install --deps-only on an already installed package
  • Fix several edge cases related to environment reverting
  • Fixed some issues that could appear when upgrading from previous versions of opam
  • Fix various issues with opam tree --with-test
  • Fix parsing opam 2.1 switch import files containing extra-files
  • Fix download URLs containing invalid characters on Windows
  • Fix some failure cases when extracting tarballs which contain symlinks on Windows

Various other general and performance improvements were made and bugs were fixed. API changes are denoted in the release note. This release also includes PRs improving the documentation and improving and extending the tests.

Try it on Windows!

BEWARE: the command shown below is experimental, use caution and please do report any issues that you are experiencing. If you prefer to not use our experimental script, feel free to get the Windows binary directly from the Release Page and put it in your directory of choice instead.

Now that the Windows support was merged in opam-repository, testing is as simple as calling the following command from a PowerShell terminal:

Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/kit-ty-kate/opam/windows-installer/shell/install.ps1) }"

opening a new terminal, and a simple opam init will work out-of-the-box.

Try it on other platforms!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~beta3"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

We are pleased to announce the release of Merlin 4.15-414 and 4.15-501.

These releases bring a handful of bug fixes and improvements, notably to the destruct feature, that were already released for OCaml 5.2 in Merlin 5.0-502.

See full changelog
  • merlin binary
    • destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    • Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734, fixes ocaml/merlin#1661)
    • Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    • Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    • Improve cursor position detection in longidents (ocaml/merlin#1756)

Dune 3.15.3

We just released version 3.15.3 with some bug fixes.

See full changelog

Fixed

  • Fix interpretation of exists_if predicate in META files of installed libraries containing more than one element. (#10564, fixes #10563, @dbuenzli, @nojb)

  • Fix TSAN warning in wait4 stubs (#10554, fixes #10553, @emillon)

opam 2.1.5

Feedback on this post is welcomed on Discuss!

We are pleased to announce the patch release of opam 2.1.6.

This opam release consists of backported bug fixes and improvements:

  • Changes necessary for opam-repository (see ocaml/opam-repository#23789)
    • Warn if GNU patch is not detected when a patch is applied (#5893)
    • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD (#5893)
    • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch (#5893)
  • Better recognize depexts on Gentoo, NetBSD, OpenBSD (#5065)
  • Upgrade the vendored dune to 3.14.0 (#5869)
  • Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD (#5769)

Opam installation instructions (unchanged):

  1. From binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.1.6"
    

    or download manually from the Github "Releases" page to your PATH. In this case, don't forget to run opam init --reinit -ni to enable sandboxing if you had version 2.0.0~rc manually installed or to update you sandbox script.

  2. From source, using opam:

    opam update; opam install opam-devel
    

    (then copy the opam binary to your PATH as explained, and don't forget to run opam init --reinit -ni to enable sandboxing if you had version 2.0.0~rc manually installed or to update your sandbox script)

  3. From source, manually: see the instructions in the README.

We hope you enjoy this new minor version, and remain open to bug reports and suggestions.

See full changelog
  • Changes necessary for opam repository
  • Warn if GNU patch is not detected when a patch is applied [#5893 @kit-ty-kate]
  • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD [#5893 @kit-ty-kate]
  • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch [#5893 @kit-ty-kate]
  • Better recognize depexts on Gentoo, NetBSD, OpenBSD [#5065 @mndrix]
  • Upgrade the vendored dune to 3.14.0 [#5869 @kit-ty-kate]
  • Vendor mccs.1.1+17 [#5769 @kit-ty-kate]
  • Require mccs >= 1.1+17: Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD [#5769 @kit-ty-kate]
  • API Changes:
  • OpamSystem.patch now displays a warning when GNU patch is not detected and looks for both patch and gpatch as a backup option depending on the OS [#5893 @kit-ty-kate]

Merlin 5.0

We are pleased to announce the release of Merlin 5.0-502!

This release brings official support for OCaml 5.2. Substantial backend changes were required to adapt to this release, especially for features such as occurrences and get-documentation. Do not hesitate to report any suspicious behavior in the issue tracker!

This release also fixes a handful of issues, two of them improving the behaviour of Merlin's destruct feature.

See full changelog
  • merlin binary
    • Support for OCaml 5.2 (#1757)
    • destruct: Removal of residual patterns (#1737, fixes #1560)
    • Do not erase fields' names when destructing punned record fields (#1734, fixes #1661)
    • Ignore SIGPIPE in the Merlin server process (#1746)
    • Fix lexing of quoted strings in comments (#1754, fixes #1753)
    • Improve cursor position detection in longidents (#1756)
    • Addition of a merlin-lib.commands library that disassociates the execution of commands from the new_protocol, from the binary, allowing it to be invoked from other projects (#1758)
    • New occurrences backend: Don't index occurrences when merlin.hide attribute is present. (#1768)
    • Use the new uid_to_decl table in 5.2's CMT files to get documentation. (#1773)

The ppxlib team is happy to announce the release of ppxlib.0.32.1.

The main feature of this release is of course the support for the upcoming OCaml 5.2 release. Starting with this version you'll be able to use ppx with the latest compiler.

The feature also comes with a small follow up improvement to the 0.32.0 error reporting changes that simplifies how exception thrown from context free rewriting are handled. The errors will now be inserted where the generated code would have been instead of appended to the whole AST. This should lead to a better error reporting from the compiler as it will now report errors in order of their position in the code.

We'd like to thank the OCaml Software Foundation once again as they funded the vast majority of the work for this release.

See full changelog
  • Add support for OCaml 5.2

  • Insert errors from caught located exceptions in place of the code that should have been generated by context-free rules. (#472, @NathanReb)

Odoc 2.4.2

We've released odoc 2.4.2 with OCaml 5.2 compatibility and a few bug fixes.

See full changelog

Added

  • OCaml 5.2.0 compatibility (@Octachron, #1094, #1112)

Fixed

  • Fix issues #1066 and #1095 with extended opens (@jonludlam, #1082, #1100)

We've released OCamlFormat 0.26.2 with compatibility with OCaml 5.2.

See full changelog

Changed

  • Compatible with OCaml 5.2.0 (#2510, @gpetiot, @Julow)

Dune 3.15.2

We just released version 3.15.2 with some bug fixes.

This one is particularly important for Coq users since it fixes a bug introduced in 3.13.0 that made incremental builds very slow.

See full changelog

Fixed

  • If no directory targets are defined, then do not evaluate enabled_if (#10442, @rgrinberg)

  • Fix a bug where Coq projects were being rebuilt from scratch each time the dependency graph changed. (#10446, fixes #10149, @alizter)

MDX 2.4.1

This release reverts the change introduce in Mdx 2.4.0 that allows the execution of included OCaml code blocks after users reported issues. We will revisit the feature to ensure it is opt-in and doesn't break users setup.

See full changelog

Changed

  • Revert #446: "Allow execution of included OCaml code blocks" (#451, @gpetiot). Included OCaml code blocks preserve their pre-2.4.0 behavior.

Feedback on this post is welcomed on Discuss!

We are indescribably thrilled to announce the second beta release of opam 2.2.0.

It contains everything required to be able to make opam-repository compatible with Windows, as well as a whole bunch of fixes. You can view the full list of changes in the release note.

We'll post another blog post very soon with more directions on how to test opam on Windows with this release.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

Windows support

This beta introduces a handful of changes necessary to be able to make the default opam-repository support Windows out of the box:

  • Add a new sys-ocaml-system init default global eval variable
  • Hijack the "%{var?string-if-true:string-if-false-or-undefined}%" syntax to support extending the variables of packages with + in their name (conf-c++ and conf-g++ already exist) using "%{?pgkname:var:}%"
  • Add winsymlinks:native to the CYGWIN environment variable when installing a package on Windows. In particular, this provides a workaround when extracting ocamlbuild's sources.
  • Internal Cygwin installation's bin directory is placed as far down PATH as is necessary not to shadow bash, tar, sort or git
  • Disable ACL in Cygwin internal install to avoid permission mismatch errors

We expect to be able to show the proposed changed to opam-repository very soon to take advantage of all these changes.

opam-repository scalability

The current draft resolution resulting from the discussion in ocaml/opam-repository#23789 about the scalability of opam-repository includes the removal of some packages. However currently, opam uses the patch system command to apply changes from a repository. The behaviour of that command is thus very important and it is a known behaviour for the macOS and BSDs patch command to not be able to delete files which leads to failures and inconsistencies for opam. Package managers on those platforms installing opam already make opam depend on GNU patch, however a certain number of people do not install opam via a system package manager (e.g. our own install script!) and end up using their system version of patch. This is in particular a problem on macOS as the name of the GNU patch command is not gpatch like on BSDs but simply patch when installed via Homebrew.

This issue is surprisingly tricky to fix, and after many trials and errors, we've decided to:

  • Warn if GNU patch is not detected when a patch is applied
  • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD
  • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch

These changes will make their way to the upcoming opam 2.1.6, in a few weeks.

Other noteworthy changes

  • Recommend enabling Developer Mode on Windows. This allows the creation of symlinks without requiring elevation. Longer-term, the aim is that we should never require Developer Mode, but at the moment more things work with it than without it!
  • Mark the internal Cygwin installation as recommended. Please don't try to maintain your own Cygwin install for use with opam unless you really know what you're doing!
  • Fix MSYS2 support. For 2.2.0, the focus has been on Cygwin, so configuring opam to use MSYS2 is quite manual. Please note that even if opam can use a MSYS2 installation, it is not yet officially supported and opam repository is not yet MSYS2 compatible. Use opam with MSYS2 only if you really really know what you're doing!
  • Fix issues when using fish
  • Improve the internal Cygwin installation during init on Windows
  • Unixify Windows paths in init shells scripts
  • Disable Software Heritage fallback by default as there currently no CI job in opam-repository to check validity of proposed swhid regarding release archive (neither publication tools support) and some concerns were raised regarding the degree of trust of the hashing method used by Software Heritage (sha1).
  • Make sure opam source --dev with git sources, clones the whole repository instead of using --depth=1
  • Sandbox: Mark the user temporary directory (as returned by getconf DARWIN_USER_TEMP_DIR) as writable when TMPDIR is not defined on macOS
  • Add Warning 69: Warn for new syntax when package name in variable in string interpolation contains several '+' (this is related to the "hijack" item above)
  • Add support for Wolfi OS, treat it like Alpine family as it also uses apk
  • Upgrade the vendored dune package to 3.14.2 to allow to compile opam when the environment contains unicode characters on Windows (in particular, this means opam now works if your username contains accented characters)
  • Upgrade other vendored packages (cmdliner 1.2.0, re 1.11.0, ocamlgraph 2.1.0, opam-file-format 2.1.6)

Various other general and performance improvements were made and bugs were fixed. API changes are denoted in the release note. This release also includes PRs improving the documentation and improving and extending the tests.

Windows Support

As we've said above we're writing a separate blog post to present how to test this new release of opam on Windows.

Stay tuned!

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~beta2"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

Dune 3.15.0

We're happy to announce that Dune 3.15.0 is now available. This feature has many fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Removal of previous limitations in many forms

Prior to Dune 3.15 there were a number of limitations where percent forms like %{env:...} could be used to expand to useful values. In this release, @rgrinberg put some effort to relax a lot of these restrictions where possible.

In the new version some of these limitations have been lifted, so for example {env:...} can be used in install stanzas (#10160).

Likewise there was no consistency where %{cma:...} or %{cmo:...} could be used. With #10169, these forms should work consistently everywhere.

Similarly the variables allowed in enabled_if fields have been expanded in #10250, from just allowing variables that can be computed from the context to now allowing all variables as long as expanding these variables does not introduce dependency cycles.

These relaxed rules can also be combined to enable a library depending on environment variables, e.g. (enabled_if %{env:ENABLE_LIBFOO=false})).

Overlapping names in different contexts

Continuing the theme of conditionally enabling or disabling code to be built, @jchavarri and @rgrinberg's work on #10220 makes it possible to have overlapping names between executable and melange.emit targets. This can be useful when a name is to be shared in different contexts (e.g. one context with native compilation and one emitting code for the browser).

Properly output UTF-8 encoded text when formatting

Dune does not assume an encoding of dune files, however when files were formatted the formatter would err on the safe side and escape bytes outside the ASCII range. This means that UTF-8 characters outside of ASCII would get escaped into decimal escape sequences.

This was especially annoying in places where the user would write natural language texts, which is common when defining Opam packages in dune-project files. For example a discussion of a paper by Paul ErdΕ‘s, Peter Frankl, VojtΔ›ch RΓΆdl would upon reformatting be turned into Paul Erd\197\145s, Peter Frankl, Vojt\196\155 R\195\182, which does a disservice to these scientists and is hard to read.

Thanks to the work of @moyodiallo in #9728 starting with Dune 3.15 the original encoding will be preserved, so your package descriptions will be more readable.

See full changelog

Added

  • Add link flags to to ocamlmklib for ctypes stubs (#8784, @frejsoya)

  • Remove some unnecessary limitations in the expansions of percent forms in install stanza. For example, the %{env:..} form can be used to select files to be installed. (#10160, @rgrinberg)

  • Allow artifact expansion percent forms (%{cma:..}, %{cmo:..}, etc.) in more contexts. Previously, they would be randomly forbidden in some fields. (#10169, @rgrinberg)

  • Allow %{inline_tests} in more contexts (#10191, @rgrinberg)

  • Remove limitations on percent forms in the (enabled_if ..) field of libraries (#10250, @rgrinberg)

  • Support dialects in dune describe pp (#10283, @emillon)

  • Allow defining executables or melange emit stanzas with the same name in the same folder under different contexts. (#10220, @rgrinberg, @jchavarri)

Fixed

  • coq: Delay Coq rule setup checks so OCaml-only packages can build in hybrid Coq/OCaml projects when coqc is not present. Thanks to @vzaliva for the test case and report (#9845, fixes #9818, @rgrinberg, @ejgallego)

  • Fix conditional source selection with select on bigarray in OCaml 5 (#10011, @moyodiallo)

  • melange: fix inconsistency in virtual library implementation. Concrete modules within a virtual library can now refer to its virtual modules too (#10051, fixes #7104, @anmonteiro)

  • melange: fix a bug that would cause stale import paths to be emitted when moving source files within (include_subdirs ..) (#10286, fixes #9190, @anmonteiro)

  • Dune file formatting: output utf8 if input is correctly encoded (#10113, fixes #9728, @moyodiallo)

  • Fix expanding dependencies and locks specified in the cram stanza. Previously, they would be installed in the context of the cram test, rather than the cram stanza itself (#10165, @rgrinberg)

  • Fix bug with dune exec --watch where the working directory would always be set to the project root rather than the directory where the command was run (#10262, @gridbugs)

  • Regression fix: sign executables that are promoted into the source tree (#10263, fixes #9272, @emillon)

  • Fix crash when decoding dune-package for libraries with (include_subdirs qualified) (#10269, fixes #10264, @emillon)

Changed

  • Remove the --react-to-insignificant-changes option. (#10083, @rgrinberg)

MDX 2.4.0

We are happy to announce the release of MDX 2.4.0! This is the first release of MDX to be compatible with OCaml 5.2.

This release also comes with support for executing included OCaml code blocks.

See full changelog

Added

  • Handle the error-blocks syntax (#439, @jonludlam, @gpetiot)
  • Allow execution of included OCaml code blocks. Add skip to include blocks to revert to the old behavior (#446, @panglesd, @gpetiot) Warning: this is a breaking change that is reverted in the next release.
  • Make MDX compatible with OCaml 5.2 (#448, @gpetiot)

Fixed

  • Reduce false-positives while detecting warnings (#440, @Julow)

Dune 3.14.2

We're happy to announce that Dune 3.14.2 is now available.

Note that due to a regression that was detected before publishing to opam version 3.14.1 should not be used. The fix for the regression is part of this release.

This feature brings some small bugfixes around the handling of Coq as well as solves an issue where Dune is running on Windows in a path that contains Unicode characters. This affected e.g. users with diacritics or non-latin script in their name when running Dune within their home directory.

See full changelog

Fixed

  • When a directory is changed to a file, correctly remove it in subsequent dune build runs. (#9327, fix #6575, @emillon)

  • Fix a problem with the doc-new target where transitive dependencies were missed during compile. This leads to missing expansions in the output docs. (#9955, @jonludlam)

  • coq: fix performance regression in coqdep unescaping (#10115, fixes #10088, @ejgallego, thanks to Dan Christensen for the report)

  • coq: memoize coqdep parsing, this will reduce build times for Coq users, in particular for those with many .v files (#10116, @ejgallego, see also #10088)

  • on Windows, use an unicode-aware version of CreateProcess to avoid crashes when paths contains non-ascii characters. (#10212, fixes #10180, @emillon)

  • fix compilation on non-glibc systems due to signal.h not being pulled in spawn stubs. (#10256, @emillon)

Utop 2.14.0

This release of UTop 2.14.0 brings support for the upcoming version of the compiler, OCaml 5.2.

See full changelog
  • Add support for OCaml 5.2 (#470, fixes #466, @leostera, @ManasJayanth, @huwaireb)

We're thrilled to announce the release of Merlin 4.14, a significant update that introduces a suite of enhancements and fixes to improve your OCaml editor experience.

In addition to the improvements and bug fixes in this release, Merlin 4.14 is the first version to support the upcoming OCaml 5.2 compiler.

Some highlights in this release include:

  • Improved Telemetry and Heap Usage Reporting: With the addition of the "heap_mbytes" field in server responses (#1717) and cache stats in telemetry (#1711), developers can now gain deeper insights into Merlin's performance and memory usage. These enhancements are part of our ongoing efforts to improve Merlin's performance profiling capabilities.
  • SyntaxDocument Command: Addressing a common challenge among new users, the new SyntaxDocument command (#1706) enables you to find detailed information about the syntax element under the cursor directly from your editor. This feature aims to facilitate learning and code readability by providing instant access to syntax descriptions, making it easier for developers to familiarize themselves with OCaml's syntax.

Happy coding!

See full changelog
  • merlin binary
    • Add a "heap_mbytes" field to Merlin server responses to report heap usage (#1717)
    • Add cache stats to telemetry (#1711)
    • Add new SyntaxDocument command to find information about the node under the cursor (#1706)
    • Fix FLG -pp ppx.exe -as-pp/-dump-ast use of invalid shell redirection when direct process launch on Windows. (#1723, fixes #1722)
    • Add a query_num field to the ocamlmerlin responses to detect server crashes (#1716)
    • Jump to cases within a match statement (#1726)
    • Jump to module-type (#1728, partially fixes #1656)
    • Exposes stable functions for configuration handling and pattern variable destruction. (#1730)
  • editor modes
    • vim: load merlin under the ocamlinterface and ocamllex filetypes (#1340)
    • Fix merlinpp not using binary file open (#1725, fixes #1724)

Dune 3.14.0

We're happy to announce that Dune 3.14.0 is now available. This feature has many fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Dynamic dune files with (dynamic_include)

It is common for some parts of a build to be dynamic: for example a source file can be generated, or some parts of the configuration like C flags can be generated from a Dune rule. But until now it was not possible to generate rules dynamically.

For example, one might want to do it is to set up one rule per input file. This is a common pattern in test suites and is easy to do with Make. But Dune does not have a concept of parameterized rules, so it is necessary to set up one rule per input file.

The pattern to do this with Dune is to:

  • Write a generator that lists the input files and emits Dune stanzas (as text);
  • Add a rule that makes a dune.inc file using this generator;
  • Add (include dune.inc) in the main dune file,

However, this requires checking in the generated dune.inc file in the repository. Another drawback is that when modifying the list of input files, it is necessary to run tests twice: one to update dune.inc, one to run the new test.

This release of Dune adds a new (dynamic_include) stanza that lifts these restrictions: dune.inc does not have to be part of the source tree, it can be generated transparently. This comes with some restrictions: some stanzas can not be generated, in particular the ones that define public libraries. And due to how rule loading works, the generated stanza needs to be defined in a different directory.

Still, this should be useful for many users that rely on the generate-include-commit pattern described above.

Sherlodoc integration

Sherlodoc is a search engine for OCaml documentation, which supports search by name, documentation and fuzzy type search (similar to Hoogle in the Haskell world). It can be obtained from opam using opam install sherlodoc.

When it is available, Dune commands that produce HTML documentation, such as dune build @doc and dune build @doc-new, will include a search bar in the generated output.

See full changelog

Added

  • Introduce a (dynamic_include ..) stanza. This is like (include foo) but allows foo to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (#9913, @rgrinberg)

  • Introduce $ dune promotion list to print the list of available promotions. (#9705, @moyodiallo)

  • If Sherlodoc is installed, add a search bar in generated HTML docs (#9772, @EmileTrotignon)

  • Add only_sources field to copy_files stanza (#9827, fixes #9709, @jchavarri)

  • The (foreign_library) stanza now supports the (enabled_if) field. (#9914, @nojb)

Fixed

  • Fix $ dune install -p incorrectly recognizing packages that are supposed to be filtered (#9879, fixes #4814, @rgrinberg)

  • subst: correctly handle opam files in opam/ subdirectory (#9895, fixes #9862, @emillon)

  • Odoc private rules are not set up if a library is not available due to enabled_if (#9897, @rgrinberg and @jchavarri)

Changed

  • When dune language 3.14 is enabled, resolve the binary in (run %{bin:..} ..) from where the binary is built. (#9708, @rgrinberg)

  • boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (#9735, fixes #9507, @emillon)

The ppxlib dev team is happy to announce the release of ppxlib.0.32.0.

The main feature of this release, implemented by @burnleydev1 during their Outreachy internship, is a huge improvement of the handling of located exceptions raised by ppx-es. Whenever a rewrite of the AST throws such an exception, the ppxlib driver catches it and resumes the rewriting using the latest valid AST it knows of. All caught exceptions are appended to the final AST as [%%ocaml.error ..] nodes. This means the driver returns a valid AST instead of one composed of a single error node corresponding to the first raised exception. This leads to a much better experience for ppx users as merlin now has a valid AST to work with when this happens, allowing it to properly function, reporting all errors, from ppx-es or otherwise. Note that despite this change we still recommend ppx authors to embed errors in the rewritten AST rather than throw exceptions.

The release also comes with a few bug fixes on longident parsing or windows compatibility and a new simplified API for ppx authors using attributes as flags (i.e. attributes without payloads such as [@ignore] for instance).

We'd like to thank our external contributors for this release:

  • @burnleydev1 for their improvement of the driver exception handling
  • @dianaoigo for their addition of the new attribute flags API
  • @jonahbeckford for their fix of the windows compatibility

We'd also like to thank the OCaml Software Foundation who has been funding my work on this release.

See full changelog
  • Add an optional embed_errors argument to Context_free.map_top_down that controls how to deal with exceptions thrown by context-free rules. (#468, @NathanReb)

  • Fix Longident.parse so it properly handles unparenthesized dotted operators such as +. or *.. (#111, @rgrinberg, @NathanReb)

  • raising an exception does no longer cancel the whole context free phase(#453, @burnleydev1)

  • Sort embedded errors that are appended to the AST by location so the compiler reports the one closer to the beginning of the file first. (#463, @NathanReb)

  • Update Attribute.get to ignore loc_ghost. (#460, @ceastlund)

  • Add API to manipulate attributes that are used as flags (#408, @dianaoigo)

  • Update changelog to use ISO 8061 date format: YYYY-MM-DD. (#445, @ceastlund)

  • Replace Caml with Stdlib. (#427, @ceastlund)

  • When a transformation raises, the last valid AST is used as input to the upcoming transformations. All such errors are collected and appended as extension nodes to the final AST (#447, @burnleydev1)

  • Fix a small mistake in the man pages: Embededding errors is done by default with -as-pp, not with -dump-ast (#464, @pitag-ha)

  • Set appropriate binary mode when writing to stdout especially for Windows compatibility. (#466, @jonahbeckford)

Dune 3.13.1

We just released version 3.13.1 with some bugfixes.

See full changelog
  • Fix performance regression for incremental builds (#9769, fixes #9738, @rgrinberg)

  • Fix dune ocaml top-module to correctly handle absolute paths. (#8249, fixes #7370, @Alizter)

  • subst: ignore broken symlinks when looking at source files (#9810, fixes #9593, @emillon)

  • subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (#9811, fixes #9538, @emillon)

  • boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (#9861, fixes #9794, @emillon)

Odoc 2.4.1

The release of odoc 2.4.0 last month introduced a regression that caused Dune rules to fail in some cases. This release of odoc 2.4.1 fixes this issue.

See full changelog

Fixed

  • Revert to outputing a file (without content) when rendering a hidden compilation unit. This fixes cases where the dune rules would fail. (@panglesd, #1069)

Feedback on this post is welcomed on Discuss!

We are happy to announce the first beta release of opam 2.2.0. It contains some fixes and a new feature for Windows. You can view the full list in the release note.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Major change: Check and advertise to use Git for Windows

Opam 2.2 is based on a Cygwin installation (previously installed, or managed internally by opam). Cygwin's Git has three known usability issues when used outside a Cygwin environment: it uses a different set of trusted certificate authorities, has its own Credential Manager and potentially uses a separate Git configuration. We therefore recommend using Git for Windows either installed manually or via winget.

At opam init, opam checks for available Git(s), and asks the user to choose one of the available, or to rerun opam init after installing another Git.

Other noteworthy changes

  • When compiling opam on Windows with MinGW, the resulting opam binary now contains libstdc++ instead of requiring the DLL to be distributed alongside it or present in the environment
  • Fix opam env containing carriage return on Cygwin - eval $(opam env) now works from a Cygwin bash terminal

Miscellaneous changes

  • Remove stray comments from pwsh and cmd opam env output
  • Add ./configure --enable-static to compile the opam binary statically on Linux
  • Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD
  • Upgrade to, and require mccs >= 1.1+17
  • Fix opam tree options --dev and --no-switch

Various other improvements were made and bugs were fixed. API changes are denoted in the release note linked above. This release also includes PRs improving the documentation and improving and extending the tests.

Windows Support

The main opam-repository Windows compliance is still a work in progress, we recommend to use existing compatible repository (originally from @fdopen) and 32/64 bit mingw-w64 packages (by @dra27).

How to Test opam on Windows

If you're feeling adventurous, you can use the experimental pre-built binary for Windows available here.

Otherwise you can compile opam yourself using the following steps:

This beta requires a preexisting Cygwin installation for compiling opam.

  1. Check that you have all dependencies installed:
  • autoconf, make, patch, curl
  • MinGW compilers: mingw64-x86_64-gcc-g++, mingw64-i686-gcc-g++
  • Or if you want to use the MSVC port of OCaml, you'll need to install Visual Studio or Visual Studio Build Tools
  1. Download & extract the opam archive
  2. In the directory, launch make cold
  3. A coffee later, you now have an opam executable!
  4. Start your preferred Windows terminal (cmd or PowerShell), and initialise opam with the Windows sunset repository:
  • opam init git+https://github.com/ocaml-opam/opam-repository-mingw

From here, you can try to install the sunset repository packages. If you find any bugs, please submit an issue. It will help opam-repository maintainers to add Windows repository packages into the main repository.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~beta1"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

Dune 3.13.0

We're happy to announce that Dune 3.13.0 is now available. This feature is packed with fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Generate Conflicts File for Menhir Grammars (#9512, @nojb)

When menhir is used to generate code from .mly files, there are sometimes issues with the grammar itself, such as shift-reduce conflicts.

Menhir has an option to generate a "conflicts" file using its --explain flag, but until now this was not exposed by Dune. Starting from this version, this file will be generated automatically to help developers debug their grammars.

Cached Directory Targets (#9535, @rleshchinskiy)

Dune's global cache is a way to save the result of intermediate build results, even across projects. Previously, it would only work with file targets. With this change, it now supports Dune's experimental directory targets.

Dynamic Module List (#9578, @nojb)

In several places in the Dune language, it is possible to pass a list of modules. For example in a (library) stanza, if for some reason the default of picking all the source files in the current directory is not the right thing to do, it is possible to pass (module A B C) to only attach these modules to the library.

An important limitation has been that the list of modules needed to be static: written as is in the dune file. This limitation has now been lifted and it is possible to use (:include) or %{read-lines:file} in this field and similar ones.

LexiFi's use case is a system of static plug-ins: a program is extended by selecting which modules are linked to the application core. This list of modules can now be emitted by a generator that reads a configuration file.

Previously, this required using OCaml syntax for the dune file, which has several issues, including incompatibility with features like (include_subdirs) and poor performance because Dune does not know the dependencies of the generator and needs to re-run the build more times than necessary.

See full changelog

Added

  • Add command dune cache clear to completely delete all traces of the Dune cache. (#8975, @nojb)

  • Allow to disable Coq 0.8 deprecation warning (#9439, @ejgallego)

  • Allow OCAMLFIND_TOOLCHAIN to be set per context in the workspace file through the env stanza. (#9449, @rgrinberg)

  • Menhir: generate .conflicts file by default. Add new field to the (menhir) stanza to control the generation of this file: (explain <blang expression>). Introduce (menhir (flags ...) (explain ...)) field in the (env) stanza, delete (menhir_flags) field. All changes are guarded under a new version of the Menhir extension, 3.0. (#9512, @nojb)

  • Directory targets can now be cached. (#9535, @rleshchinskiy)

  • It is now possible to use special forms such as (:include) and variables %{read-lines:} in (modules) and similar fields. Note that the dependencies introduced in this way (i.e., the files being read) must live in a different directory than the stanza making use of them. (#9578, @nojb)

  • Remove warning 30 from default set for projects where dune lang is at least 3.13 (#9568, @gasche)

  • Add coqdoc_flags field to coq field of env stanza, allowing the setting of workspace-wide defaults for coqdoc_flags. (#9280, fixes #9139, @Alizter)

  • ctypes: fix an error where (ctypes) with no (function_description) would cause an error trying refer to a nonexistent _stubs.a dependency (#9302, fix #9300, @emillon)

Changed

  • Check that package names in (depends) and related fields in dune-project are well-formed. (#9472, fixes #9270, @ElectreAAS)

Fixed

  • Do not ignore (formatting ..) settings in context or workspace files (#8447, @rgrinberg)

  • Fixed a bug where Dune was incorrectly parsing the output of coqdep when it was escaped, as is the case on Windows. (#9231, fixes #9218, @Alizter)

  • Copying mode for sandboxes will now follow symbolic links (#9282, @rgrinberg)

  • Forbid the empty (binaries ..) field in the env stanza in the workspace file unless language version is at least 3.2. (#9309, @rgrinberg)

  • [Coq] Fix bug in computation of flags when composed with boot theories. (#9347, fixes #7909, @ejgallego)

  • Fixed a bug where the (select) field of the (libraries) field of the (test) stanza wasn't working properly. (#9387, fixes #9365, @Alizter)

  • Fix handling of the PATH argument to dune init proj NAME PATH. An intermediate directory called NAME is no longer created if PATH is supplied, so dune init proj my_project . will now initialize a project in the current working directory. (#9447, fixes #9209, @shonfeder)

  • Experimental doc rules: Correctly handle the case when a package depends upon its own sublibraries (#9461, fixes #9456, @jonludlam)

  • Resolve various public binaries to their build location, rather than to where they're copied in the _build/install directory (#9496, fixes #7908, @rgrinberg).

  • Correctly ignore warning flags in vendored projects (#9515, @rgrinberg)

  • Use watch exclusions in watch mode on MacOS (#9643, fixes #9517, @PoorlyDefinedBehaviour)

  • Fix Merlin configuration for (include_subdirs qualified) modules (#9659, fixes #8297, @rgrinberg)

  • Fix handling of enabled_if in binary install stanzas. Previously, we'd ignore the result of enabled_if when evaluating %{bin:..} (#9707, @rgrinberg)

Dune 3.12.2

We just released version 3.12.2 with 2 bugfixes.

See full changelog

Fixed

  • Fix version check in runtest_alias for cram stanza (#9454, @emillon)

  • Fix stack overflow when a (run) action can not be parsed. (#9530, fixes #9529, @gridbugs)

We are pleased to announce the release of OCaml LSP 1.17.0. This version comes packed with fixes and new features.

Notable features that come in this release include:

  • Compatibility with Odoc 2.3.0: This version is fully compatible with Odoc 2.3.0, introducing support for the latest syntax features like tables and "codeblock output."
  • New Actions for Code Cleanup: You can now mark or remove unused elements such as 'open', types, for loop indexes, modules, match cases, 'rec', and constructors, making your code cleaner and more efficient.
  • Auto-completion for 'in' Keyword: To address the long standing issue of the in keyword completing to other terms in the editor, we've added auto-completion for this keyword in OCaml LSP. Typing in will now only suggest auto completion for the in keyword.
See full changelog

Fixes

  • Fix missing super & subscripts in markdown documentation. (#1170)
  • Do not invoke dune at all if --fallback-read-dot-merlin flag is on. (#1173)
  • Fix semantic highlighting of infix operators that contain '.'. (#1186)
  • Disable highlighting unit as an enum member to fix comment highlighting bug. (#1185)
  • Improve type-on-hover and type-annotate efficiency by only formatting the type of the first enclosing. (#1191, #1196)
  • Fix the encoding of URI's to match how vscode does it (#1197)
  • Fix parsing of completion prefixes (#1181)

Features

  • Compatibility with Odoc 2.3.0, with support for the introduced syntax: tables, and "codeblock output" (#1184)
  • Display text of references in doc strings (#1166)
  • Add mark/remove unused actions for open, types, for loop indexes, modules, match cases, rec, and constructors (#1141)
  • Offer auto-completion for the keyword in (#1217)

Odoc 2.4.0

The odoc team is delighted to announce the release of odoc 2.4.0. It mainly contains support for search engines. There are of course bugfixes and smaller new features.

🌟 Spotlight Feature of Odoc 2.4.0 : Search

Odoc now support searching in the documentation ! The search is made to run in the browser, so that you do not need a server to enable search: you can have search on your documentation hosted on github pages or even locally on your machine.

No search engine is shipped with, you need to provide one, but all the facilities to make use of one are present. We adapted @art-w 's sherlodoc for seamless integration with odoc, alongside with new features. It is not yet released on opam, but we hope it will be soon.

You can already test sherlodoc and play with it on your own projects, there are instructions in its readme. Sherlodoc has fuzzy typed-based search like hoogle in the haskell world, and is made to work best for OCaml (unlike a general purpose search engine like elastic search).

Check the results on odoc's own online documentation : ocaml.github.io/odoc.

🀝 Join The Mission

While we are dedicated to developing the best tooling to generate and serve documentation on OCaml.org, creating a well-documented library ecosystem can only be a collective effort. Package authors: we’re working hard to give you great tools, but we’ll need all your help to create an ecosystem of well-documented libraries for OCaml!

If you find that writing documentation for your library isn’t as straightforward as you would like, please do share your feedback with us.

See full changelog

Added

  • Add support for external search engines (@panglesd, @EmileTrotignon, #972) This includes the generation of an index and the display of the results in the UI (HTML only).
  • Display 'private' keyword for private type extensions (@gpetiot, #1019)
  • Allow to omit parent type in constructor reference (@panglesd, @EmileTrotignon, #933)

Fixed

  • Warn and exit when table(s) is not closed (@lubegasimon, #1050)
  • Hint when list(s) is not closed (@lubegasimon, #1050)
  • Fix crash on functors returning an alias (@Julow, #1046)
  • Fix rendering of polymorphic variants (@wikku, @panglesd, #971)
  • Add references to extension declarations (@gpetiot, @panglesd, #949)

Changed

  • Style: Adjusted line height in the TOC to improve readability (@sorawee, #1045)
  • Style: Remove font fallback to Helvetica, Arial (@Julow, #1028)
  • Style: Preformatted elements fallback to UA monospace (@toastal, #967)
  • Style: Sidebar is now stuck to the left of the content instead of the left of the viewport (@EmileTrotignon, #999)

We're happy to announce the release of Merlin 4.13. This release comes with a number of bug fixes to the Merlin binary.

It also introduces a new -cache-lifespan flag that can be used to set cache invalidation periods. This flag allows for fine-tuning of cache invalidation periods, enabling users to customize Merlin's internal configurations for optimal performance in various project contexts.

Additionally, this release includes several improvements in editor modes. For more details, we encourage you to delve into the full changelog.

See full changelog
  • merlin binary
    • Fix a follow-up issue to the preference of non-ghost nodes introduced in #1660 (#1690, fixes #1689)
    • Add -cache-lifespan flag, that sets cache invalidation period. (#1698, #1705)
    • Fix Merlin locate not fallbacking on the correct file in case of ambiguity (@goldfirere, #1699)
    • Fix Merlin reporting errors provoked by the recovery itself (#1709, fixes #1704)
  • editor modes
    • vim: load merlin when Vim is compiled with +python3/dyn (e.g. MacVim)
    • emacs: highlight only first error line by default (#1693, fixes #1663)

Dune 3.12.1

We're pleased to announce the release of Dune 3.12!

Note that due to a mistake during the release process, version 3.12.0 was not published to opam and should not be used.

This version contains many fixes but we would like to highlight the following features:

  • dune ocaml doc is a new command that will build the docs of your package, and open them in a web browser directly.
  • a new set of odoc rules will build documentation for the whole switch. It can be invoked by dune build @doc-new. Note that this is still experimental.
  • Dune can now be built and installed on Haiku.
See full changelog

Added

  • Introduce $ dune ocaml doc to open and browse documentation. (#7262, fixes #6831, @EmileTrotignon)

  • dune cache trim now accepts binary byte units: KiB, MiB, etc. (#8618, @Alizter)

  • Introduce the runtest_alias field to the cram stanza. This allows removing default runtest alias from tests. (@rgrinberg, #8887)

  • Display cache location in Dune log (#8974, @nojb)

  • Dune can now be built and installed on Haiku (#8795, fix #8551, @Alizter)

  • Mark installed directories in dune-package files. This fixes (package) dependencies against packages that contain such directories. (#8953, fixes #8915, @emillon)

  • Introduce new experimental odoc rules (#8803, @jonjudlam)

Changed

  • dune-build-info: when version="" is found in a META file, we now return None as a version string (#9177, @emillon)

  • No longer force colors for OCaml 4.03 and 4.04 (#8778, @rgrinberg)

  • Dependencies in the copying sandbox are now writeable (#8920, @rgrinberg)

  • Rules that only use internal dune actions (write-file, echo, etc.) can now be sandboxed. (#9041, fixes #8854, @rgrinberg)

  • Add test_ prefix to default test name in dune init project (#9257, fixes #9131, @9sako6)

Fixed

  • Do not ignore libraries named bigarray when they are defined in conjunction with OCaml 5.0 (#8902, fixes #8901, @rgrinberg)

  • Correctly ignore bigarray on recent versions of OCaml (#9076, @rgrinberg)

  • Absent packages shouldn't prevent all rules from being loaded (#8948, fixes #8630, @rgrinberg)

  • Correctly determine the stanza of menhir modules when (include_subdirs qualified) is enabled (@rgrinberg, #8949, fixes #7610)

  • Re-run actions whenever (expand_aliases_in_sandbox) changes (#8990, @rgrinberg)

  • Do not re-run rules when their location changes (#9052, @rgrinberg)

  • [coq rules] Be more tolerant when coqc --print-version / --config don't work properly, and fallback to a reasonable default. This fixes problems when building Coq projects with (stdlib no) and likely other cases. (#8966, fix #8958, @Alizter, reported by Lasse Blaauwbroek)

  • Dune will now run at a lower framerate of 15 fps rather than 60 when INSIDE_EMACS. (#8812, @Alizter)

Feedback on this post is welcomed on Discuss!

We are happy to announce the third alpha release of opam 2.2.0. It contains some fixes and a new feature for Windows. You can view the full list in the release note.

This version is an alpha, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Major change: Environment variables handling on Windows

opam files now support a new x-env-path-rewrite field which specifies rewriting rules for the environment variable updates defined in the setenv and build-env fields. This field allows greater control over the separator character used for PATH-like fields (i.e. ; vs :), conversion of slashes to backslashes, and even conversion from Windows native path format (C:\cygwin64\home\dra\.opam) to Cygwin format (/home/dra/.opam).

The rewriting rules allow opam directory-like variables (e.g. the %{lib}% directory of a switch) to be used in setenv and build-env fields in a portable way.

For example, given:

setenv: [
  [PKG_CONFIG_PATH += "%{lib}%/pkgconfig"]
  [PATH += "%{share}%/bin"]
]
x-env-path-rewrite: [
  [ PKG_CONFIG_PATH ":" "host" ]
  [ PATH (":" {os != "win32"} | ";" {os = "win32"}) ("target" {os != "win32"} | "target-quoted" {os = "win32"}) ]
]

the environment variable changes given by opam env on Windows would be:

PKG_CONFIG_PATH='/cygdrive/c/Users/DRA/AppData/Local/opam/default/lib/pkgconfig[:<rest-of-PKG_CONFIG_PATH, if given>]'
PATH='C:\Users\DRA\AppData\Local\opam\default\share\bin;C:\Users\DRA\AppData\Local\opam\default\bin;<rest-of-PATH>'

with the following interesting parts for Windows users:

  • PKG_CONFIG_PATH, which is consumed by a Cygwin-tool, has the directory given in Unix-like syntax, and opam's share variable was automatically converted
  • The correct separator is used for each (: for PKG_CONFIG_PATH, ; for PATH is used when adding entries)
  • In the PATH update, /bin was converted to \bin

Note that the specification for PATH is opam's default behaviour, so it's not actually necessary to have this formula for PATH in the x-env-path-rewrite field.

The full syntax is described in full in the manual.

Opam files carrying this new field are still compatible with the opam 2.0 syntax as it is an extension field, however its effect is only available with opam 2.2.0~alpha3 and above. If you want to make sure users of the package containing it have a compatible opam, you can use the available field to that end:

available: opam-version >= "2.2.0~alpha3"

or, if the change is Windows-specific:

available: opam-version >= "2.2.0~alpha3" | os != "win32"

Other noteworthy changes

  • Sandbox: /tmp is now writable again, restoring POSIX compliance
  • opam tree: opam tree package.version is now supported, displaying the dependency tree of a specific version of a package
  • opam tree: --recurse and --subpath are supported for directory arguments
  • opam admin: new add-extrafiles command to add/check/update the extra-files: field according to the files present in the files/ directory
  • opam lint: new syntax allow marking a set of warnings as errors e.g. -W @1..9
  • Releases: Pre-built binaries now include ppc64le and s390x

Miscellaneous changes

  • A handful of issues related to the compilation of opam on Windows were fixed
  • Bugs in the handling of the OPAMCURL, OPAMFETCH and OPAMVERBOSE environment variables were fixed
  • Bugs in the handling of the --assume-built argument were fixed
  • Sporadic crashes and segfaults during shell detection on Windows were fixed

Various other improvements were made and bugs were fixed. API changes are denoted in the release note linked above. This release also includes a handful of PRs improving the documentation and more than a dozen PRs improving and extending the tests.

Windows Support

The main opam-repository Windows compliance is still a work in progress, we recommend to use existing compatible repository (originally from @fdopen) and 32/64 bit mingw-w64 packages (by @dra27).

How to Test opam on Windows

If you're feeling adventurous, you can use the experimental pre-built binary for Windows available here. It should work but since it's our first public pre-built binary for Windows please use at your own risk.

Otherwise you can compile opam yourself using the following steps:

This alpha requires a preexisting Cygwin installation for compiling opam.

  1. Check that you have all dependencies installed:
  • autoconf, make, patch, curl
  • MinGW compilers: mingw64-x86_64-gcc-g++, mingw64-i686-gcc-g++
  • Or if you want to use the MSVC port of OCaml, you'll need to install Visual Studio or Visual Studio Build Tools
  1. Download & extract the opam archive
  2. In the directory:
  • if you are using MSVC: launch make cold
  • if you are using MinGW: make sure the path to the libc dlls are in your PATH and launch make cold. For instance: export PATH='C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin':$PATH && make cold. Don’t forget to update PATH accordingly or place the opam binary in the same directory as the libc dlls if you want to move the resulting opam binary.
  • alternatively, if you're using MinGW: make cold CONFIGURE_ARGS=--with-private-runtime. If you change the location of the resulting opam binary, don't forget to copy Opam.Runtime.amd64 directory (or Opam.Runtime.i386) in the same directory.
  1. A coffee later, you now have an opam executable!
  2. Start your preferred Windows terminal (cmd or PowerShell), and initialise opam with the Windows sunset repository:
  • opam init git+https://github.com/ocaml-opam/opam-repository-mingw

From here, you can try to install the sunset repository packages. If you find any bugs, please submit an issue. It will help opam-repository maintainers to add Windows repository packages into the main repository.

Try it!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries: run

    bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.2.0~alpha3"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we hope you will enjoy the new features!

We’re pleased to announce the release of opam-publish 2.3.0.

This release, apart from a couple of light improvements, mainly consists of the following new option:

  • You can now use opam-publish with the --no-confirmation argument for use in automated pipeline. Use this option with extreme caution if you do use it.

The full changelog is available below.

Enjoy, The opam team

See full changelog
  • Add a new --no-confirmation argument for use in automated pipeline [#158 @AltGr - fix #132]
  • Improve the error message when a file expected to be an opam file is given as argument [#150 @kit-ty-kate - partially fix #149]
  • Adopt the OCaml Code of Conduct [#151 @rikusilvola]
  • Changes the makefile to make sure the standard "make && make install" works [#157 @kit-ty-kate]

Odoc 2.3.1

Following the release of odoc 2.3.0, we're releasing a patch release with odoc 2.3.1 that fixes support for OCaml 5.1.

See full changelog

After giving space for feedback and objections by the community, we have deprecated ocaml-migrate-parsetree (aka OMP). It is superseded by Ppxlib.

There are four major differences between OMP and Ppxlib, which all go hand in hand.

The first major difference is in the library and therefore impacts how to write PPXs. With OMP, each PPX author had to choose a parsetree version to define their PPX against. There was no version agreement between different PPXs. With Ppxlib, each PPX author uses the same parsetree version.

The second major difference is about compatibility with new compiler syntax. While with OMP, each PPX was on its own parsetree version, Ppxlib keeps them all on the version of the latest stably released compiler. That makes using any PPX compatible with using the latest compiler syntax features!

The third major difference is in the philosophy of PPXs. With OMP, all PPX transformations were global transformations, i.e., transformations of the whole parsetree. Ppxlib has introduced the concept of "context-free" transformations, i.e., transformations that transform only one parsetree node. By restricting their scope of action, context-free PPXs are a lot more predictable and less dangerous! Also, Ppxlib merges all context-free PPXs into one parsetree pass, defining clear semantics of PPX composition.

The fourth major difference is in the driver, i.e., the binary that drives the application of all used PPXs in a project. The Ppxlib driver is significantly more performant than the OMP driver used to be. That's partly because it does a lot fewer parsetree migrations and partly thanks to merging all context-free PPXs into one parsetree pass.

As a consequence of the deprecation, OMP will be incompatible with any new compiler version. The first incompatible compiler version is OCaml 5.1.

Thanks a lot to everyone involved in OCaml's transition from OMP to Ppxlib, for example by porting their PPX!

Dune 3.11.1

Following the release of Dune 3.11.0 a few days ago, we've just released version 3.11.1 with a couple of bug fixes:

  • Fix the dune rpc status command that was incorrectly showing that there were no RPC servers running on Windows.
  • Fix a bogus error when no inline test was declared in a library using (inline_tests).
See full changelog

Fixed

  • Fix dune rpc commands on Windows (#8806, fixes #8799, @nojb)

  • Fix inline_tests when the partition list is empty (#8849, fixes #8848, @hhugo)

If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.