Skip to content

Conversation

@Sudha247
Copy link
Collaborator

@Sudha247 Sudha247 commented Nov 24, 2025

Closes #11652

Adds a tutorial for setting up an OxCaml project with Dune package management.

I contemplated where this should go, and thought this might be a good place, after all. It shows (1) how to setup an OxCaml project, (2) servers as a live example of the previous two tutorials.

#12111 is a more comprehensive tutorial about parametric libraries and OxCaml, but it doesn't specifically cover the topic of Dune package management with OxCaml. I recently ported an OxCaml project to build with Dune package management and the configuration was not as straightforward as I expected, and thought a tutorial on this topic might be useful.

This takes some material from https://github.com/gridbugs/hello-oxcaml (thanks @gridbugs!).

@Alizter
Copy link
Collaborator

Alizter commented Nov 24, 2025

Here are some screenshots:

image

I think having these drop-down code excerpts is kind of pointless. Perhaps it would be better just to have the code inline like we do elsewhere in the docs.

@Alizter
Copy link
Collaborator

Alizter commented Nov 24, 2025

The main title doesn't need to say Example: probably.

Copy link
Member

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to have this included!

@Sudha247 Sudha247 force-pushed the hello-oxcaml branch 2 times, most recently from 65b4bc6 to 64d39ec Compare November 25, 2025 14:48
@Alizter
Copy link
Collaborator

Alizter commented Nov 26, 2025

At some point these how-to's turned into markdown rather than being rst documents which is slightly confusing. In rst we have syntax highlighting for dune files etc. Does anybody remember why markdown was chosen for these?

I would suggest writing this tutorial in rst, not only for consistency, but because it will play better with cross-linking that we have elsewhere in the docs.

@Sudha247 Sudha247 force-pushed the hello-oxcaml branch 2 times, most recently from 135bb8e to 9f8c4b7 Compare November 26, 2025 17:06
@Sudha247
Copy link
Collaborator Author

I would suggest writing this tutorial in rst, not only for consistency, but because it will play better with cross-linking that we have elsewhere in the docs.

I'm not opposed to doing this, but wouldn't be weird if only one of the dune-package-management entries is in rst, while others are in markdown?

@Alizter
Copy link
Collaborator

Alizter commented Nov 26, 2025

Ideally they should be all in rst, but would blow this PR out of scope. If you think it would be too much work to do in this PR, let's instead create an issue so that we remember to do it eventually. I won't block on this point.

@Leonidas-from-XIV
Copy link
Collaborator

Ah, I dug a bit around and it is because of this PR by @emillon where he notes:

  • it maps fully to reST
  • it's more contributor friendly
  • editor tooling is better
  • it alleviates some vendor lock-in (since we're likely to migrate to ocaml.org at some point, and it's more likely to use a variant of md than sphinx support odoc syntax)

Which all sound like pretty decent points.

@Sudha247 Sudha247 requested a review from Alizter November 27, 2025 09:25
(version 3.1.0+ox)))
(lock_dir
(path "dune.lock")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is probably optional.

@Alizter
Copy link
Collaborator

Alizter commented Nov 27, 2025

We also have a macros for the latest dune lang version which might be sensible to use.

@rgrinberg rgrinberg added docs Documentation improvements package management oxcaml Related to the support to OxCaml functionnalities labels Dec 2, 2025
Comment on lines 5 to 6
[OxCaml](https://oxcaml.org/) project. OxCaml is a compiler branch with fast
moving set of extensions to OCaml. Some tweaks are required to set up a project
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[OxCaml](https://oxcaml.org/) project. OxCaml is a compiler branch with fast
moving set of extensions to OCaml. Some tweaks are required to set up a project
[OxCaml](https://oxcaml.org/) project. OxCaml is a compiler branch with a fast
moving set of extensions to OCaml. Some tweaks are required to set up a project

(lock_dir
(path "dune.lock")
(repositories :standard oxcaml))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(repositories :standard oxcaml))
(pins ocamlbuild)
(repositories :standard oxcaml))

Copy link
Member

@shonfeder shonfeder Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently the pins in a workspace are just declarations of names (unlike pin in a dune-project, which work differently for some reason?), and to get the pin to actually pin you have also declare it for every lock_dir

@Sudha247 Sudha247 force-pushed the hello-oxcaml branch 2 times, most recently from 5e002b9 to dd17e0c Compare December 4, 2025 11:41
@Sudha247
Copy link
Collaborator Author

Sudha247 commented Dec 4, 2025

I've addressed all the comments. I've also made the configuration of dev tools point to the how-to guide so we have a single source of information. However, this tutorial is now hitting #12839 and #12851. But there's nothing to change in the tutorial as such.

@shonfeder
Copy link
Member

Perhaps the solution for the oxcaml-side is just to undo (my suggestion of) using the lockless package management until that is fixed? We could create a TODO on the docs to simplify, and cross link from #12851, which would allow us to close this with correct information, and track the need to update it when the latter is fixed.

Does this sound like an OK way forward, @Sudha247 ?

@Sudha247
Copy link
Collaborator Author

That sounds good to me. I will undo the autolocking part, write a TODO in the docs to fix this, and note it down in #12851.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation improvements oxcaml Related to the support to OxCaml functionnalities package management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pkg] Build OxCaml with Dune package management

6 participants