Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
Changed zipline -> catalyst import paths
Browse files Browse the repository at this point in the history
 * Updated cython build scripts
 * Updated setup.py to to install catalyst package
 * Updated momentum example to use catalyst package
 * catalyst executable now supports loading pipelines from multiple bundles
  • Loading branch information
cfromknecht committed Jun 19, 2017
1 parent be2fe35 commit fce9717
Show file tree
Hide file tree
Showing 244 changed files with 1,102 additions and 1,122 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
# Dockerfile for an image with the currently checked out version of zipline installed. To build:
# Dockerfile for an image with the currently checked out version of catalyst installed. To build:
#
# docker build -t quantopian/zipline .
# docker build -t quantopian/catalyst .
#
# To run the container:
#
# docker run -v /path/to/your/notebooks:/projects -v ~/.zipline:/root/.zipline -p 8888:8888/tcp --name zipline -it quantopian/zipline
# docker run -v /path/to/your/notebooks:/projects -v ~/.catalyst:/root/.catalyst -p 8888:8888/tcp --name catalyst -it quantopian/catalyst
#
# To access Jupyter when running docker locally (you may need to add NAT rules):
#
Expand All @@ -19,7 +19,7 @@
#
# You can also run an algo using the docker exec command. For example:
#
# docker exec -it zipline zipline run -f /projects/my_algo.py --start 2015-1-1 --end 2016-1-1 /projects/result.pickle
# docker exec -it catalyst catalyst run -f /projects/my_algo.py --start 2015-1-1 --end 2016-1-1 /projects/result.pickle
#
FROM python:3.5

Expand Down Expand Up @@ -48,7 +48,7 @@ RUN mkdir ${PROJECT_DIR} \
&& curl -L https://downloads.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz | tar xvz

#
# build and install zipline from source. install TA-Lib after to ensure
# build and install catalyst from source. install TA-Lib after to ensure
# numpy is available.
#

Expand All @@ -72,17 +72,17 @@ RUN pip install 'numpy>=1.11.1,<2.0.0' \
ADD ./etc/docker_cmd.sh /

#
# make port available. /zipline is made a volume
# make port available. /catalyst is made a volume
# for developer testing.
#
EXPOSE ${NOTEBOOK_PORT}

#
# build and install the zipline package into the image
# build and install the catalyst package into the image
#

ADD . /zipline
WORKDIR /zipline
ADD . /catalyst
WORKDIR /catalyst
RUN pip install -e .

#
Expand Down
16 changes: 8 additions & 8 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#
# Dockerfile for an image with the currently checked out version of zipline installed. To build:
# Dockerfile for an image with the currently checked out version of catalyst installed. To build:
#
# docker build -t quantopian/ziplinedev -f Dockerfile-dev .
# docker build -t quantopian/catalystdev -f Dockerfile-dev .
#
# Note: the dev build requires a quantopian/zipline image, which you can build as follows:
# Note: the dev build requires a quantopian/catalyst image, which you can build as follows:
#
# docker build -t quantopian/zipline -f Dockerfile
# docker build -t quantopian/catalyst -f Dockerfile
#
# To run the container:
#
# docker run -v /path/to/your/notebooks:/projects -v ~/.zipline:/root/.zipline -p 8888:8888/tcp --name ziplinedev -it quantopian/ziplinedev
# docker run -v /path/to/your/notebooks:/projects -v ~/.catalyst:/root/.catalyst -p 8888:8888/tcp --name catalystdev -it quantopian/catalystdev
#
# To access Jupyter when running docker locally (you may need to add NAT rules):
#
Expand All @@ -23,11 +23,11 @@
#
# You can also run an algo using the docker exec command. For example:
#
# docker exec -it ziplinedev zipline run -f /projects/my_algo.py --start 2015-1-1 --end 2016-1-1 /projects/result.pickle
# docker exec -it catalystdev catalyst run -f /projects/my_algo.py --start 2015-1-1 --end 2016-1-1 /projects/result.pickle
#
FROM quantopian/zipline
FROM quantopian/catalyst

WORKDIR /zipline
WORKDIR /catalyst

RUN pip install -r etc/requirements_dev.txt -r etc/requirements_blaze.txt
# Clean out any cython assets. The pip install re-builds them.
Expand Down
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include LICENSE

include etc/requirements*.txt
recursive-include zipline *.pyi
recursive-include zipline *.pxi
recursive-include catalyst *.pyi
recursive-include catalyst *.pxi

recursive-include zipline/resources *.*
recursive-include catalyst/resources *.*
include versioneer.py
include zipline/_version.py
include catalyst/_version.py
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ install:
- ps: copy .\ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64"
- "%CMD_IN_ENV% python .\\ci\\make_conda_packages.py"

# test that we can conda install zipline in a new env
- conda create -n installenv --yes -q --use-local python=%PYTHON_VERSION% numpy=%NUMPY_VERSION% zipline -c quantopian -c https://conda.anaconda.org/quantopian/label/ci
# test that we can conda install catalyst in a new env
- conda create -n installenv --yes -q --use-local python=%PYTHON_VERSION% numpy=%NUMPY_VERSION% catalyst -c quantopian -c https://conda.anaconda.org/quantopian/label/ci

- ps: $env:BCOLZ_VERSION=(sls "bcolz==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
- ps: $env:NUMEXPR_VERSION=(sls "numexpr==(.*)" .\etc\requirements.txt -ca).matches.groups[1].value
Expand All @@ -101,8 +101,8 @@ install:
- pip freeze | sort

test_script:
- nosetests -e zipline.utils.numpy_utils
- flake8 zipline tests
- nosetests -e catalyst.utils.numpy_utils
- flake8 catalyst tests

branches:
only:
Expand Down
12 changes: 6 additions & 6 deletions zipline/__init__.py → catalyst/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
from . import api


# PERF: Fire a warning if calendars were instantiated during zipline import.
# Having calendars doesn't break anything per-se, but it makes zipline imports
# PERF: Fire a warning if calendars were instantiated during catalyst import.
# Having calendars doesn't break anything per-se, but it makes catalyst imports
# noticeably slower, which becomes particularly noticeable in the Zipline CLI.
from zipline.utils.calendars.calendar_utils import global_calendar_dispatcher
from catalyst.utils.calendars.calendar_utils import global_calendar_dispatcher
if global_calendar_dispatcher._calendars:
import warnings
warnings.warn(
"Found TradingCalendar instances after zipline import.\n"
"Found TradingCalendar instances after catalyst import.\n"
"Zipline startup will be much slower until this is fixed!",
)
del warnings
Expand All @@ -49,8 +49,8 @@


def load_ipython_extension(ipython):
from .__main__ import zipline_magic
ipython.register_magic_function(zipline_magic, 'line_cell', 'zipline')
from .__main__ import catalyst_magic
ipython.register_magic_function(catalyst_magic, 'line_cell', 'catalyst')


if os.name == 'nt':
Expand Down
22 changes: 11 additions & 11 deletions zipline/__main__.py → catalyst/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import pandas as pd
from six import text_type

from zipline.data import bundles as bundles_module
from zipline.utils.cli import Date, Timestamp
from zipline.utils.run_algo import _run, load_extensions
from catalyst.data import bundles as bundles_module
from catalyst.utils.cli import Date, Timestamp
from catalyst.utils.run_algo import _run, load_extensions

try:
__IPYTHON__
Expand All @@ -22,12 +22,12 @@
'-e',
'--extension',
multiple=True,
help='File or module path to a zipline extension to load.',
help='File or module path to a catalyst extension to load.',
)
@click.option(
'--strict-extensions/--non-strict-extensions',
is_flag=True,
help='If --strict-extensions is passed then zipline will not run if it'
help='If --strict-extensions is passed then catalyst will not run if it'
' cannot load all of the specified extensions. If this is not passed or'
' --non-strict-extensions is passed then the failure will be logged but'
' execution will continue.',
Expand All @@ -36,10 +36,10 @@
'--default-extension/--no-default-extension',
is_flag=True,
default=True,
help="Don't load the default zipline extension.py file in $ZIPLINE_HOME.",
help="Don't load the default catalyst extension.py file in $ZIPLINE_HOME.",
)
def main(extension, strict_extensions, default_extension):
"""Top level zipline entry point.
"""Top level catalyst entry point.
"""
# install a logbook handler before performing any other operations
logbook.StderrHandler().push_application()
Expand Down Expand Up @@ -242,14 +242,14 @@ def run(ctx,

if output == '-':
click.echo(str(perf))
elif output != os.devnull: # make the zipline magic not write any data
elif output != os.devnull: # make the catalyst magic not write any data
perf.to_pickle(output)

return perf


def zipline_magic(line, cell=None):
"""The zipline IPython cell magic.
def catalyst_magic(line, cell=None):
"""The catalyst IPython cell magic.
"""
load_extensions(
default=True,
Expand All @@ -270,7 +270,7 @@ def zipline_magic(line, cell=None):
'--algotext', '',
'--local-namespace',
] if cell is None else []) + line.split(),
'%s%%zipline' % ((cell or '') and '%'),
'%s%%catalyst' % ((cell or '') and '%'),
# don't use system exit and propogate errors to the caller
standalone_mode=False,
)
Expand Down
8 changes: 4 additions & 4 deletions zipline/_protocol.pyx → catalyst/_protocol.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ from six import iteritems, PY2, string_types
from cpython cimport bool
from collections import Iterable

from zipline.assets import (Asset,
from catalyst.assets import (Asset,
AssetConvertible,
PricingDataAssociable,
Future)
from zipline.assets.continuous_futures import ContinuousFuture
from zipline.zipline_warnings import ZiplineDeprecationWarning
from catalyst.assets.continuous_futures import ContinuousFuture
from catalyst.catalyst_warnings import ZiplineDeprecationWarning


cdef bool _is_iterable(obj):
Expand Down Expand Up @@ -149,7 +149,7 @@ cdef class BarData:
data_frequency : {'minute', 'daily'}
The frequency of the bar data; i.e. whether the data is
daily or minute bars
restrictions : zipline.finance.asset_restrictions.Restrictions
restrictions : catalyst.finance.asset_restrictions.Restrictions
Object that combines and returns restricted list information from
multiple sources
universe_func : callable, optional
Expand Down
4 changes: 2 additions & 2 deletions zipline/_version.py → catalyst/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def get_config():
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = ""
cfg.parentdir_prefix = "zipline-"
cfg.versionfile_source = "zipline/_version.py"
cfg.parentdir_prefix = "catalyst-"
cfg.versionfile_source = "catalyst/_version.py"
cfg.verbose = False
return cfg

Expand Down
Loading

0 comments on commit fce9717

Please sign in to comment.