python development environment on a mac

Jeremy Lavergne jeremy at lavergne.me
Wed Mar 15 12:45:06 UTC 2017


To that end, also check out using pip-tools along with virtualenv. This
will allow you to determine the whole set of dependencies and their
versions.

Example shell script using pip-tools inside a virtualenv for producing a
requirements.txt for `pip install --upgrade -r requirements.txt`:

#!/usr/bin/env bash
set -eux
# needs pip-tools: sudo pip install -U pip-tools

HERE="$(dirname $0)"
REQUIREMENTS_FILE="${HERE}/requirements.txt"

REQUIREMENTS_VE="/tmp/requirements_update_ve"

rm -rf "${REQUIREMENTS_VE}"
virtualenv "${REQUIREMENTS_VE}"
set +eux
. "${REQUIREMENTS_VE}/bin/activate"
set -eux
pip install -U pip-tools

pip-compile --upgrade --rebuild --verbose --annotate
--output-file=${REQUIREMENTS_FILE} - <<REQUIREMENTS
awscli
boto
boto3
lxml
netaddr
requests
beautifulsoup4
REQUIREMENTS

rm -rf "${REQUIREMENTS_VE}"


On 03/14/2017 10:42 PM, Kendall Shaw wrote:
> virtualenv allows you to isolate your projects from each other and from
> a surrounding python system. So, for example, 1 project that has a
> dependency  that is incompatible with a dependency in another project
> can still work since they are isolated from each other.



More information about the macports-users mailing list