Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 8c9a299

Browse files
authored
refactor: use pipenv to manage dependencies (#150)
1 parent 318f881 commit 8c9a299

File tree

5 files changed

+549
-43
lines changed

5 files changed

+549
-43
lines changed

.github/workflows/pulumi-aws-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: syphar/restore-virtualenv@v1
1414
id: pulumi-aws-tests-cache-virtualenv
1515
with:
16-
requirement_files: pulumi/python/requirements.txt
16+
requirement_files: pulumi/python/Pipfile.lock
1717

1818
- uses: syphar/restore-pip-download-cache@v1
1919
if: steps.pulumi-aws-tests-cache-virtualenv.outputs.cache-hit != 'true'
@@ -33,7 +33,7 @@ jobs:
3333
- uses: syphar/restore-virtualenv@v1
3434
id: pulumi-aws-tests-cache-virtualenv
3535
with:
36-
requirement_files: pulumi/python/requirements.txt
36+
requirement_files: pulumi/python/Pipfile.lock
3737

3838
- uses: syphar/restore-pip-download-cache@v1
3939
if: steps.pulumi-aws-tests-cache-virtualenv.outputs.cache-hit != 'true'

bin/setup_venv.sh

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,14 @@ source "${VIRTUAL_ENV}/bin/activate"
176176

177177
set -o nounset # abort on unbound variable
178178

179-
# Use the latest version of pip
179+
# Use the latest version of pip and pipenv
180180
pip3 install --upgrade pip
181+
pip3 install pipenv
181182

182-
# Installs wheel package management, so that pulumi requirements install quickly
183-
pip3 install wheel
184-
185-
# Get nodeenv version so that node can be installed before we install Python
186-
# dependencies because pulumi_eks depends on the presence of node.
187-
pip3 install "$(grep nodeenv "${script_dir}/../pulumi/python/requirements.txt")"
183+
# Install certain utility packages like `nodeenv` and `wheel` that aid
184+
# in the installation of other build tools and dependencies
185+
# required by the other python packages.
186+
PIPENV_VERBOSITY=-1 PIPENV_PIPFILE="${script_dir}/../pulumi/python/Pipfile" pipenv install --dev
188187

189188
# Install node.js into virtual environment so that it can be used by Python
190189
# modules that make call outs to it.
@@ -195,12 +194,15 @@ else
195194
fi
196195

197196
# Install general package requirements
198-
pip3 install --requirement "${script_dir}/../pulumi/python/requirements.txt"
197+
PIPENV_VERBOSITY=-1 PIPENV_PIPFILE="${script_dir}/../pulumi/python/Pipfile" pipenv install
198+
199199
# Install local common utilities module
200-
pip3 install "${script_dir}/../pulumi/python/utility/kic-pulumi-utils" &&
201-
rm -rf "${script_dir}/../pulumi/python/utility/kic-pulumi-utils/.eggs" \
202-
"${script_dir}/../pulumi/python/utility/kic-pulumi-utils/build" \
203-
"${script_dir}/../pulumi/python/utility/kic-pulumi-utils/kic_pulumi_utils.egg-info"
200+
pip3 install "${script_dir}/../pulumi/python/utility/kic-pulumi-utils"
201+
202+
rm -rf "${script_dir}/../pulumi/python/utility/kic-pulumi-utils/.eggs" \
203+
"${script_dir}/../pulumi/python/utility/kic-pulumi-utils/build" \
204+
"${script_dir}/../pulumi/python/utility/kic-pulumi-utils/kic_pulumi_utils.egg-info"
205+
204206

205207
ARCH=""
206208
case $(uname -m) in
@@ -265,20 +267,15 @@ else
265267
chmod +x "${VIRTUAL_ENV}/bin/kubectl"
266268
fi
267269

268-
#
269270
# Download Pulumi CLI tooling
270-
#
271-
# Added some error checking to handle a failure here since it can be a bit confusing to the user (or at least to me)
272-
# when this bombs out and you can't figure out why. Note that the logic is specifically looking for "~=" in the
273-
# requirements file. Other comparisons that are legal in terms of the requirements file WILL fail with this logic.
274-
#
271+
# Regular expression and sed command from https://superuser.com/a/363878
275272
echo "Downloading Pulumi CLI into virtual environment"
276-
PULUMI_VERSION="$(grep '^pulumi~=.*$' "${script_dir}/../pulumi/python/requirements.txt" | cut -d '=' -f2 || true)"
273+
PULUMI_VERSION="$(pip3 list | grep 'pulumi ' | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')"
277274
if [ -z $PULUMI_VERSION ] ; then
278275
echo "Failed to find Pulumi version - EXITING"
279276
exit 5
280277
else
281-
echo "Pulumi version found"
278+
echo "Pulumi version found: $PULUMI_VERSION"
282279
fi
283280

284281
if [[ -x "${VIRTUAL_ENV}/bin/pulumi" ]] && [[ "$(PULUMI_SKIP_UPDATE_CHECK=true "${VIRTUAL_ENV}/bin/pulumi" version)" == "v${PULUMI_VERSION}" ]]; then

pulumi/python/Pipfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
awscli = "~=1.22.101"
8+
grpcio = "==1.43.0"
9+
fart = "~=0.1.5"
10+
lolcat = "~=1.4"
11+
passlib = "~=1.7.4"
12+
pulumi-aws = ">=4.37.5"
13+
pulumi-docker = "==3.1.0"
14+
pulumi-eks = "==0.39.0"
15+
pulumi-kubernetes = "==3.19.1"
16+
pycryptodome = "~=3.14.0"
17+
requests = "~=2.27.1"
18+
setuptools-git-versioning = "==1.9.2"
19+
yamlreader = "==3.0.4"
20+
pulumi-digitalocean = "==4.12.0"
21+
pulumi-linode = "==3.7.1"
22+
linode-cli = "~=5.17.2"
23+
pulumi = "~=3.32.0"
24+
PyYAML = "~=5.4.1"
25+
26+
[dev-packages]
27+
wheel = "~=0.37.1"
28+
nodeenv = "~=1.6.0"
29+
30+
[requires]
31+
python_version = "3.9"

0 commit comments

Comments
 (0)