mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 09:02:58 +08:00
Merge pull request #128 from quantopian/vanilla-setup-py
Strips out use of pavement in generating our setup.py
This commit is contained in:
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
a=0
|
||||
while read line
|
||||
do
|
||||
if [[ -n "$line" && "$line" != \#* ]] ; then
|
||||
pip install $line
|
||||
fi
|
||||
((a = a + 1))
|
||||
done < $1
|
||||
echo "$0: Final package count is $a";
|
||||
@@ -1,5 +1,4 @@
|
||||
msgpack-python==0.1.12
|
||||
humanhash==0.0.1
|
||||
iso8601==0.1.4
|
||||
|
||||
# Logging
|
||||
|
||||
-225
@@ -1,225 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
from paver.easy import options, Bunch, task, path
|
||||
from paver.setuputils import install_distutils_tasks, \
|
||||
find_packages, find_package_data
|
||||
from subprocess import call
|
||||
install_distutils_tasks()
|
||||
|
||||
# ===================
|
||||
# Release Information
|
||||
# ===================
|
||||
|
||||
PACKAGE = 'zipline'
|
||||
SRC_PATH = 'zipline'
|
||||
|
||||
MAJOR = 0
|
||||
MINOR = 1
|
||||
MICRO = 0
|
||||
DEVELOPMENT = True
|
||||
|
||||
if DEVELOPMENT:
|
||||
VERSION = '%d.%d.%d dev' % (MAJOR, MINOR, MICRO)
|
||||
else:
|
||||
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
|
||||
|
||||
# The PyPi page
|
||||
DESCRIPTION = open('README.md').read()
|
||||
EMAIL='dev@quantopian.com'
|
||||
|
||||
# ===========
|
||||
# Setuputils
|
||||
# ===========
|
||||
|
||||
def parse_requirements(file_name):
|
||||
requirements = []
|
||||
for line in open(file_name, 'r').read().split('\n'):
|
||||
if re.match(r'(\s*#)|(\s*$)', line):
|
||||
continue
|
||||
if re.match(r'\s*-e\s+', line):
|
||||
requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line))
|
||||
elif re.match(r'\s*-f\s+', line):
|
||||
pass
|
||||
else:
|
||||
requirements.append(line)
|
||||
return requirements
|
||||
|
||||
# ============
|
||||
# Dependencies
|
||||
# ============
|
||||
|
||||
install_requires = (
|
||||
parse_requirements('./etc/requirements.txt') +
|
||||
parse_requirements('./etc/requirements_sci.txt')
|
||||
)
|
||||
tests_require = install_requires + parse_requirements('./etc/requirements_dev.txt')
|
||||
|
||||
# ========
|
||||
# seutp.py
|
||||
# ========
|
||||
|
||||
options(
|
||||
sphinx = Bunch(
|
||||
builddir="_build",
|
||||
sourcedir=""
|
||||
),
|
||||
setup = Bunch(
|
||||
name = PACKAGE,
|
||||
version = VERSION,
|
||||
packages = find_packages(),
|
||||
package_data = find_package_data(
|
||||
SRC_PATH,
|
||||
package = PACKAGE,
|
||||
only_in_packages = False
|
||||
),
|
||||
long_description = DESCRIPTION,
|
||||
install_requires = install_requires,
|
||||
tests_require = tests_require,
|
||||
test_suite = 'nose.collector',
|
||||
include_package_data = True,
|
||||
zip_safe = False,
|
||||
classifiers = [
|
||||
'Development Status :: 2 - Pre-Alpha',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Natural Language :: English',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: C',
|
||||
'Programming Language :: Cython',
|
||||
'Operating System :: OS Independent',
|
||||
'Intended Audience :: Science/Research',
|
||||
'Topic :: Office/Business :: Financial',
|
||||
'Topic :: Scientific/Engineering :: Information Analysis',
|
||||
'Topic :: System :: Distributed Computing',
|
||||
],
|
||||
entry_points = {
|
||||
'console_scripts': [
|
||||
'zipline = zipline.core.interpreter:main',
|
||||
]
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
# ======
|
||||
# Tasks
|
||||
# ======
|
||||
|
||||
# Because I'm lazy
|
||||
stuff_i_want_in_my_debug_shell = [
|
||||
('qutil', 'zipline.util', []),
|
||||
]
|
||||
|
||||
@task
|
||||
def coverage():
|
||||
"""
|
||||
Run the devsever under the coverage reporter, generate the
|
||||
coverage report.
|
||||
"""
|
||||
call('nosetests zipline', shell=True)
|
||||
call('coverage html', shell=True)
|
||||
call('chromium %s/cover/index.html' % (os.path.abspath(".")), shell=True)
|
||||
|
||||
@task
|
||||
def profile():
|
||||
"""
|
||||
Runtime profiling using cProfile, use pStats to find heavy
|
||||
calls. Or use python -m pstats to get more granular
|
||||
statistics about runtimes.
|
||||
"""
|
||||
try:
|
||||
call('python -m cProfile -o zipline.prof qexec/web/devserver.py --hostsettings', shell=True)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
import pstats
|
||||
time.sleep(1) # wait for disk io
|
||||
|
||||
p = pstats.Stats('zipline.prof')
|
||||
# Print the hundred heaviest function calls
|
||||
p.sort_stats('time').print_stats(100)
|
||||
|
||||
@task
|
||||
def lineprofile():
|
||||
"""
|
||||
Line by line profiler. Find hotspots in your code using the
|
||||
@profile decorator .
|
||||
"""
|
||||
path('devserver.py.lprof').remove()
|
||||
try:
|
||||
call('kernprof.py -l qexec/web/devserver.py --hostsettings', shell=True)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
time.sleep(1) # wait for disk io
|
||||
call('python -m line_profiler devserver.py.lprof', shell=True)
|
||||
|
||||
def magic_shell():
|
||||
sys.path.append(path())
|
||||
imported_objects = {}
|
||||
for mod in find_packages():
|
||||
imported_objects[mod] = __import__(mod)
|
||||
|
||||
for name, mod, defs in stuff_i_want_in_my_debug_shell:
|
||||
imported_objects[name] = __import__(mod, globals(), locals(), defs)
|
||||
|
||||
return imported_objects
|
||||
|
||||
@task
|
||||
def shell():
|
||||
"""
|
||||
Run a bpython shell with all your desired modules right at
|
||||
your fingertips.
|
||||
"""
|
||||
from bpython import embed
|
||||
embed(magic_shell())
|
||||
|
||||
@task
|
||||
def ishell():
|
||||
"""
|
||||
Run a ipython shell with all your desired modules right at
|
||||
your fingertips.
|
||||
"""
|
||||
from IPython.frontend.terminal.embed import InteractiveShellEmbed
|
||||
shell = InteractiveShellEmbed(user_ns=magic_shell())
|
||||
#shell.extensiosn = ['line_profiler',]
|
||||
shell()
|
||||
|
||||
@task
|
||||
def findbugs():
|
||||
"""
|
||||
Google's bug prediction algorithm. Algorithmically find
|
||||
hotspots in your code where bugs are likely to occur based on
|
||||
their git history.
|
||||
"""
|
||||
call('bugspot.py zipline', shell=True)
|
||||
|
||||
@task
|
||||
def findtodos():
|
||||
"""
|
||||
Grep for TODO
|
||||
"""
|
||||
call('grep TODO zipline/*/*.py -C 3 ', shell=True)
|
||||
|
||||
@task
|
||||
def findpdb():
|
||||
"""
|
||||
find references to debugger
|
||||
"""
|
||||
call('grep "import pdb; pdb.set_trace()" zipline/*/*.py -C 3 ', shell=True)
|
||||
|
||||
@task
|
||||
def guppy():
|
||||
"""
|
||||
Guppy heap analyzer
|
||||
"""
|
||||
pass
|
||||
|
||||
@task
|
||||
def apidocs():
|
||||
"""
|
||||
Recursively autogenerate the Sphinx autodoc for the module and
|
||||
its submodules.
|
||||
"""
|
||||
call('rm docs/zipline*.rst', shell=True)
|
||||
call('sphinx-apidoc -o docs/ zipline', shell=True)
|
||||
@@ -1,9 +1,34 @@
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
#!/usr/bin/env python
|
||||
|
||||
if os.path.exists("paver-minilib.zip"):
|
||||
import sys
|
||||
sys.path.insert(0, "paver-minilib.zip")
|
||||
from distutils.core import setup
|
||||
|
||||
import paver.tasks
|
||||
paver.tasks.main()
|
||||
setup(name='zipline',
|
||||
version='0.5.0',
|
||||
description='A backtester for financial algorithms.',
|
||||
author='Quantopian Inc.',
|
||||
author_email='opensource@quantopian.com',
|
||||
packages=['zipline'],
|
||||
long_description=open('README.md').read(),
|
||||
license='Apache 2.0',
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Natural Language :: English',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Operating System :: OS Independent',
|
||||
'Intended Audience :: Science/Research',
|
||||
'Topic :: Office/Business :: Financial',
|
||||
'Topic :: Scientific/Engineering :: Information Analysis',
|
||||
'Topic :: System :: Distributed Computing',
|
||||
],
|
||||
install_requires=[
|
||||
'msgpack-python',
|
||||
'iso8601',
|
||||
'Logbook',
|
||||
'blist',
|
||||
'pytz',
|
||||
'numpy',
|
||||
'pandas'
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user