You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/environments.md
+25-30Lines changed: 25 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,15 @@ If you have many projects, you might notice that older projects require specific
11
11
`Bonsai` addresses these problems by supporting the creation of reproducible package environments. An environment is a self-contained, portable, installation of `Bonsai` that records a *snapshot* of all the packages required to run the workflows in your project. This makes it much easier to share a project with other people, or keep track of multiple separate projects in your local machine, and be assured you always have everything you need in the right place.
12
12
13
13
## Environment Basics
14
+
14
15
The key to creating and updating environments is the `Bonsai.config` file, which keeps a record of all currently installed dependencies for a specific Bonsai setup. You can find this file in the same location of the Bonsai executable (`Bonsai.exe`). Anytime you install or update a package, Bonsai will automatically modify the config file.
15
16
16
17
The contents of the `Bonsai.config` file are compared with the current state of the `Packages` folder when Bonsai starts. If there are any missing packages the Bonsai bootstrapper will download them automatically to recover the expected state of the installation folder.
17
18
18
19
There is a second configuration file located next to the `Bonsai.config` file called `NuGet.config`. This file stores a list of all the remote, and local, NuGet package sources where the [`Package Manager`](xref:packages) should look for new packages. While this file needs to be included in the environment, most users do not need to modify it.
19
20
20
21
## Portable Method
22
+
21
23
> [!TIP]
22
24
> We recommend this approach for the casual user.
23
25
@@ -26,50 +28,47 @@ The easiest way to create a self-contained Bonsai environment is to download the
26
28
1. Start by downloading the [latest Bonsai portable release](https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip).
27
29
2. After extracting all the files from the `Bonsai.zip` file, your folder will look like this:
3. Run `Bonsai.exe`. During this first run, Bonsai will bootstrap the core dependencies and create an initial `Bonsai.config` file.
32
34
4. Install the **Bonsai - Vision** package using the [`Package Manager`](xref:packages). The `Bonsai.config` file will be modified to specify this package as a new dependency. Any additional dependencies which might be needed for the package to run will also be added.
33
35
5. Close Bonsai.
34
36
35
37
You now have a local Bonsai environment folder that you can keep separate for experiments or share with anyone else who needs it. Alternatively, once you have a modified `Bonsai.config` file, you can also simply copy the `Bonsai.config` file into a new portable installation, and the Bonsai bootstrapper will download and resolve the missing or inconsistent packages.
36
38
37
-
## Template Method
39
+
## Command-Line Method
40
+
38
41
> [!TIP]
39
42
> We recommend this approach for users who need to deploy and maintain multiple environments. This approach assumes familiarity with the command-line.
40
43
41
-
We have also provided a command-line tool for "one-click" deployment which installs packages automatically and streamlines the process for creating new environments.
44
+
> [!NOTE]
45
+
> This method supersedes the older template method as its functionality is now integrated into the Bonsai bootstrapper.
2. Install `Bonsai.Templates` with the following command.
45
-
```cmd
46
-
dotnet new install Bonsai.Templates
47
-
```
48
-
3. Navigate to the folder where you want to create a new Bonsai environment and run this command.
49
-
```cmd
50
-
dotnet new bonsaienv
51
-
```
52
-
This creates by default a `.bonsai` folder with a minimal bonsai environment in your current directory. It will also prompt to run a powershell script to install any packages based on `Bonsai.config`. Before running the powershell script, you can replace the `Bonsai.config` file with a modified version or run the powershell script after by navigating to the `.bonsai` folder and running:
47
+
We have also provided a command-line tool for "one-click" deployment which installs packages automatically and streamlines the process for creating and restoring environments.
48
+
49
+
1. Download the [Bonsai installer](https://bonsai-rx.org/docs/articles/installation.html).
50
+
2. When running the installer, ensure that **Add to PATH (requires shell restart)** is selected within **Options**.
51
+
3. Navigate to the folder where you want to create a new Bonsai environment and run this command.
53
52
54
53
```cmd
55
-
./Setup.cmd
56
-
```
57
-
4. You can supply additional options to change the default settings. The following command for instance will create a new folder `project1` containing a bonsai environment folder named `env`.
58
-
```cmd
59
-
dotnet new bonsaienv -o project1 -n .env
54
+
bonsai --init
60
55
```
61
-
To install new packages in this environment, simply open the local `Bonsai.exe` and install the packages you need.
62
56
63
-
To share this environment with others, all you need are these 4 files.
57
+
This command creates a `.bonsai` local environment folder in your current directory and will also install any core dependencies. To install new packages in this environment, open the `Bonsai.exe` located in this folder and install the packages you need.
58
+
59
+
To share this environment with others, all you need are these two files.
64
60
65
-
-`Setup.ps1`
66
-
-`Setup.cmd`.
67
61
-`NuGet.config`
68
62
-`Bonsai.config`
69
63
70
-
Other users will be able to easily install your current Bonsai dependencies by running the `Setup.cmd` file.
64
+
To restore the environment, navigate to the folder containing these files and run this command.
65
+
66
+
```cmd
67
+
bonsai --no-editor
68
+
```
71
69
72
70
## Adding Local Dependencies
71
+
73
72
> [!TIP]
74
73
> For [new package](xref:create-package) developers, you may need to install local NuGet packages as dependencies during testing.
75
74
@@ -81,9 +80,6 @@ For example, to add a new package source named `LocalPackages` pointing to the D
0 commit comments