BLD: Build zipline conda package from source

This commit is contained in:
Richard Frank
2015-12-30 21:10:16 -05:00
parent 7a6ba4f249
commit 9896c3cdb6
2 changed files with 50 additions and 25 deletions
+21 -12
View File
@@ -1,28 +1,37 @@
{% set data = load_setuptools() %}
package:
name: zipline
version: 0.8.3
version: {{ environ.get('GIT_DESCRIBE_TAG', '')}}
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:
fn: zipline-0.8.3.tar.gz
url: https://pypi.python.org/packages/source/z/zipline/zipline-0.8.3.tar.gz
md5: 042ffcee614d2279add9a1bfd27a33cf
git_url: ../../
requirements:
build:
- python
- setuptools
- cython
- cython ==0.22.1
- numpy ==1.9.2
run:
- python
- pytz
- requests
- numpy
- pandas
- scipy
- matplotlib
- logbook
{% for req in data.get('install_requires', []) -%}
- {{req}}
{% endfor %}
test:
{# When we include the tests module in the zipline package, we can use this:
requires:
{% for req in data.get('extras_require', {}).get('dev', []) -%}
- {{req}}
{% endfor %}
#}
# Python imports
imports:
- zipline
+29 -13
View File
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import os
import re
import sys
from operator import lt, gt, eq, le, ge
@@ -133,7 +133,16 @@ def _with_bounds(req):
return ''.join(with_bounds)
def read_requirements(path, strict_bounds):
def _conda_format(req):
return re.sub(
'([^=<>]+)([=<>]{1,2})',
lambda m: '%s %s' % (m.group(1).lower(), m.group(2)),
req,
1,
)
def read_requirements(path, strict_bounds, conda_format=False):
"""
Read a requirements.txt file, expressed as a path relative to Zipline root.
@@ -144,20 +153,25 @@ def read_requirements(path, strict_bounds):
with open(real_path) as f:
reqs = _filter_requirements(f.readlines())
if strict_bounds:
return list(reqs)
else:
return list(map(_with_bounds, reqs))
if not strict_bounds:
reqs = map(_with_bounds, reqs)
if conda_format:
reqs = map(_conda_format, reqs)
return list(reqs)
def install_requires(strict_bounds=False):
def install_requires(strict_bounds=False, conda_format=False):
return read_requirements('etc/requirements.txt',
strict_bounds=strict_bounds)
strict_bounds=strict_bounds,
conda_format=conda_format)
def extras_requires():
def extras_requires(conda_format=False):
dev_reqs = read_requirements('etc/requirements_dev.txt',
strict_bounds=True)
strict_bounds=True,
conda_format=conda_format)
talib_reqs = ['TA-Lib==0.4.9']
return {
'dev': dev_reqs,
@@ -171,7 +185,7 @@ def module_requirements(requirements_path, module_names):
found = set()
module_lines = []
parser = re.compile("([^=<>]+)([<=>]{1,2})(.*)")
for line in read_requirements(requirements_path, strict_bounds=False):
for line in read_requirements(requirements_path, strict_bounds=True):
match = parser.match(line)
if match is None:
raise AssertionError("Could not parse requirement: '%s'" % line)
@@ -214,6 +228,7 @@ def pre_setup():
pre_setup()
conda_build = os.path.basename(sys.argv[0]) == 'conda-build'
setup(
name='zipline',
@@ -241,7 +256,8 @@ setup(
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: System :: Distributed Computing',
],
install_requires=install_requires(),
extras_require=extras_requires(),
install_requires=install_requires(strict_bounds=conda_build,
conda_format=conda_build),
extras_require=extras_requires(conda_format=conda_build),
url="http://zipline.io",
)