1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 15:17:47 +00:00

auto-venv for python: update to be compatible with nu 0.80 (#513)

* auto-venv python passes syntax checks

* update readme.md

* everything works!
This commit is contained in:
Hörmet Yiltiz 2023-05-26 13:31:10 -05:00 committed by GitHub
parent 4b82839c90
commit 272b7e2b93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 26 deletions

View file

@ -4,21 +4,22 @@ The scripts in this directory activate virtual environments whenever you cd into
## Usage
1. set `$env.AUTO_VENV_TRIGGER` to the name of a script file
1. set `$env.AUTO_VENV_TRIGGER` as the preferred name of a trigger file
1. import `auto-venv` into your environment
1. cd into a folder that contains your trigger file
1. Create a symlink via `ln -s` of the script file `./auto-venv/venvs/python-venv.nu` to a trigger file in project at `/path/to/project/$AUTO_VENV_TRIGGER`
1. `cd` into `/path/to/project/`
ex.
For example:
```nu
# config.nu
export-env {
let-env AUTO_VENV_TRIGGER = '__auto-venv.nu'
source-env ~/path/to/nu_scripts/virtual_environments/auto-venv/auto-venv.nu
source-env ~/path/to/nu_scripts/modules/virtual_environments/auto-venv/auto-venv.nu
}
use ~/path/to/nu_scripts/virtual_environments/auto-venv/auto-venv.nu *
use ~/path/to/nu_scripts/modules/virtual_environments/auto-venv/auto-venv.nu *
```
When `auto-venv` detects that a file of that name exists in the folder you cd'ed into (or one of it's parents), it will automatically enable an overlay (as defined by the trigger file).
@ -30,4 +31,4 @@ NOTE: the trigger file *must* export a custom command called `auto-venv-on-enter
## Limitations
- Due to limitations with overlay naming, you cannot nest auto-venv triggers, even for separate languages / toolchains
- Due to limitations with overlay naming, you cannot nest auto-venv triggers, even for separate languages / toolchains