-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.envrc
24 lines (21 loc) · 1.11 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Environment variables go here, and can be read in by Python using `os.getenv`:
#
# --------------------------------------------------------
# import os
#
# # Example variable
# EXAMPLE_VARIABLE = os.getenv("EXAMPLE_VARIABLE")
# --------------------------------------------------------
#
# To ensure the `sed` command below works correctly, make sure all file paths in environment variables are absolute,
# are relative but do not reference any other variables except `$(pwd)`.
#
# DO NOT STORE SECRETS HERE - this file is version-controlled! You should store secrets in a `.secrets` file, which is
# not version-controlled - this can then be sourced here, using `source_env ".secrets"`.
# Extract the variables to `.env` if required. Note `.env` is NOT version-controlled, so `.secrets` will not be
# committed
sed -n 's/^export \(.*\)$/\1/p' .envrc .secrets | sed -e 's?$(pwd)?'"$(pwd)"'?g' > .env
# Add the working directory to `PYTHONPATH`; allows Jupyter notebooks in the `notebooks` folder to import `src`
export PYTHONPATH="$PYTHONPATH:$(pwd)"
# Import secrets from an untracked file `.secrets`
source_env ".secrets"