OverviewTeaching: 15 min
Exercises: 15 minQuestions
How to create a package?Objectives
Learn setting up a project using modules.
Learn common package structure.
Learn to browse GitHub or juliahub for packages and find documentation.
Melissa is now confident that her module fine and she wants to make it available for the rest of her physics club. She decides to put it in a package. This way she can also locally use Julia’s package manager for managing her module.
From project to package
The path from having a module to having a package is actually very short:
Packages need a
name and a
uuid field in their
A UUID is a universally unique identifier.
Thankfully Julia comes with the
UUIDs package, that can generate
In addition Melissa needs to have a specific directory structure.
She looks at the example package
Example.jl which has the following
├── docs │ ├── make.jl │ ├── Project.toml │ └── src │ └── index.md ├── LICENSE.md ├── Project.toml ├── README.md ├── src │ └── Example.jl └── test └── runtests.jl
Make it a package
name = <your name>,
uuid = <your uuid>and optionally an
authorsfield, each on a separate line.
Now Melissa can use
pkg> dev . # or path to package instead of `.`
instead of needing to
includet MelissasModule.jl, and she can write
using MelissasModule instead of
Register a package
In order for her friends to be able to get the package, Melissa registers the package in the general registry. This can be done either via JuliaHub or by making a pull request on GitHub which can also be automated by the Julia Registrator.
Creating a new package
Melissa thinks next time she will start with a package right away.
Create your own package
Look at the documentation of the package creation helper packages and create a new package using
The general registry is hosted on GitHub.
Packaging is easy