Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify how new environments are activated #1329

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jkrumbiegel
Copy link

I had to find out by trial and error that a new environment is created if I try to activate an existing environment from a different working directory. This wasn't clear to me after reading the docs, so this PR is meant to clarify the process.

docs/src/getting-started.md Outdated Show resolved Hide resolved
@@ -81,7 +81,12 @@ This lets us know `v1.1` is the **active environment**.
The active environment is the environment that will be modified by Pkg commands such as `add`, `rm` and `update`.

Let's set up a new environment so we may experiment.
To set the active environment, use `activate`:
To set the active environment, use `activate` and then the name of the environment, or the path to it
if it's not in your current working directory.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if it's not in your current working directory.
if it's not in your current working directory. (For reference, `activate someenv` will expand to `activate ./someenv`).

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed

Copy link
Member

@IanButterworth IanButterworth left a comment

Choose a reason for hiding this comment

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

I think the working directory in the example changed since this was opened

If the environment you want to activate doesn't exist yet, it will be created in your current working directory.
If you want to change the working directory first, you can `cd` there after pressing `;` to get into shell mode.
If you're not sure what the current working directory is you can run `pwd()` in the REPL.
In our case, we are currently in the directory `/tmp/`, so the environment will be created there.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In our case, we are currently in the directory `/tmp/`, so the environment will be created there.
In our case, we are currently in the home directory, so the environment will be created there.

One thing to keep in mind is that the name `tutorial` is not exclusive to our environment.
If we cd to a different folder like `/different/` and run `activate tutorial`, we might expect our old environment
to be activated, but instead a new environment named tutorial will be created in `/different/`.
To activate our original environment from anywhere, we can always run `activate /tmp/tutorial`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To activate our original environment from anywhere, we can always run `activate /tmp/tutorial`.
To activate our original environment from anywhere, we can always run `activate ~/tutorial`.

@IanButterworth IanButterworth added the forget me not Good PRs that are lingering but close to mergeable label Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation forget me not Good PRs that are lingering but close to mergeable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants