Skip to content

Conversation

@kbdave314
Copy link
Contributor

@kbdave314 kbdave314 commented Jan 20, 2017

Adds a documentation section for environment variables and their defaults.

Fix #5432
Fix #19988

@ararslan ararslan added the docs This change adds or pertains to documentation label Jan 20, 2017
@ararslan
Copy link
Member

Hey @kbdave314, great first Julia PR! This is very comprehensive and well thought out. I have just a few minor stylistic comments to ensure consistency with the other markdown files in the manual. Overall nice work here!

@@ -0,0 +1,138 @@
# Environment Variables in Julia

The environment variables that Julia uses generally start with `JULIA`. If [`Base.versioninfo()`](https://github.com/JuliaLang/julia/blob/master/base/interactiveutil.jl#L247) is called with `verbose` equal to `true`, then the output will list all environment variables for which `JULIA` appears in the name.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically we put line breaks to keep the line length down. Markdown renders a single newline as a space, so it works out just fine.

## File locations

### `JULIA_HOME`
The absolute path of the directory containing the Julia executable, which sets the global variable [`Base.JULIA_HOME`](https://github.com/JuliaLang/julia/blob/master/base/initdefs.jl#L90). If `$JULIA_HOME` is not set, then `Base.JULIA_HOME` defaults to its compile-time value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little mixed in the existing markdown files, but I think in general we should be using a single space after periods (or a line break—that also works) rather than two spaces.


## File locations

### `JULIA_HOME`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the other files it would be good to add a line break after the headings. It should render the same, it's just a consistency thing.

$JULIA_HOME/$SYSCONFDIR/julia/juliarc.jl
$JULIA_HOME/../etc/julia/juliarc.jl
```
by default (via [`Base.load_juliarc()`](https://github.com/JuliaLang/julia/blob/master/base/client.jl#L316) ).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra space here after the URL and before the outer closing parenthesis.

## REPL formatting
Environment variables that determine how REPL output should be formatted at the terminal. Generally, these variables should be set to [ANSI terminal escape sequences](http://ascii-table.com/ansi-escape-sequences.php).

### `JULIA_ERROR_COLOR`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have 3 spaces after the hashes. Was that intentional? For consistency it would be better to use a single space.

```
by default.

The global variable [`Base.DATAROOTDIR`](https://github.com/JuliaLang/julia/blob/master/base/Makefile#L62) determines a relative path from `Base.JULIA_HOME` to the data directory associated with Julia; then the directory. Then the path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind linking the function and variable names to locations in the source code is a good one, but the problem is that any edits to those files will change what's at the given line. It would get kind of messy for every PR to track the line numbers and update this file accordingly. So perhaps it would be better to link to documentation for the functions and/or variables if they're available, otherwise don't provide a link.

# Environment Variables in Julia

The environment variables that Julia uses generally start with `JULIA`. If
`Base.versioninfo()` is called with `verbose` equal to `true`, then the output
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a link here?

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be !!! warning?

@kshyatt
Copy link
Member

kshyatt commented Jan 21, 2017

This is a really great first PR. Welcome to Julia!

Copy link
Member

@MichaelHatherly MichaelHatherly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: line wrapping, the manual is generally wrapped at about 92 chars rather than 80. That's just a general guideline though, so don't worry about changing that now unless it makes the paragraphs "flow" better.

Some other minor style comments in line.

[`Base.versioninfo()`](@ref) is called with `verbose` equal to `true`, then the
output will list all environment variables for which `JULIA` appears in the name.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double blank line can be reduced to a single one for consistency with the rest of the docs.

A separated list of absolute paths that are to be appended
to the variable [`Base.LOAD_PATH`](@ref). (In Unix-like systems, the path
separator is `:`; in Windows systems, the path separator is `;`.) The
`Base.LOAD_PATH` variable is where [`Base.require()`](@ref Base.require) and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(@ref Base.require) should be able to be changed to just (@ref). The trailing () in Base.require() can be removed I think, since there is no zero-arg require method.

(Same applies to the other "named" @refs further down as well.)

is taken to be `open` on Windows and OS X, or `/etc/alternatives/editor` if it
exists, or `emacs` otherwise.

*Note:* `$JULIA_EDITOR` is *not* used in the determination of the editor for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could perhaps use an admonition here for the note, i.e. !!! note syntax (see docs for details). Same applies to some of the other notes further down.

@@ -0,0 +1,295 @@
# Environment Variables in Julia
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this title should change to # Environment Variables or the @refs that are meant to link here should be changed to [Environment Variables in Julia](@ref) otherwise the docs build will probably fail.

`$JULIA_HOME` is not set, then `Base.JULIA_HOME` defaults to its compile-time
value.

The executable itself is one of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the docs leave a single blank line before and after triple backtick blocks. Makes it a bit easier to see where code blocks start and end if they don't specify a language.

commands (via `Base.repl_cmd()`). Defaults to the environment variable
`$SHELL`, and falls back to `/bin/sh` if `$SHELL` is unset.

!!! note the `fish` shell is unsupported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to #19984


!!! note the `fish` shell is unsupported.

### `JULIA_EDITOR`, `VISUAL`, `EDITOR`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would take VISUAL and EDITOR out of the heading as they aren't Julia specific ENV variables.

is taken to be `open` on Windows and OS X, or `/etc/alternatives/editor` if it
exists, or `emacs` otherwise.

!!! note `$JULIA_EDITOR` is *not* used in the determination of the editor for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syntax here should be

!!! note

    `$JULIA_EDITOR` is *not* used in the determination of the editor for
    [`Base.Pkg.edit`](@ref): this function checks `$VISUAL` and `$EDITOR`
    alone.

so the admonition body text needs to be written on a newline rather than running on from !!! note.

Same for the other admonitions in the file.

Copy link
Member

@KristofferC KristofferC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work. Only a few comments from me.


!!! note

the `fish` shell is unsupported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for fish shell was just merged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though not well tested

$JULIA_HOME/../share/julia/site/v$(Base.VERSION.major).$(Base.VERSION.minor)
```

so that, e. g., version 0.5 of Julia on a Linux system with a Julia executable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. perhaps (no space)


!!! note

input is hardcoded to be bold (`"\033[1m"`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not anymore.


!!! note

output is hardcoded to be bold (`"\033[1m"`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not anymore.

@StefanKarpinski
Copy link
Member

@KristofferC has requested a few small changes. I believe @MichaelHatherly's requested changes have been addressed? This seems very close to being ready to merge...

@tkelman
Copy link
Contributor

tkelman commented Jan 27, 2017

There are a few places that say "64 bit integer" that may not be accurate on 32 bit Julia, those should be verified.


The absolute path of the directory containing the Julia executable, which sets
the global variable [`Base.JULIA_HOME`](@ref). If `$JULIA_HOME` is not set,
then `Base.JULIA_HOME` defaults to its compile-time value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't quite right, you can move around the compiled executable and Base.JULIA_HOME will reflect the location it gets run from

### `JULIA_SHELL`

The absolute path of the shell with which Julia should execute external
commands (via `Base.repl_cmd()`). Defaults to the environment variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only on unix - on windows, commands don't go through a shell

### `JULIA_WORKER_TIMEOUT`

A `Float64` that sets the value of `Base.worker_timeout()` (default: `60.0`).
This function gives the number of a seconds a worker process will wait for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number of seconds

Environment variables that determine how REPL output should be formatted at the
terminal. Generally, these variables should be set to [ANSI terminal escape
sequences](http://ascii-table.com/ansi-escape-sequences.php). The Julia base
package provides a high-level interface with much of the same functionality:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"base package" isn't a term we use much, I guess you just mean functions that are under Base?

then garbage collection is forced.
* If it's the `n`th time that `jl_gc_collect()` has been called, and `n`
belongs to the arithmetic sequence represented by `$JULIA_GC_ALLOC_PRINT`,
then counts for for the number of calls to `jl_gc_pool_alloc()` and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

counts for the

then counts for for the number of calls to `jl_gc_pool_alloc()` and
`maybe_collect()` are printed.

If the character `'r'` appears as above, then the interval between garbage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is "as above" referring to?

!!! note

this environment variable has an effect only if Julia was compiled with
`JL_DEBUG_BUILD` set.
Copy link
Contributor

@tkelman tkelman Jan 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which is enabled when building the julia-debug executable, so julia-debug always has this on

@MichaelHatherly MichaelHatherly dismissed their stale review January 29, 2017 09:12

Changes addressed.

@kbdave314
Copy link
Contributor Author

Still need to fix JULIA_HOME section.


If set to anything besides `0`, then the Julia garbage collector will wait for
the debugger to attach instead of aborting whenever there's a critical error.
If set to anything besides `0`, then the Julia garbage collector will wait for the debugger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the debugger" sounds a little funny, doesn't it wait for any debugger?

this environment variable has an effect only if Julia was compiled with
`JL_DEBUG_BUILD` set.
This environment variable has an effect only if Julia was compiled with `JL_DEBUG_BUILD`
set—in particular, the `julia-debug` executable is always compiled with this build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put spaces around the dash, otherwise it looks like "set-in" is being used as a single hyphenated word


### `JULIA_EDITOR`

The editor returned by `Base.editor()` and used in, e.g., [`Base.edit`](@ref).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mention that this is a command and not a path.


The absolute path `Base.find_hist_file()` of the REPL's history file. If `$JULIA_HISTORY` is
not set, then `Base.find_hist_file()` defaults to

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Base.REPL.find_hist_file() ?

@@ -0,0 +1,313 @@
# Environment Variables

The environment variables that Julia uses generally start with `JULIA`. If
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add here in the beginning how to actually set/modify the variables? And perhaps mention that it could be done conveniently in the .juliarc.jl file?

@mortenpi
Copy link
Contributor

Could we by any chance have a list of all the variables in the julia --help message as well? That would be convenient for quickly looking up the exact spelling without having to resort to the manual.

@m-j-w
Copy link
Contributor

m-j-w commented Apr 21, 2017

Is there a chance for this to go soon into master? I would find such an overview to really improve the documentation.
@kbdave314 If you don't find the time to address the remaining reviewer comments, I'd be happy to offer my assistance.

@tkelman
Copy link
Contributor

tkelman commented Apr 21, 2017

@m-j-w I don't think anyone would be offended if you wanted to copy the branch to your fork, address the last few review comments and remaining todo's, and open a new PR. We can keep the attribution and existing commits to recognize the good work that @kbdave314 did to flesh this out.

@kbdave314 kbdave314 closed this Apr 21, 2017
tkelman added a commit that referenced this pull request Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.