Package management

Hi there, this is my first question to the community.

I am trying to understand how the package management facility and Project.toml? First, does this file, Project.toml, play the same functionality of virtualenv in Python, to have a different and isolated package environment per each workspace/project?

Second, suppose I have a structure such as the follows:
and I wish to create a separate script, in a different code path that uses the functionalities of /Project1, e.g.

How can I load/include from script.jl the file /Project1/path/to/something.jl and all its dependencies? Moreover, how can I add further dependencies in /Project2 without touching /Project1/Project.toml?

Thanks in advance,


Yes, that’s roughly correct. You can activate an environment by typing ]activate path/to/env.

If you want to load its dependencies, you can ]activate /Project2 followed by ]add /Project1. Pkg will add the path as a dependency to Project2, which will get its own Project.toml and Manifest.toml.

Note that usually Project1 has a module called Project1 at /Project1/src/Project1.jl, which you can use by doing using Project1 after ]add /Project1. It’s not quite idiomatic to just have environments with files that are included manually - nested directories and namespaces are not related in julia, unlike in python where the namespace structure follows the directory structure.


You can also refer to this tutorial on creating packages: 11 - Developing Julia packages - Julia language: a concise tutorial

I found much easier to start the package already as a github/gitlab repository rather than having it only locally and modify environmental variables…