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

CLI QOL Improvements #1181

Closed
4 tasks
ssanderson opened this issue May 5, 2016 · 5 comments
Closed
4 tasks

CLI QOL Improvements #1181

ssanderson opened this issue May 5, 2016 · 5 comments
Assignees
Labels

Comments

@ssanderson
Copy link
Contributor

ssanderson commented May 5, 2016

Tried to use the new CLI a bit this morning. Feedback from that experience.

  • You have to invoke the CLI with python -m zipline <stuff>, which is an annoying amount of typing. We could register an entrypoint in our setup.py so that you can just do zipline <stuff>. In my experience, this is how most libraries bundle command line interfaces (c.f., for example, gunicorn, ipython or jupyter). Click also has support for generating completion wrappers for entrypoints registered via console_scripts.
  • Related to the above, errors in the CLI show a filename of __main__.py in the usage string.
  • The quandl bundle isn't registered because we never import it. This is fixed on https://github.com/quantopian/zipline/pull/1178/files, but invoking python -m zipline ingest -b quandl crashes for me in fetch_symbol_metadata_frame.
  • You need to pass the name of a bundle to zipline ingest or zipline run, but there's no way to see what bundles are available. A zipline bundles entrypoint would be nice for this, which could also be used to show the dates for which you have bundles available.
@ssanderson
Copy link
Contributor Author

cc @richafrank

@richafrank
Copy link
Member

👍

@ssanderson
Copy link
Contributor Author

Stack trace for the failures I'm seeing on @llllllllll's latest trying to run the quandl bundle:

(qexec) [~/quantopian/qexec/zipline_repo]@(quantopian-quandl:fc04cd0819)$ python -m zipline ingest -b quandl
Downloading WIKI metadata:   [------------------------------------]
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ssanderson/quantopian/qexec/zipline_repo/zipline/__main__.py", line 345, in <module>
    cli()
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/ssanderson/quantopian/qexec/zipline_repo/zipline/__main__.py", line 298, in ingest
    show_progress,
  File "zipline/data/bundles/core.py", line 342, in ingest
    pth.data_path([name, timestr], environ=environ),
  File "zipline/data/bundles/quandl.py", line 280, in quandl_bundle
    show_progress=show_progress,
  File "zipline/data/bundles/quandl.py", line 112, in fetch_symbol_metadata_frame
    data = pd.concat(blocks, ignore_index=True).rename(columns={
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/pandas/tools/merge.py", line 754, in concat
    copy=copy)
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/pandas/tools/merge.py", line 785, in __init__
    objs = [obj for obj in objs if obj is not None ]
  File "/home/ssanderson/.virtualenvs/qexec/local/lib/python2.7/site-packages/click/_termui_impl.py", line 240, in next
    rv = next(self.iter)
  File "zipline/data/bundles/quandl.py", line 62, in _fetch_raw_metadata
    if raw.empty:
AttributeError: 'list' object has no attribute 'empty'

@llllllllll
Copy link
Contributor

this is a really funny issue. In python 2 when we do raw = cache[key] that always returns a list for the first key because the bytes happen to not crash the msgpack parser and it is treating the filepath (which is bytes in py2) as msgpack data...

llllllllll pushed a commit that referenced this issue May 5, 2016
Fixes the issues presented in #1181 by @ssanderson around the new
command line interface.
llllllllll pushed a commit that referenced this issue May 5, 2016
Fixes the issues presented in #1181 by @ssanderson around the new
command line interface.
@llllllllll
Copy link
Contributor

fixed with #1178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants