Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLD: Improve dev-install and CI config #2611

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ install:
- ps: $env:CERTIFI_VERSION=(sls "certifi==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
- conda create -n testenv --yes -q --use-local "pip<19" python=%PYTHON_VERSION% numpy=%NUMPY_VERSION% pandas=%PANDAS_VERSION% scipy=%SCIPY_VERSION% ta-lib=%TALIB_VERSION% bcolz=%BCOLZ_VERSION% numexpr=%NUMEXPR_VERSION% pytables=%PYTABLES_VERSION% h5py=%H5PY_VERSION% certifi=%CERTIFI_VERSION% -c quantopian -c https://conda.anaconda.org/quantopian/label/ci
- activate testenv
- bash etc/dev-install --cache-dir=%LOCALAPPDATA%\pip\Cache\pip_np%CONDA_NPY%py%CONDA_PY%
- SET PIP_CACHE_DIR=%LOCALAPPDATA%\pip\Cache\pip_np%CONDA_NPY%py%CONDA_PY%
- bash etc/dev-install
- python -m pip freeze | sort

test_script:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ install:

# XXX: With TRAVIS and CI both set, pip installing bcolz tries to compile it with coverage on py2, which fails to link against gcov on OSX.
# https://github.com/Blosc/bcolz/blob/8234a7505da5188dbaf415b7e36d4609d2c8c2f1/setup.py#L134-L136
- TRAVIS='' EXTERNAL_REQUIREMENTS='coveralls' etc/dev-install --cache-dir="$HOME/.cache/.pip/pip_np$CONDA_NPY"
- TRAVIS='' EXTERNAL_REQUIREMENTS='coveralls' PIP_CACHE_DIR="$HOME/.cache/.pip/pip_np$CONDA_NPY" etc/dev-install

before_script:
- pip freeze | sort
Expand Down
55 changes: 36 additions & 19 deletions etc/dev-install
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
#!/usr/bin/env bash
set -euo pipefail

# Consolidated installation script for use by both Travis and humans.
#
# First installs a known-good version of pip, then any requirements
# specified in the EXTERNAL_REQUIREMENTS environment variable (e.g.,
# coveralls); then installs the project requirements, constrained by
# etc/requirements.txt; then editably installs zipline itself.
#
# Forwards positional arguments to all invocations of pip install.

# Travis' env command doesn't permit options in the shebang line, so
# set them here.
set -euvxo pipefail

echo
echo "Installing zipline using $(which python)"
echo

set -x

python --version
python -m pip --version

# New releases of pip have frequently caused strange issues. Make sure
# we know exactly which version we're working with.
python -m pip install pip==19.2.2 $@
python -m pip install pip==19.3.1
# Python 3.5's default setuptools is 28.8.0; flake8 requires >=30.
# The newest version of this one is probably fine.
python -m pip install --upgrade setuptools

# Pip's command line options can also be set with environment variables:
# all subsequent invocations of pip will use these options.
#
# XXX: Pip works fine with relative paths if they are provided via the
# -c/--constraint option, but not via the PIP_CONSTRAINT environment
# variable: use `realpath` to make the path absolute.
export PIP_CONSTRAINT="$(realpath etc/requirements.txt)"
# XXX: bcolz has to be compiled against our specific version of numpy:
# by default, it uses an incompatible pre-compiled wheel.
export PIP_NO_BINARY=bcolz

# Install external requirements first: if they share any of our
# transitive dependencies, we want our pinned versions to win.
Expand All @@ -29,27 +43,30 @@ if [ "${EXTERNAL_REQUIREMENTS:-}" ]; then
# (Simply expanding $EXTERNAL_REQUIREMENTS causes an error with the
# -u option, which helps prevent many other kinds of errors.)
echo "Installing additional packages: $EXTERNAL_REQUIREMENTS"
python -m pip install "$EXTERNAL_REQUIREMENTS" $@
python -m pip install "$EXTERNAL_REQUIREMENTS"
fi

# These have to be installed first so that the other requirements can be
# compiled against the specific versions we use.
python -m pip install numpy Cython -c etc/requirements.txt $@
python -m pip install numpy Cython

# XXX: bcolz has to be compiled against our specific version of numpy:
# by default, it uses an incompatible pre-compiled binary.
python -m pip install --no-binary=bcolz -r etc/requirements.txt -c etc/requirements.txt $@
python -m pip install \
-r etc/requirements.txt \
-r etc/requirements_dev.txt \
-r etc/requirements_blaze.txt

# TODO: resolve these error messages:
# flake8 3.6.0 has requirement setuptools>=30, but you'll have setuptools 28.8.0 which is incompatible.
# TODO: resolve this error message:
# blaze keepalive-30.g31060532 has requirement odo>=0.5.0, but you'll have odo 0.3.2+729.gda7f26d which is incompatible.

python -m pip install -r etc/requirements_dev.txt -c etc/requirements.txt $@
python -m pip install -r etc/requirements_blaze.txt -c etc/requirements.txt $@

# All requirements should already be satisfied by this point.
python -m pip install -e .[all] -c etc/requirements.txt $@
python -m pip install -e .[all]

# Make sure it's installed and working.
which zipline
zipline --help

set +x

echo
echo "Installation complete! Try running 'zipline --help'."
echo "Installation complete!"
echo