diff --git a/.travis.yml b/.travis.yml index 74444d65..187839f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ before_install: - sed -i "s/pandas==.*/pandas==$PANDAS_VERSION/" etc/requirements.txt - sed -i "s/scipy==.*/scipy==$SCIPY_VERSION/" etc/requirements.txt install: - - conda create -n testenv --yes -c quantopian pip python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION ta-lib=0.4.8 + - conda create -n testenv --yes -c quantopian pip python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION ta-lib=0.4.9 - source activate testenv - pip install --upgrade pip coverage coveralls --cache-dir=$CACHE_DIR - pip install -r etc/requirements.txt --cache-dir=$CACHE_DIR diff --git a/MANIFEST.in b/MANIFEST.in index 314707c8..5911974b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,5 +3,6 @@ include LICENSE include etc/requirements*.txt recursive-include zipline/resources *.* recursive-include zipline *.pyx +recursive-include zipline *.pxi include versioneer.py include zipline/_version.py diff --git a/conda/bcolz/bld.bat b/conda/bcolz/bld.bat new file mode 100644 index 00000000..87b1481d --- /dev/null +++ b/conda/bcolz/bld.bat @@ -0,0 +1,8 @@ +"%PYTHON%" setup.py install +if errorlevel 1 exit 1 + +:: Add more build steps here, if they are necessary. + +:: See +:: http://docs.continuum.io/conda/build.html +:: for a list of environment variables that are set during the build process. diff --git a/conda/bcolz/build.sh b/conda/bcolz/build.sh new file mode 100644 index 00000000..4899c226 --- /dev/null +++ b/conda/bcolz/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +$PYTHON setup.py install --single-version-externally-managed --record=record.txt + +# Add more build steps here, if they are necessary. + +# See +# http://docs.continuum.io/conda/build.html +# for a list of environment variables that are set during the build process. diff --git a/conda/bcolz/meta.yaml b/conda/bcolz/meta.yaml new file mode 100644 index 00000000..7b785622 --- /dev/null +++ b/conda/bcolz/meta.yaml @@ -0,0 +1,68 @@ +package: + name: bcolz + version: "0.12.1" + +source: + fn: bcolz-0.12.1.tar.gz + url: https://pypi.python.org/packages/source/b/bcolz/bcolz-0.12.1.tar.gz + md5: 43deb659e1f926976be3850e01844360 +# patches: + # List any patch files here + # - fix.patch + +# build: + # noarch_python: True + # preserve_egg_dir: True + # entry_points: + # Put any entry points (scripts to be generated automatically) here. The + # syntax is module:function. For example + # + # - bcolz = bcolz:main + # + # Would create an entry point called bcolz that calls bcolz.main() + + + # If this is a new build for the same version, increment the build + # number. If you do not include this key, it defaults to 0. + # number: 1 + +requirements: + build: + - python + - setuptools + - numpy x.x + - setuptools_scm + - cython ==0.22.1 + + run: + - python + - numpy x.x + +test: + # Python imports + imports: + - bcolz +# - bcolz.tests + + # commands: + # You can put test commands to be run here. Use this to test that the + # entry points work. + + + # You can also put a file called run_test.py in the recipe that will be run + # at test time. + +# requires: +# - mock +# - unittest2 ; python_version < 2.7 + # Put any additional test requirements here. For example + # - nose + +about: + home: https://github.com/Blosc/bcolz + license: BSD License + summary: 'columnar and compressed data containers.' + +# See +# http://docs.continuum.io/conda/build.html for +# more information about meta.yaml diff --git a/conda/setuptools_scm/bld.bat b/conda/setuptools_scm/bld.bat new file mode 100644 index 00000000..87b1481d --- /dev/null +++ b/conda/setuptools_scm/bld.bat @@ -0,0 +1,8 @@ +"%PYTHON%" setup.py install +if errorlevel 1 exit 1 + +:: Add more build steps here, if they are necessary. + +:: See +:: http://docs.continuum.io/conda/build.html +:: for a list of environment variables that are set during the build process. diff --git a/conda/setuptools_scm/build.sh b/conda/setuptools_scm/build.sh new file mode 100644 index 00000000..4d7fc032 --- /dev/null +++ b/conda/setuptools_scm/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +$PYTHON setup.py install + +# Add more build steps here, if they are necessary. + +# See +# http://docs.continuum.io/conda/build.html +# for a list of environment variables that are set during the build process. diff --git a/conda/setuptools_scm/meta.yaml b/conda/setuptools_scm/meta.yaml new file mode 100644 index 00000000..65595736 --- /dev/null +++ b/conda/setuptools_scm/meta.yaml @@ -0,0 +1,62 @@ +package: + name: setuptools_scm + version: "1.10.1" + +source: + fn: setuptools_scm-1.10.1.tar.bz2 + url: https://pypi.python.org/packages/source/s/setuptools_scm/setuptools_scm-1.10.1.tar.bz2 + md5: 99823e2cd564b996f18820a065f0a974 +# patches: + # List any patch files here + # - fix.patch + +build: + # noarch_python: True + preserve_egg_dir: True + # entry_points: + # Put any entry points (scripts to be generated automatically) here. The + # syntax is module:function. For example + # + # - setuptools_scm = setuptools_scm:main + # + # Would create an entry point called setuptools_scm that calls setuptools_scm.main() + + + # If this is a new build for the same version, increment the build + # number. If you do not include this key, it defaults to 0. + # number: 1 + +requirements: + build: + - python + - setuptools + + run: + - python + - setuptools + +test: + # Python imports + imports: + - setuptools_scm + + # commands: + # You can put test commands to be run here. Use this to test that the + # entry points work. + + + # You can also put a file called run_test.py in the recipe that will be run + # at test time. + + # requires: + # Put any additional test requirements here. For example + # - nose + +about: + home: https://github.com/pypa/setuptools_scm/ + license: MIT License + summary: 'the blessed package to manage your versions by scm tags' + +# See +# http://docs.continuum.io/conda/build.html for +# more information about meta.yaml diff --git a/conda/ta-lib/build.sh b/conda/ta-lib/build.sh index 13c003fa..4f843e38 100644 --- a/conda/ta-lib/build.sh +++ b/conda/ta-lib/build.sh @@ -1,12 +1,16 @@ #!/bin/bash -wget -O ta-lib-0.4.0-src.tar.gz http://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download -tar xvzf ta-lib-0.4.0-src.tar.gz +wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz +tar xvfz ta-lib-0.4.0-src.tar.gz pushd ta-lib ./configure --prefix=$PREFIX make make install popd +rm ta-lib-0.4.0-src.tar.gz +rm -r ta-lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PREFIX/lib +export TA_INCLUDE_PATH=$PREFIX/include +export TA_LIBRARY_PATH=$PREFIX/lib python setup.py build python setup.py install --prefix=$PREFIX diff --git a/conda/ta-lib/meta.yaml b/conda/ta-lib/meta.yaml index f6b31d23..5903680c 100644 --- a/conda/ta-lib/meta.yaml +++ b/conda/ta-lib/meta.yaml @@ -1,10 +1,11 @@ package: name: ta-lib - version: !!str 0.4.8 + version: !!str 0.4.9 source: - fn: TA_Lib-0.4.8.tar.gz - url: https://github.com/mrjbq7/ta-lib/archive/TA_Lib-0.4.8.tar.gz + fn: TA_Lib-0.4.9.tar.gz + url: https://github.com/mrjbq7/ta-lib/archive/TA_Lib-0.4.9.tar.gz + md5: f2f6ec8b7d552ff96d53d56ffb7b4e97 requirements: build: diff --git a/conda/zipline/meta.yaml b/conda/zipline/meta.yaml index 5bbe111f..ebb82b5c 100644 --- a/conda/zipline/meta.yaml +++ b/conda/zipline/meta.yaml @@ -6,9 +6,6 @@ package: build: number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }} - {% if environ.get('GIT_DESCRIBE_NUMBER', '0') == '0' %}string: py{{ environ.get('PY_VER').replace('.', '') }}_0 - {% else %}string: py{{ environ.get('PY_VER').replace('.', '') }}_{{ environ.get('GIT_BUILD_STR', 'GIT_STUB') }}{% endif %} - source: git_url: ../../ @@ -16,9 +13,9 @@ source: requirements: build: - python - - setuptools - - cython - - numpy + {% for req in data.get('build_requires', []) -%} + - {{req}} + {% endfor %} run: - python {% for req in data.get('install_requires', []) -%} diff --git a/docs/source/appendix.rst b/docs/source/appendix.rst index b15b51d6..27d28c2d 100644 --- a/docs/source/appendix.rst +++ b/docs/source/appendix.rst @@ -107,7 +107,7 @@ Asset Metadata :members: Data API -~~~~ +~~~~~~~~ .. autoclass:: zipline.data.minute_bars.BcolzMinuteBarWriter :members: diff --git a/docs/source/conf.py b/docs/source/conf.py index d8f8600d..58c9d9e4 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,10 @@ extensions = [ ] -extlinks = dict(issue=('https://github.com/quantopian/zipline/issues/%s', '#')) +extlinks = { + 'issue': ('https://github.com/quantopian/zipline/issues/%s', '#'), + 'commit': ('https://github.com/quantopian/zipline/commit/%s', ''), +} # -- Docstrings --------------------------------------------------------------- @@ -38,7 +41,7 @@ master_doc = 'index' # General information about the project. project = u'Zipline' -copyright = u'2015, Quantopian Inc.' +copyright = u'2016, Quantopian Inc.' # The full version, including alpha/beta/rc tags. release = version @@ -75,7 +78,7 @@ html_static_path = ['.static'] html_use_index = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -html_show_sphinx = False +html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. html_show_copyright = True diff --git a/docs/source/whatsnew/0.6.1.txt b/docs/source/whatsnew/0.6.1.txt index 57e7f12f..e6d6f7c7 100644 --- a/docs/source/whatsnew/0.6.1.txt +++ b/docs/source/whatsnew/0.6.1.txt @@ -123,7 +123,7 @@ Enhancements Bug Fixes ~~~~~~~~~ -* Adjust benchmark events to match market hours (:issue:`241). +* Adjust benchmark events to match market hours (:issue:`241`). Previously benchmark events were emitted at 0:00 on the day the benchmark related to: in 'minute' emission mode this meant that the benchmarks were emitted before any intra-day trades were processed. diff --git a/docs/source/whatsnew/0.8.4.txt b/docs/source/whatsnew/0.8.4.txt index 9531fead..42ba82e8 100644 --- a/docs/source/whatsnew/0.8.4.txt +++ b/docs/source/whatsnew/0.8.4.txt @@ -22,6 +22,9 @@ Highlights ``BoundColumn.latest`` now returns a proper ``Filter`` object when the column is of dtype ``bool``. +* Zipline now supports ``numpy`` 1.10, ``pandas`` 0.17, and ``scipy`` 0.16 + (:issue:`969`). + Enhancements ~~~~~~~~~~~~ @@ -75,8 +78,8 @@ Enhancements preprocessor functions to explicitly allow ``None`` (:issue:`947`). * Added :func:`~zipline.utils.input_validation.ensure_timezone` to allow string - arguments to get converted into ``datetime.tzinfo`` objects. This also allows - ``tzinfo`` objects to be passed directly (:issue:`947`). + arguments to get converted into :class:`datetime.tzinfo` objects. This also + allows ``tzinfo`` objects to be passed directly (:issue:`947`). * Added two optional arguments, ``data_query_time`` and ``data_query_tz`` to :class:`~zipline.pipeline.loaders.blaze.core.BlazeLoader` and @@ -120,7 +123,7 @@ Bug Fixes us to think that the object was not empty even when it was (:issue:`826`). * Fixes an error raised in calculating beta when benchmark data were sparse. - Instead `numpy.nan` is returned (:issue:`859`). + Instead :data:`numpy.nan` is returned (:issue:`859`). * Fixed an issue pickling :func:`~zipline.utils.sentinel.sentinel` objects (:issue:`872`). @@ -139,7 +142,7 @@ Bug Fixes This would map the same symbol to two different sids (:issue:`942`). * Fixed an issue where the - :class:"`~zipline.finance.performance.period.PerformancePeriod` incorrectly + :class:`~zipline.finance.performance.period.PerformancePeriod` incorrectly reported the total_positions_value when creating a :class:`~zipline.protocol.Account` (:issue:`950`). @@ -147,8 +150,10 @@ Bug Fixes python, where Assets did not compare properly with int64s (:issue:`959`). * Fixed a bug where boolean operators were not properly implemented on - :class:~zipline.pipeline.Filter` (:issue:`991`). + :class:`~zipline.pipeline.Filter` (:issue:`991`). +* Installation of zipline no longer downgrades numpy to 1.9.2 silently and + unconditionally (:issue:`969`). Performance ~~~~~~~~~~~ @@ -169,7 +174,11 @@ Maintenance and Refactorings * Asset databases now contain version information to ensure compatibility with current Zipline version (:issue:`815`). -* Upgrade requests version to 2.9.1. +* Upgrade ``requests`` version to 2.9.1 (:commit:`2ee40db`) + +* Upgrade ``logbook`` version to 0.12.5 (:commit:`11465d9`). + +* Upgrade ``Cython`` version to 0.23.4 (:commit:`5f49fa2`). Build ~~~~~ @@ -181,6 +190,7 @@ Build * Fixed conda build, which now uses git source as its source and reads requirements using setup.py, instead of copying them and letting them get out of sync (:issue:`937`). +* Require ``setuptools`` > 18.0 (:issue:`951`). Documentation ~~~~~~~~~~~~~ @@ -199,7 +209,7 @@ Miscellaneous * Added a :meth:`~zipline.pipeline.pipeline.Pipeline.show_graph` method to render a Pipeline as an image (:issue:`836`). * Adds :func:`~zipline.utils.test_utils.subtest` decorator for creating subtests - without ``nose_parameterized.expand`` which bloats the test output + without :func:`nose_parameterized.expand` which bloats the test output (:issue:`833`). * Limits timer report in test output to 15 longest tests (:issue:`838`). * Treasury and benchmark downloads will now wait up to an hour to download diff --git a/etc/requirements.txt b/etc/requirements.txt index cdfe7dd4..fd757aa5 100644 --- a/etc/requirements.txt +++ b/etc/requirements.txt @@ -1,5 +1,7 @@ # Incompatible with earlier PIP versions pip>=7.1.0 +# bcolz fails to install if this is not in the build_requires. +setuptools>18.0 # Logging Logbook==0.12.5 @@ -24,7 +26,7 @@ six==1.9.0 # For fetching remote data requests==2.9.1 -Cython==0.23.4 +Cython==0.22.1 # faster OrderedDict cyordereddict==0.2.2 diff --git a/setup.py b/setup.py index d09f6170..cad73dbd 100644 --- a/setup.py +++ b/setup.py @@ -157,6 +157,10 @@ REQ_PATTERN = re.compile("([^=<>]+)([<=>]{1,2})(.*)") def _conda_format(req): + match = REQ_PATTERN.match(req) + if match and match.group(1).lower() == 'numpy': + return 'numpy x.x' + return REQ_PATTERN.sub( lambda m: '%s %s%s' % (m.group(1).lower(), m.group(2), m.group(3)), req, @@ -202,7 +206,8 @@ def extras_requires(conda_format=False): } -def module_requirements(requirements_path, module_names, strict_bounds): +def module_requirements(requirements_path, module_names, strict_bounds, + conda_format=False): module_names = set(module_names) found = set() module_lines = [] @@ -215,6 +220,8 @@ def module_requirements(requirements_path, module_names, strict_bounds): name = match.group(1) if name in module_names: found.add(name) + if conda_format: + line = _conda_format(line) module_lines.append(line) if found != module_names: @@ -225,8 +232,20 @@ def module_requirements(requirements_path, module_names, strict_bounds): conda_build = os.path.basename(sys.argv[0]) == 'conda-build' +setup_requires = module_requirements( + 'etc/requirements.txt', + ('Cython', 'numpy'), + strict_bounds=conda_build, + conda_format=conda_build, +) + +conditional_arguments = { + 'setup_requires' if not conda_build else 'build_requires': setup_requires, +} + setup( name='zipline', + url="http://zipline.io", version=versioneer.get_version(), cmdclass=LazyBuildExtCommandClass(versioneer.get_cmdclass()), description='A backtester for financial algorithms.', @@ -252,10 +271,5 @@ setup( ], install_requires=install_requires(conda_format=conda_build), extras_require=extras_requires(conda_format=conda_build), - setup_requires=module_requirements( - 'etc/requirements.txt', - ('Cython', 'numpy'), - strict_bounds=False, - ), - url="http://zipline.io", + **conditional_arguments )