I have a few questions about environments and projects in julia’s package manager. I have read the documentation, so these questions are really about making sure I understand properly.
.julia/environments lists all the environments that Julia sees. As of right now, I see a folder called
v1.0, each with a
Project.toml files. What this tells me is that in the default environment of
Project.toml files tells me what packages are available for me to use. I can edit this file using
rm from the package manager.
Q2. I also see a folder called
.julia/packages. Here I see all the packages I’ve added previously (as well as their dependencies. In each package folder, there are subfolders each containing a full copy of the source. I assume these subfolders are packages at some state (given by the
git hash). This makes perfect sense since different projects may depend on different versions of a package. Is my understanding correct? (There might be way more packages in this folder than in
Project.toml… some of these are dependencies of the packages themselves, some of them do nothing and would be deleted once I run garbage collector, correct?)
It’s time to write my own package, so I do
generate FooBar which will create a folder with a
Manifest.toml and a
Project.toml file, as well as a source folder with a barebones module. I can
cd into this directory and type in
activate . which changes my environment from default
FooBar. Here lies my confusion.
Q3. I can add a dependency by saying
add Example which adds the project at its latest release (in github). This edits the
Project.toml file as well as downloads a copy to
.julia/packages (it dosn’t redownload if it’s already there), correct?
Q4. However, why do I have to
add? If I just type in
using Example, it works… I am a little confused here. Since I never
add the package, how can I run
using Example? What version does it use? I suppose if I want to share my package with others, I should
add first to force the end user to download the package… otherwise they may have the wrong version or might not even have the package at all.
Q5. Why dosn’t the
.julia/environments update itself? I’ve added a new environment called
FooBar (which is in some other directory) but I would like to have all my environments in one folder… I am not sure if this makes sense.
Q6. At no point did I ever run
dev? What is the purpose of that? I am already “developing” my package so do I need to run
Q7. What is the correct way to contribute to Julia/packages? Right now, my work flow is simply to
git clone the project, stay in my
v1.0 environment, download the packages I need, and submit PR if required. I’ve seen people using
dev for an alternative workflow.