Skip to content

Commit 18309fc

Browse files
update DEPOT_PATH and JULIA_DEPOT_PATH docs
1 parent a700853 commit 18309fc

File tree

3 files changed

+68
-25
lines changed

3 files changed

+68
-25
lines changed

base/initdefs.jl

+31
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,37 @@ isinteractive() = (is_interactive::Bool)
4141

4242
## package depots (registries, packages, environments) ##
4343

44+
"""
45+
DEPOT_PATH
46+
47+
A stack of "depot" locations where the package manager, as well as Julia's code
48+
loading mechanisms, look for package registries, installed packages, named
49+
environments, repo clones, cached compiled package images, and configuration
50+
files. By default it includes:
51+
52+
1. `~/.julia` where `~` is the user home as appropriate on the system;
53+
2. an architecture-specific shared system directory, e.g. `/usr/local/share/julia`;
54+
3. an architecture-independent shared system directory, e.g. `/usr/share/julia`.
55+
56+
So `DEPOT_PATH` might be:
57+
```
58+
[joinpath(homedir(), ".julia"), "/usr/local/share/julia", "/usr/share/julia"]
59+
```
60+
The first entry is the "user depot" and should be writable by and owned by the
61+
current user. The user depot is where: registries are cloned, new package versions
62+
are installed, named environments are created and updated, package repos are cloned,
63+
newly compiled package image files are saved, log files are written, development
64+
packages are checked out by default, and global configuration data is saved. Later
65+
entries in the depot path are treated as read-only and are appropriate for
66+
registries, packages, etc. installed and managed by system administrators.
67+
68+
`DEPOT_PATH` is populated based on the [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH)
69+
environment variable if set.
70+
71+
See also:
72+
[`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), and
73+
[Code Loading](@ref Code-Loading).
74+
"""
4475
const DEPOT_PATH = String[]
4576

4677
function append_default_depot_path!(DEPOT_PATH)

doc/src/base/constants.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Base.PROGRAM_FILE
66
Base.ARGS
77
Base.C_NULL
88
Base.VERSION
9+
Base.DEPOT_PATH
910
Base.LOAD_PATH
1011
Base.Sys.BINDIR
1112
Base.Sys.CPU_THREADS

doc/src/manual/environment-variables.md

+36-25
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ the chapter on [Code Loading](@ref).
9191

9292
The `JULIA_LOAD_PATH` environment variable is used to populate the global Julia
9393
[`LOAD_PATH`](@ref) variable, which determines which packages can be loaded via
94-
`import` and `using` (see [Code Loading](@ref)). Unlike the shell `PATH` variable,
95-
empty entries in `JULIA_LOAD_PATH` are expanded to the default value of `LOAD_PATH`,
96-
`["@", "@v#.#", "@stdlib"]` when populating `LOAD_PATH`. This allows easy appending,
97-
prepending, etc. of the load path value in shell scripts regardless of whether
98-
`JULIA_LOAD_PATH` is already set or not. For example, to prepend the directory
99-
`/foo/bar` to `LOAD_PATH` just do
94+
`import` and `using` (see [Code Loading](@ref)).
95+
96+
Unlike the shell `PATH` variable, empty entries in `JULIA_LOAD_PATH` are expanded to
97+
the default value of `LOAD_PATH`, `["@", "@v#.#", "@stdlib"]` when populating
98+
`LOAD_PATH`. This allows easy appending, prepending, etc. of the load path value in
99+
shell scripts regardless of whether `JULIA_LOAD_PATH` is already set or not. For
100+
example, to prepend the directory `/foo/bar` to `LOAD_PATH` just do
100101
```sh
101102
export JULIA_LOAD_PATH="/foo/bar:$JULIA_LOAD_PATH"
102103
```
@@ -110,6 +111,32 @@ This behavior was chosen so that it would be possible to set an empty load path
110111
the environment variable. If you want the default load path, either unset the
111112
environment variable or if it must have a value, set it to the string `:`.
112113

114+
### `JULIA_DEPOT_PATH`
115+
116+
The `JULIA_DEPOT_PATH` environment variable is used to populate the global Julia
117+
[`DEPOT_PATH`](@ref) variable, which controls where the package manager, as well
118+
as Julia's code loading mechanisms, look for package registries, installed
119+
packages, named environments, repo clones, cached compiled package images, and
120+
configuration files.
121+
122+
Unlike the shell `PATH` variable but similar to `JULIA_LOAD_PATH`, empty entries in
123+
`JULIA_DEPOT_PATH` are expanded to the default value of `DEPOT_PATH`. This allows
124+
easy appending, prepending, etc. of the depot path value in shell scripts regardless
125+
of whether `JULIA_DEPOT_PATH` is already set or not. For example, to prepend the
126+
directory `/foo/bar` to `DEPOT_PATH` just do
127+
```sh
128+
export JULIA_DEPOT_PATH="/foo/bar:$JULIA_DEPOT_PATH"
129+
```
130+
If the `JULIA_DEPOT_PATH` environment variable is already set, its old value will be
131+
prepended with `/foo/bar`. On the other hand, if `JULIA_DEPOT_PATH` is not set, then
132+
it will be set to `/foo/bar:` which will have the effect of prepending `/foo/bar` to
133+
the default depot path. If `JULIA_DEPOT_PATH` is set to the empty string, it expands
134+
to an empty `DEPOT_PATH` array. In other words, the empty string is interpreted as a
135+
zero-element array, not a one-element array of the empty string. This behavior was
136+
chosen so that it would be possible to set an empty depot path via the environment
137+
variable. If you want the default depot path, either unset the environment variable
138+
or if it must have a value, set it to the string `:`.
139+
113140
### `JULIA_HISTORY`
114141

115142
The absolute path `REPL.find_hist_file()` of the REPL's history file. If
@@ -128,25 +155,9 @@ by default `1`, and larger values correspond to larger amounts of time.
128155

129156
Suppose the value of `$JULIA_PKGRESOLVE_ACCURACY` is `n`. Then
130157

131-
* the number of pre-decimation iterations is `20*n`,
132-
* the number of iterations between decimation steps is `10*n`, and
133-
* at decimation steps, at most one in every `20*n` packages is decimated.
134-
135-
### `JULIA_DEPOT_PATH`
136-
137-
A stack of depot locations where the package manager, as well as Julia's code loading
138-
mechanisms, look for package registries, installed packages, named environments,
139-
repo clones, cached compiled package images, and configuration files.
140-
141-
The depot path is controlled by Julia's `DEPOT_PATH` global variable which is populated at
142-
startup based on the value of the `JULIA_DEPOT_PATH` environment variable. The first entry
143-
is the “user depot” and should be writable by and owned by the current user. The user depot
144-
is where: registries are cloned, new package versions are installed, named environments are
145-
created and updated, package repos are cloned, newly compiled package image files are
146-
saved, log files are written, development packages are checked out by default, and global
147-
configuration data is saved. Later entries in the depot path are treated as read-only and
148-
are appropriate for registries, packages, etc. installed and managed by system
149-
administrators.
158+
* the number of pre-decimation iterations is `20*n`,
159+
* the number of iterations between decimation steps is `10*n`, and
160+
* at decimation steps, at most one in every `20*n` packages is decimated.
150161

151162

152163
## External applications

0 commit comments

Comments
 (0)