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

IPython integration #51

Open
guaka opened this issue Jul 27, 2014 · 9 comments
Open

IPython integration #51

guaka opened this issue Jul 27, 2014 · 9 comments
Milestone

Comments

@guaka
Copy link

guaka commented Jul 27, 2014

I'm very happy I just bumped into this project. I'm also a very happy IPython user.

Is there a way to get erppeek inside ipython? (or vice versa)

@florentx
Copy link
Member

I have no idea, since I am not an IPython user myself.
I welcome your own feedback.

@guaka
Copy link
Author

guaka commented Jul 27, 2014

I started hacking towards this, by copying main() into another file and adapting it so that it returns global_vars. If I manage to get these global_vars in the IPython environment it would be quite workable.

Another approach is to let erppeek check for the presence of IPython and in that case use that as an alternative to erppeek._interact().

@takluyver
Copy link

I think what you want is something like this:

try:
    import IPython
    return IPython.start_ipython(user_ns=global_vars)
except ImportError:
   pass # Continue to set up a basic shell if IPython isn't installed

@guaka
Copy link
Author

guaka commented Jul 29, 2014

Excellent! It worked after I added a line for handling argv.

    try:
        import IPython
        sys.argv = [sys.argv[0]]
        return IPython.start_ipython(user_ns=global_vars)
    except ImportError:
        pass # Continue to set up a basic shell if IPython isn't installed

@takluyver
Copy link

You can also pass argv=sys.argv[:1] into start_ipython() - that will prevent IPython from trying to parse your programs arguments, but if the user inspects sys.argv, they'll still see the original value.

guaka pushed a commit to guaka/erppeek that referenced this issue Jul 29, 2014
this is presuming that people who have IPython installed also want to use IPython, maybe there should be an option to turn off IPython?
@guaka
Copy link
Author

guaka commented Jul 29, 2014

Nice, but unfortunately erppeek exits without any feedback when I try IPython.start_ipython(user_ns=global_vars, argv=sys.argv[:1])

@takluyver
Copy link

Oh, sorry, it should be just argv=[] (i.e. an empty list).

guaka pushed a commit to guaka/erppeek that referenced this issue Jul 29, 2014
@guaka
Copy link
Author

guaka commented Sep 19, 2014

@florentx you could replace the [question] label with the [enhancement] label :)

@florentx
Copy link
Member

Please confirm that 1.6 gives enough flexibility for IPython.

I have posted details on pull request #62 ...
You can contribute an addition to the documentation, if it works.

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

No branches or pull requests

3 participants