Tutorials
Blog
About

Tutorials > Julia Programming: a Hands-on Tutorial

Projects and Packages

by Martin D. Maas, Ph.D
@MartinDMaas

Last updated: 2021-11-16

Julia has three closely related terms which are "environments", "projects" and "packages". Let's go over what these terms mean.

In the following sections of this tutorial series, we will go about all we need to know about organizing a project.

This includes organizing code into modules and different files, creating a test suite, automatically generating documentation, and more, like compiling packages and collaborating on open-source packages.

Before we begin, let’s go over some basic terminology.

Environments

The most simple of these three concepts is the “environment”.

An environment is just the way for Julia to know what “import X” or “using X” means.

In order to do this, an environment defines a set of packages as dependencies, optionally with versions down to specific commits.

Reasons to use different environments include the ability to work with different package versions, like older ones for backward compatibility, or switching between stable and development branches of code.

Projects

A project, on the other hand, is the way by which we organize our work. In particular, a project necessarily defines and environment (i.e. a set of dependencies) but it also has other things, most commonly:

Packages

Finally, a package is largely a project that has been made public, for others to use as a third party library.

As such, a package should focus on reusable code, and avoid certain things we might have when we have a project for personal use, like global runtime configuration parameters, or contain a collection of “scripts” that run code.

Other way of understanding the difference in the Projects/Packages terminology is by considering some close analogues of both terms: For example, we can also think of Projects/Packages as Programs/Libraries, correspondingly. A useful distinction is that projects are usually top-level code, while packages are reusable code.

Importantly, a package should contain a project file with a uuid, or unique identifier, which is used to identify the package in projects that depend on it.

Conclusion

When I just started programming in Julia, I found these terms a little confusing, as sometimes they are used interchangely. I hope this post provided some clarification.

For a more in depth description of these, and other related terms, you can check out the Pkg documentation Glossary

Ask me a question or send me your comments!

Don't hesitate to ask me any question about the topics I cover on this blog!

Click here to reach out!