-
Notifications
You must be signed in to change notification settings - Fork 319
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
make plot updates work outside ipython notebook #155
Conversation
Cool! Is there a similar test that positively identifies Spyder? It can certainly do some (graphical) things that you can't do from ipython running in a bare terminal, so it would be nice to configure our plots to reflect this. What I would love to do is:
|
return True | ||
else: | ||
return False | ||
except NameError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may also need AttributeError
in case get_ipython()
is defined but returns None
? And to play devil's advocate conceivably KeyError
(though it looks like unless get_ipython()
radically changes its API you can supply garbage keys with no error)
@alexcjohnson I added the helper function for Spyder. Checking whether we are in a notebook environment is not really possible it seems. We can check whether we are running in The |
@peendebak the design of ipython "forbids" to know if there is any, and which kind of frontend. (The techincal details are kind of very low level, but I can give you some if you want ❤️ ). The IPython, actually the Jupyter, team suggests always to write code independent from the frontend when you are writing a module, else you can introduce subtle bugs (especially on different platforms). |
@alexcjohnson Is merging this PR possible? If not I will make a smaller PR that prevents the |
@eendebakpt sorry for letting this languish. Unfortunately I could not make this work correctly in notebooks - including bringing back your @giulioungaretti it must be kosher to tell the system what front end it's running in, yes? ie I'm thinking we should move to a system where instead of trying to infer the environment, the user specifies it. So instead of: import qcodes as qc
qc.show_subprocess_widget() we do: import qcodes as qc
qc.init_jupyter()
# maybe optional args for whether we want a subprocess widget,
# and whatever other stuff we create later... these options can also go in
# a config file once we make such a system. and a similar one in spyder: import qcodes as qc
qc.init_spyder() and if you don't call any of the |
Sounds reasonable. I think that if would be safe to allow a reasonable subset of the features if none of the If we do find a good method to detect our system, then we can always make either |
It'll be allowed regardless, by explicitly calling |
Here is an overview of what got changed by this pull request: Issues
======
- Added 1
See the complete overview on Codacy |
"""Return True if we are running in an IPython / Jupyter notebook.""" | ||
try: | ||
cfg = get_ipython().config | ||
if cfg['IPKernelApp']['parent_appname'] == 'ipython-notebook': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MerlinSmiles @eendebakpt this is superseed by the new config options and #290 . |
This PR makes plot updates work when working outside ipython notebook.
Current approach is to duplicate the functionality. Another option would be to perform the updates without the notebook functionality. Note: using ipython is fine with me, but I would like to run my code outside the notebook.