Julia: Document JULIA_* environment variables

Created on 12 Jan 2017  路  5Comments  路  Source: JuliaLang/julia

Julia has a few setting that can controlled through environmental variables. Most of these settings are undocumented in the manual. From a cursory scan of Julia base these seem to be the available environmental variables settings for Julia:

JULIA_HISTORY
JULIA_CPU_CORES
JULIA_LOAD_PATH
JULIA_WORKER_TIMEOUT
JULIA_EDITOR
JULIA_SHELL
JULIA_DEBUG_LOADING
JULIA_INPUT_COLOR
JULIA_ANSWER_COLOR
JULIA_ERROR_COLOR
JULIA_WARN_COLOR
JULIA_INFO_COLOR
JULIA_STACKFRAME_LINEINFO_COLOR
JULIA_STACKFRAME_FUNCTION_COLOR
doc help wanted

Most helpful comment

JULIA_NUM_THREADS

All 5 comments

JULIA_NUM_THREADS

Something like this?

Environment Variables in Julia

File locations

JULIA_HOME

The absolute path pointing to the directory containing the Julia executable.

the executable is by default one of

$JULIA_HOME/julia
$JULIA_HOME/julia-debug

The DATAROOTDIR internal variable (often ../share) determines a relative path from JULIA_HOME to the data directory associated with Julia, and the SYSCONFDIR internal variable (often ../etc) determines a relative path to the configuration file directory. Then source files are searched for in the directory

$JULIA_HOME/$DATAROOTDIR/julia/base

and by default Julia searches for a juliarc.jl file at

$JULIA_HOME/$SYSCONFDIR/julia/juliarc.jl
$JULIA_HOME/../etc/julia/juliarc.jl
  • base/initdefs.jl
  • base/client.jl
  • base/interactiveutil.jl

JULIA_LOAD_PATH

A :- (win32: ;-) separated list of absolute paths that are to be appended to the LOAD_PATH variable. The LOAD_PATH variable is where require looks for code; it defaults to the absolute paths

$JULIA_HOME/../local/share/julia/site/v0.5
$JULIA_HOME/../share/julia/site/v0.5
  • base/initdefs.jl

JULIA_PKGDIR

A path pointing to the root directory _pkgroot() for the version-specific Julia package repositories. If the path is relative, then it is taken with respect to the working directory. If JULIA_PKGIR is not specified, then _pkgroot() defaults to

$HOME/.julia

The repository naming scheme is such that the result of Pkg.dir() is, e.g.,

$JULIA_PKGDIR/v0.5

and contains packages compiled against version 0.5 of Julia.

  • base/pkg/dir.jl
  • base/pkg/pkg.jl

JULIA_HISTORY

The absolute path Base.find_hist_file() pointing to the file containing the history of the REPL. If JULIA_HISTORY is not specified, then Base.find_hist_file() defaults to

$HOME/.julia_history
  • base/REPL.jl

JULIA_PKGRESOLVE_ACCURACY

An environmental variable that determines how much time Julia will devote to attempting to satisfy package dependency constraints before giving up: this value is by default 1, and larger values correspond to larger amounts of time.

  • base/pkg/resolve.jl
  • base/pkg/resolve/maxsum.jl

External applications

JULIA_SHELL

The shell with respect to which which Julia should execute external commands (via Base.repl_cmd). Defaults to the environment variable $SHELL, and falls back to /bin/sh if $SHELL is unset.

  • base/client.jl

JULIA_EDITOR, VISUAL, EDITOR

The editor returned by Base.editor() and used in, e.g., Base.edit(). JULIA_EDITOR takes precedence over VISUAL, which in turn takes precedence over EDITOR. If none of these environment variables is set, then the editor is taken to be open on Windows and OS X, or /etc/alternatives/editor if it exists, or emacs otherwise.

Warning: JULIA_EDITOR is not used in the determination of the editor for Pkg.edit(): this function checks VISUAL and EDITOR alone.

  • base/pkg/entry.jl
  • base/interactiveutil.jl

Parallelization

JULIA_CPU_CORES

The user-set value for the internal variable Sys.CPU_CORES, the number of logical CPU cores available.

  • base/sysinfo.jl
  • base/interactiveutil.jl

JULIA_WORKER_TIMEOUT

A Float64 giving the number of seconds Base.worker_timeout() that a spawned worker process should wait for a master process to establish a connection before dying. If this quantity is not given, then Base.worker_timeout() defaults to 60.0.

  • base/managers.jl
  • base/multi.jl

REPL Colors

JULIA_ERROR_COLOR

The color Base.error_color() (default: :light_red) that errors should be at the REPL.

  • base/client.jl

JULIA_WARN_COLOR

The color Base.warn_color() (default: :yellow) that warnings should be at the REPL.

  • base/client.jl

JULIA_INFO_COLOR

The color Base.info_color() (default: :cyan) that info should be at the REPL.

  • base/client.jl

JULIA_INPUT_COLOR

The color Base.input_color() (default: :normal) that input should be at the REPL. Note that input is hardcoded to be :bold.

  • base/client.jl

JULIA_ANSWER_COLOR

The color Base.answer_color() (default: :normal) that output should be at the REPL. Note that output is hardcoded to be :bold.

  • base/client.jl

JULIA_STACKFRAME_LINEINFO_COLOR

The color Base.stackframe_lineinfo_color() (default: :bold) that line info should be given in during a stack trace at the REPL.

  • base/client.jl
  • base/stacktraces.jl

JULIA_STACKFRAME_FUNCTION_COLOR

The color Base.stackframe_function_color() (default: bold) that function calls should be given in during a stack trace at the REPL.

  • base/client.jl
  • base/stacktraces.jl

Debugging

JULIA_DEBUG_LOADING

If set, prints detailed information about the cache while loading.

  • base/loading.jl

@kbdave314 looks reasonable. Could you make a PR? It'll be easier to make suggestions.

Kinda a duplicate of #5432 (so that issue can be closed with this one).

See my edit on the top post of #20162, that should close both issues when the PR is merged.

Was this page helpful?
0 / 5 - 0 ratings