Template for creating a new opam package repository
  • Dune 65.2%
  • OCaml 18.4%
  • Makefile 15%
  • Shell 1.4%
Find a file
2026-03-17 07:12:39 +01:00
.github Fix CI 2025-04-10 10:55:14 +02:00
.vscode add spell config 2023-10-27 13:48:08 +02:00
example Sync with example repo 2025-10-29 12:10:59 +01:00
template Sync template 2025-10-29 12:21:07 +01:00
.gitattributes added gitattributes 2023-03-03 18:54:04 +01:00
.gitignore spinify parameters 2021-11-23 15:25:40 +01:00
CHANGES.md move changelog 2023-11-03 14:30:37 +01:00
example.sh some updates 2023-04-05 07:15:12 +02:00
LICENSE update LICENSE date 2022-05-09 13:41:02 +02:00
README.md Archive notice 2026-03-17 07:12:39 +01:00
spin add spell config for vscode 2023-10-27 11:10:33 +02:00

opam package template

⚠️ This repository is now a public archive. I have stopped developing the project and will no longer be maintaining it.

This project served me well from 2021 to 2025, and I am grateful to the authors and maintainers of the open-source libraries I was able to build upon and learn from here.

For related work with a more modern take, see also this issue, and keep an eye on dune init!

Happy templating and thank you!


Actions Status

This is a project template for creating a new opam package repository.

Using the template

opam spin new https://github.com/mbarbin/opam-package-template.git my-package
cd my-package

You can see an example of generated project in the example/ directory.

In order to see the template's github actions workflows being executed, the example generated project is also hosted as a separate repo here.

Motivation and relationship to spin's default templates

This template is meant for personal use only. If you landed on this page and are looking for an OCaml project template, I recommend having a look at:

I expect this template to be very close to spin's bin template, although they may differ by small details. I use this repo rather than spin's default to:

  • learn about modern practices regarding OCaml packages tooling
  • learn how to write a spin template

What's included

The template enables:

  • opam/dune build
  • ocamlformat
  • basic Makefile
  • janestreet style expect tests
  • linting (opam and opam-dune-lint)
  • github actions for basic continuous integration
    • allows for janestreet-bleeding opam repositories dependency

Sanity checks

After creating the project directory, you can:

  • Edit the long opam description

  • Choose an appropriate License

  • Check the validity of the opam file:

opam lint
  • Test the various targets of the Makefile:
make all
make test
make fmt
make lint
make clean
  • Check that the installation works as intended:
opam pin .
opam install .

More generally, refer to opam packaging documentation.

Acknowledgements

  • This template is very close to (and heavily inspired by) spin's bin template.
  • example.sh and the CI script of the root repo is based on spin-dream.
  • The github workflow of the template was created from examples found at ocaml/setup-ocaml.