GitHub PullRequestReviewCommentEvent at 2014-05-02 22:26:08
Repository: pbt
Actor: jairot
Payload: {"comment":{"url":"https://api.github.com/repos/pebete/pbt/pulls/comments/12250945","id":12250945,"diff_hunk":"@@ -0,0 +1,46 @@\n+\"\"\"Try plugin \"\"\"\n+import pbt\n+import tempfile\n+import sys\n+import pip\n+\n+\n+@pbt.command(runs_in_project=False,name='try')\n+def main(ctx, args):\n+    \"\"\"opens a shell with a library available to try it\n+\n+\n+    pbt try [lib_to_try]        - Install the passed lib in a disposable path, then give you\n+                                  a interactive terminal to try it. (iPython if is installed)\n+\n+\n+    \"\"\"\n+    if len(args) == 1:\n+        pbt_try(args[0])\n+    else:\n+        print('Usage: pbt try [lib_to_try]\\n')\n+\n+\n+def pbt_try(lib_to_try):\n+    \"\"\"opens a shell with a library available to try it\"\"\"\n+    banner='''\\n{0} is installed in a disposable path and ready to test.\n+Maybe you should run \"import {0}\"\\n'''.format(lib_to_try)\n+    exit_msg= '''Do you like this lib? You can add it to your project\n+with \"pbt install {}\"'''.format(lib_to_try)\n+    with tempfile.TemporaryDirectory(prefix='pbt_try_') as tmp_pbt_try_dir:\n+        pbt_try_install(lib_to_try, tmp_pbt_try_dir)\n+        try:\n+            from IPython import embed\n+            embed(banner1=banner, exit_msg=exit_msg)\n+        except ImportError:\n+            print('\\niPython is not available. pbt recommends you install it!\\n')","path":"plugins/try/main.py","position":36,"original_position":36,"commit_id":"ccd27e75d0b7caf5c898637a7787d685ee4ec7e2","original_commit_id":"ccd27e75d0b7caf5c898637a7787d685ee4ec7e2","user":{"login":"jairot","id":1162519,"avatar_url":"https://avatars.githubusercontent.com/u/1162519?","gravatar_id":"4039367d1f6d59b9d3995b435041ea71","url":"https://api.github.com/users/jairot","html_url":"https://github.com/jairot","followers_url":"https://api.github.com/users/jairot/followers","following_url":"https://api.github.com/users/jairot/following{/other_user}","gists_url":"https://api.github.com/users/jairot/gists{/gist_id}","starred_url":"https://api.github.com/users/jairot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jairot/subscriptions","organizations_url":"https://api.github.com/users/jairot/orgs","repos_url":"https://api.github.com/users/jairot/repos","events_url":"https://api.github.com/users/jairot/events{/privacy}","received_events_url":"https://api.github.com/users/jairot/received_events","type":"User","site_admin":false},"body":"I didn't saw that ipython was optional, ignore my comment.","created_at":"2014-05-02T22:26:08Z","updated_at":"2014-05-02T22:26:08Z","html_url":"https://github.com/pebete/pbt/pull/77#discussion_r12250945","pull_request_url":"https://api.github.com/repos/pebete/pbt/pulls/77","_links":{"self":{"href":"https://api.github.com/repos/pebete/pbt/pulls/comments/12250945"},"html":{"href":"https://github.com/pebete/pbt/pull/77#discussion_r12250945"},"pull_request":{"href":"https://api.github.com/repos/pebete/pbt/pulls/77"}}}}