Skip to content

Commit cd56e94

Browse files
delegate Python deps management to Python deps manager (#127)
This should make it easier to add/play with Sphinx extensions moving forward. This still uses direnv to: - Load the Nix environment. - Load the Python virtualenv environment. - Ensure that any change to `requirements.txt` is immediately reflected (on next CLI prompt). This still uses Nix to: - Install appropriate versions of curl, AWS CLI, git, jq, imagemagick, and TeX (along with all of the required TeX packages). - Install Python itself, so we know we're all using the same one.
1 parent 8aab341 commit cd56e94

File tree

7 files changed

+44
-416
lines changed

7 files changed

+44
-416
lines changed

.circleci/config.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ commands:
5050
- /home/circleci/.nix-channels
5151
- /home/circleci/.nix-defexpr
5252
- /home/circleci/.config/nix
53+
setup_python:
54+
description: Set up Python
55+
steps:
56+
- run:
57+
name: setup_python
58+
command: |
59+
set -euo pipefail
60+
. /home/circleci/.nix-profile/etc/profile.d/nix.sh
61+
nix-shell shell.nix \
62+
--pure \
63+
--run bash \<<'EOF'
64+
set -euo pipefail
65+
66+
python3 -m venv .python-env
67+
source .python-env/bin/activate
68+
python -m pip install -r requirements.txt
69+
EOF
5370
5471
jobs:
5572
build_docs:
@@ -60,11 +77,11 @@ jobs:
6077
steps:
6178
- checkout
6279
- setup_nix
80+
- setup_python
6381
- run:
6482
name: build
6583
command: |
6684
set -euo pipefail
67-
6885
. /home/circleci/.nix-profile/etc/profile.d/nix.sh
6986
7087
mkdir -p /tmp/workspace
@@ -75,6 +92,8 @@ jobs:
7592
--keep ARTIFACTORY_PASSWORD \
7693
--run bash \<<'EOF'
7794
set -euo pipefail
95+
source .python-env/bin/activate
96+
PATH="$(pwd)/.python-env/bin:$PATH"
7897
prefix=$(jq -r '.prefix' versions.json)
7998
if [[ ${#prefix} -lt 5 ]]; then
8099
echo "Pushhing to $prefix is not currently supported."
@@ -135,6 +154,7 @@ jobs:
135154
steps:
136155
- checkout
137156
- setup_nix
157+
- setup_python
138158
- run:
139159
name: push
140160
command: |
@@ -150,6 +170,8 @@ jobs:
150170
--keep AWS_SECRET_ACCESS_KEY \
151171
--run bash \<<'EOF'
152172
set -euo pipefail
173+
source .python-env/bin/activate
174+
PATH="$(pwd)/.python-env/bin:$PATH"
153175
154176
snapshots=$(curl -sf https://docs.daml.com/snapshots.json \
155177
| jq -r '

.envrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,17 @@ use nix
22

33
PATH_add bin
44

5+
pyenv=.python-env
6+
7+
if ! [ -d $pyenv ]; then
8+
python3 -m venv $pyenv
9+
fi
10+
11+
source $pyenv/bin/activate
12+
PATH_add $pyenv/bin
13+
14+
python -m pip install -r requirements.txt
15+
516
[[ -f .envrc.private ]] && source_env .envrc.private
17+
18+
watch_file requirements.txt

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.envrc.private
22
.DS_Store
33

4+
.python-env
5+
46
workdir/

Pipfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)