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
There are two different concepts in how to handle virtual environments:
61
-
*Having global virtual environments, Python-style. We have a working prototype at [`kubouch/nuun`] using overlays.
61
+
There are two different concepts how to handle virtual environments:
62
+
*Global virtual environments, Python-style. We have a working prototype at [`kubouch/nuun`] using overlays.
62
63
* Installing a package will install it to the environment
63
64
* Possible to switch between them, they are completely isolated from each other
64
65
* Per-project virtual environment, `cargo`-style
@@ -70,20 +71,20 @@ The overlays could be used to achieve all three goals at the same time. When ins
70
71
*`nupm` adds entry to a **lock file** (this should be the only file you need to 100% replicate the environment)
71
72
* A .nu file (module) is auto-generated from the lock file and contains export statements like `export module NUPM_HOME/cache/packages/spam-v16.4.0-124ptnpbf/spam`. Calling `overlay use` on the file will activate your virtual environment, now you have a per-project environment
72
73
* This file can be installed into a global location that's in your `NU_LIB_DIRS` (e.g., `NUPM_HOME/overlays`) -- now you have a global Python-like virtual environment
74
+
* Each overlay under `NUPM_HOME/overlays` will mimic the main NUPM_HOME structure, e.g., for an overlay `spam` there will be `NUPM_HOME/overlays/spam/bin`, `NUPM_HOME/overlays/spam/modules` (`NUPM_HOME/overlays/spam/overlays`? It might not be the best idea to have it recursive)
73
75
74
76
Each package would basically have its own overlay. This overlay file (it's just a module) could be used to also handle dependencies. If your project depends on `foo` and `bar` which both depend on `spam` but different versions, they could both import the different verions privately in their own overlay files and in your project's overlay file would be just `export use path/to/foo` and `export use path/to/bar`. This should prevent name clashing of `spam`. The only problem that needs to be figured out is how to tell `foo` to be aware of its overlay.
Requires these actions from the user (this should be kept as minimal as possible):
79
81
* Add `NUPM_HOME/bin` to PATH (install location for binary projects)
80
-
* Add `NUPM_HOME/lib` to NU_LIB_DIRS
82
+
* Add `NUPM_HOME/modules` to NU_LIB_DIRS
81
83
* Add `NUPM_HOME/overlays` to NU_LIB_DIRS
82
84
* Make the `nupm` command available somehow (e.g., `use` inside `config.nu`)
83
85
84
86
> :warning:**WIP**
85
-
> I have another idea in mind, need to think about it. The disadvantage of this is that the default install location is not an overlay.
86
-
> We could make `nupm` itself an overlay that adds itself as a command.
87
+
> The disadvantage of this is that the default install location is not an overlay. We could make `nupm` itself an overlay that adds itself as a command, so that you can activate/deactivate it. We might need a few attempts to get to the right solution.
87
88
88
89
There are several approaches:
89
90
* bootstrap using shell script sourced from web (like `rustup`)
@@ -101,19 +102,16 @@ dynamic are pre-compiled libraries linked to the project.
101
102
> Nushell is [similar to compiled languages][Nushell compiled] rather than typical dynamic languages like Python, so these concepts are relevant for Nushell.
102
103
103
104
Static dependencies:
104
-
*:thumbsup:: reproducible, does not rely on system files (no more missing `random.so.2`), higher performance (allows joint optimization of dependencies and project itself)
105
+
*:thumbsup:: reproducible, does not rely on system files at runtime (no more missing `random.so.2`), higher performance (allows joint optimization of dependencies and project itself)
105
106
*:thumbsdown:: increased compile time, binary size, can easily end up with multiple versions of the same library (hello Nushell dependencies)
106
107
107
108
Dynamic dependencies are the opposite basically.
108
109
109
-
> **Note**
110
-
> Nushell currently supports only static dependencies, but we might be able to add the "linking" feature at some point.
111
-
112
-
We might want `nupm` support both types of dependencies.
110
+
Nushell currently supports only static dependencies, but we might be able to add the "linking" feature at some point which could unlock new interesting patterns regarding package management, like testing.
113
111
114
112
## Package repository [[toc](#table-of-content)]
115
113
116
-
Packages need to be stored somewhere. There should be one central "official" location (see https://github.com/NixOS/nixpkgs for inspiration).
114
+
Packages need to be stored somewhere. There should be one central "official" location (see https://github.com/NixOS/nixpkgs for inspiration). GitHub repository seems like a good starting point.
117
115
118
116
Additionally, user should be able to add 3rd party repositories as well as install local and other packages (e.g., from the web, just pointing at URL),
119
117
as long as it has `METADATA_FILE` telling `nupm` what to do.
@@ -163,6 +161,7 @@ Nushell's module design conflates CLI interface with API -- they are the same. N
163
161
- publish package to a repository
164
162
-**NOT SUPPORTED FOR NOW**: the repository will be a *GitHub* repo with packages submitted by PRs to start with
165
163
164
+
The following are for Python-style global overlays, we might need to re-think this for local package overlays:
166
165
-`nupm overlay new`
167
166
- create a new global overlay (Python's virtual environment style)
168
167
-`--local` flag could generate an overlay locally from the currently opened project
@@ -176,7 +175,7 @@ Nushell's module design conflates CLI interface with API -- they are the same. N
176
175
-`nupm overlay import`
177
176
- create overlay from exported file
178
177
179
-
### Other CLI-related points[[toc](#table-of-content)]
178
+
### Other CLI-related notes[[toc](#table-of-content)]
180
179
181
180
* We could later think about being able to extend `nupm`, like `cargo` has plugins.
182
181
* Mutable actions (like install) have by default Y/n prompt, but can be overriden with `--yes`
@@ -188,7 +187,7 @@ Nushell's module design conflates CLI interface with API -- they are the same. N
188
187
189
188
## Other [[toc](#table-of-content)]
190
189
191
-
* activations
190
+
* activations (not bringing all package's content but only parts of it)
0 commit comments