12 ms·
IPython 8.0
- carreau 5y agoAnd I'm in the comments if you have any questions/feedback.
- tomrod 5y agoKudos!
- carreau 5y agoThanks ! Hope you will enjoy.
- kzrdude 5y agoThanks for fixing :)
- caddybox 5y agoJust wanted to say Thanks for this amazing project! IlBeen using it for years now and for simple debugging and peeking into data files, nothing beats IPython in convenience!
- carreau 5y agoThanks ! I invite you to also read the 7.x what's new as well. The debugger got a few improvements sponsored by D.E Shaw group (hiding and skipping frames for example). Hope to have you contribute some code at some point, if not already.
- bulibuta 5y agoThank you very much for your efforts! I haven't seen this mentioned in the release notes, but does this fix the remaining automatic module reload issues? Do I still have to restart IPython whenever I modify a module?
- carreau 5y agoThere is the %autoreload magic but it is limited, it will often fail to reload compiled modules like numpy. So there is not a single answer, sometime it works, other times it does not.
- lenzm 5y agoThanks, this is one of the tools that makes the Python experience so usable.
- carreau 5y agoHappy to help
- deleted 5y ago[deleted]
- anentropic 5y agoGreat write up! A small typo here (in the companion blog post https://labs.quansight.org/blog/2022/01/ipython-8.0-lessons-learned-maintaining-software/ https://labs.quansight.org/blog/2022/01/ipython-8.0-lessons-...) I think: > Python has multiline strings with triple backticks I think this should say "quote marks" instead of "backticks" since backticks are a different char, Python strings use single- or double-quote char, and three of them delimits a multiline string.
- carreau 5y agoThanks ! And indeed, fixed on the repo, should autodeploy in a few minutes.
- eirki 5y agoAlso chiming in to say thanks for the good work! This looks like an amazing release - I practically jumped in excitement when I saw the fish style autocomplete.
- carreau 5y agoThanks, it's a late Christmas present if you celebrate it. Or any other relevant occasions.
- pm90 5y agoI'm going to break the HN rule of comments not having meaningful content just to say: thanks for this work. IPython was what I used when I started programming for "fun"; its so easy and helpful for beginners. I'm glad to see its still actively developed and has expanded in scope so much (initially it was mostly used by the academic community before expanding into data science).
- carreau 5y agoThanks, fun fact, IPython is one of the first project as started to contribute to when doing my PhD and one of my first "serious" python programs. See my first PR https://github.com/ipython/ipython/pull/776 https://github.com/ipython/ipython/pull/776. GitHub lost some of the original (non-rebased) commits, but I had semicolon at the ends of the lines. And yes I stayed because it was "Fun". Hope to see more contributions !
- onphonenow 5y agoBlack in there as a linter - I’ve had hood experiences with that
- carreau 5y agoIt's actually already present in 7.x, just opt-in. And you should be able to hook any formatter you want, black just appear to be popular.
- cyode 5y agoWhat's a hood experience?
- carreau 5y agoIt's like when programmers put their black hoodies on to become hackers, and type so fast they swap G and H. Like you've seen Mr Robot ?
- onphonenow 5y agohaha . Too late for the edit unfortunately.
- danjac 5y agoNo problem with Black per se - it's my default linter - but latest inclusion with IPython 8.0 seems to break in a Docker environment: Generating grammar tables from /usr/local/lib/python3.10/site-packages/blib2to3/Grammar.txt Writing grammar tables to /root/.cache/black/21.12b0/Grammar3.10.1.final.0.pickle Writing failed: [Errno 2] No such file or directory: '/root/.cache/black/21.12b0/tmpx51kjom5' Generating grammar tables from /usr/local/lib/python3.10/site-packages/blib2to3/PatternGrammar.txt Writing grammar tables to /root/.cache/black/21.12b0/PatternGrammar3.10.1.final.0.pickle Writing failed: [Errno 2] No such file or directory: '/root/.cache/black/21.12b0/tmp80hsbuff I believe this is the issue: https://github.com/psf/black/issues/1143 https://github.com/psf/black/issues/1143 Not entirely clear what the reasons are for adding the Black dependency to IPython....
- deleted 5y ago[deleted]
- Takizawamura 5y ago"Tracebacks now highlight in which AST node the error occurs." Can you describe in simple terms how the AST works?
- carreau 5y agoAST in a more general concept see https://en.wikipedia.org/wiki/Abstract_syntax_tree https://en.wikipedia.org/wiki/Abstract_syntax_tree, it basically turn your text into a tree where f(a) + f(b) is `call(plus, call(f, a), call(f,b))`. Using https://github.com/alexmojaki/stack_data https://github.com/alexmojaki/stack_data we can say "the error occurred in `a`, while trying to call `f`, while calling `plus`, get the range in the original text and make them yellow.
- jarpineh 5y agoYes. Good things here in the big list [1]. Fish style auto completion and traceback improvements are especially welcome. I find myself reaching for IPython more readily than browser Jupyter. REPL just feels better for control, though you can't beat browser for visuals. In that vein I have probably somewhat obscure question, but since OP is here I thought I'd give it a shot. I'd like to use Unix shell in concert with IPython. I'd send data to IPython kernel from zsh terminal sessions and call functions get data back. This data I could then send to Visidata or browser for bespoke visualization. Or whatever else is available in the shell. I think Jupyter's messaging protocol kind of allows this, but I haven't managed to grasp the fine details enough to get anywhere. I can get to shell from IPython, but from the outside this REPL isn't accessible from the Unix "REPL". [1] https://ipython.readthedocs.io/en/latest/whatsnew/version8.html#ipython-8-0 https://ipython.readthedocs.io/en/latest/whatsnew/version8.h...
- carreau 5y agoYou likely want to use something like https://github.com/jupyter/jupyter_console https://github.com/jupyter/jupyter_console, or ipykernel directly to have a persistent python process. One issue is that shells are text based, so you have to do a lot of serialisation/deserialisation. But honestly at that point I would just look into https://xon.sh/ https://xon.sh/ that blends Python and Shell together. IPython and Xonsh devs are friends, so if you need anything from one into the other it's likely doable.
- jarpineh 5y agoThing is, I like my zsh. Sometimes I use Nu shell as well, which does structured data better. Serialization I think needs to happen anyway to get data into IPython from outside. I have tried Xonsh once or twice, but it was too large change. Unix shell does some things very well, Python I like to use for other things. It is the crossover I’d like to smooth out. I am confused on what having a persistent Python process means in this context. Isn’t IPython already that? Jupyter console states it’s a single process IPython terminal. That does leave me wondering what is different when I start IPython vs Jupyter console. I might have assumed years ago that they are mutually exclusive…
- _coveredInBees 5y agoExcited about this and have been a big fan of iPython since when I started coding in Python well over a decade ago. Might be a little while for switching to v8 due to the minimum 3.8+ version requirement for Python (which I totally understand from an ease of maintenance and forward looking mindset for the iPython projet). I use it all the time as my go-to REPL in Pycharm. Thanks to the team for all the work on it! As an aside, I really wish the VSCode team did more to integrate iPython REPL more seamlessly into VSCode as that is one of the big blockers for me to using VSCode for anything Python related.
- carreau 5y agoThanks, in particular for your understanding with Python 3.8. It's in huge part to give a signal to businesses that that can/should move forward, and to give reasons for "smaller" projects with fewer devs to also remove support for older Python which can be a burden to maintain. I don't use VS Code myself, but I think the team is doing in increasingly better job, Microsoft is just a huge beast. I would also love for some IPython feature to get into Core Python. But that might just take time as I don't think many Core Python Dev do that much interactive coding, and thus don't see that much the interest of doing so. BTW it's uppercase I and P, we don't want to be in trouble with a billion dollar fruit company, even if we predate their use of iPxxxx
- nurettin 5y agoI really enjoy bpython as my go-to python repl. Its django support and autocomplete is out of this world and the way it displays doc sections while using functions is really useful. Will take a look and compare ipython 8.0
- carreau 5y agoYes, bpython is good. I have plans to make the documentation better (https://github.com/jupyter/papyri https://github.com/jupyter/papyri) but so far I only have a few hours per week I can spend on IPython. Jedi from david halter should also get some love for better completion.
- jonbaer 5y agoI really wish ipython and bpython would have a baby.
- kbd 5y agoI’ve been using ptpython for a while because of its autocompletions. Really excited for that to come to ipython, but from a quick comparison ptpython’s still seems a bit better. You get automatic dropdowns where you have to hit tab in ipython (though it does seem faster than it used to be), and ptpython favors autocompleting arguments in the function signature. IPython is more robust in various ways than ptpython so I’d prefer to switch back but maybe it still needs a bit of improvement. Open to suggestions if there is configuration I’m missing. Seems like a great release though with tons of code cleanup.
- carreau 5y agoYeah, mostly I lack time to catch up with Jonathan Slenders works, and have stronger backward compatibility requirements. b=But ptpython and pyipython are both great. I should also look into Rich and Textual https://bpython-interpreter.org/ https://bpython-interpreter.org/ is also another alternative python shell, and of course https://xon.sh https://xon.sh
- gaff33 5y agoI work with a bunch of 'data scientists' / 'strategists' and the like who love their notebooks but it's a pain to convert their code into an application! In particular: * Notebooks store code and data together, which is very messy if you want to look at [only] code history in git. * It's hard to turn a notebook into an assertive test. * Converting a notebook function into a python module basically involves cutting and pasting from the notebook into a .py file. These must be common issues for anyone working in this area. Are there any guides on best practices for bridging from notebooks to applications? Ideally I'd want to build a python application that's managed via git, but some modules / functions are lifted exactly from notebooks.
- mbot5324 5y agoTo your painpoints: 1) This is painful. There are tools to help, but the most effective means I've found are having a policy to only commit notebooks in a reset, clean state (enforced with githook). 2) I don't understand. I've written full testing frameworks for applications as notebooks as a means of having code documentation that enforced/tested the non-programmatic statements in the document. Using tools like papermill (https://papermill.readthedocs.io/en/latest/ https://papermill.readthedocs.io/en/latest/), you can easily write a unit test as a notebook with a whole host of documentation around what it's doing, execute, and inspect the result (failed execution vs. final state of the notebook vs. whatever you want) 3) Projects like ipynb (https://ipynb.readthedocs.io/en/stable/ https://ipynb.readthedocs.io/en/stable/) allow you to import notebooks as if they were python modules. Some projects have different opinions of what that means to match different use cases. Papermill allows you have an interface with a notebook that is more like a system call than importing a module. I've personally used papermill and ipynb and found both enjoyable for different flavors of blending applications and notebooks.
- carreau 5y agoFirst, yes, this is a common question. IPython does not try to deal with that, it's just the executing engine. Notebooks, do not have to be stored in ipynb form, I would suggest to look at https://github.com/mwouts/jupytext https://github.com/mwouts/jupytext, and notebook UI is inherently not design for multi-file and application developpement. So training humans will always be necessary. Technically Jupyter Notebook does not even care that notebooks are files, you could save then using say postgres (https://github.com/quantopian/pgcontents https://github.com/quantopian/pgcontents) , and even sync content between notebooks. I'm not too well informed anymore on this particular topic, but there are other folks at https://www.quansight.com/ https://www.quansight.com/ that might be more aware, you can also ask on discourse.jupyter.org, I'm pretty sure you can find threads on those issues. I think on the Jupyter side we could do a better job curating and exposing many tools to help with that, but there are just so many hours in the day... I also recommend I don't like notebook from Joel Grus, https://www.youtube.com/watch?v=7jiPeIFXb6U https://www.youtube.com/watch?v=7jiPeIFXb6U it's a really funny talk, a lot of the points are IMHO invalid as Joel is misinformed on how things can be configured, but still a great watch.
- xtreak29 5y agoThanks for the release. I just upgraded and error messages are really nice. One bit I might be missing is that Python 3.10 added suggestions for AttributeError and NameError. It seems the suggestions are not stored in the exception object but calculated when Error is displayed. There is a note that that this won't work with IPython but it will be good to check if it's feasible. https://bugs.python.org/issue38530 https://bugs.python.org/issue38530 https://docs.python.org/3/whatsnew/3.10.html#attributeerrors https://docs.python.org/3/whatsnew/3.10.html#attributeerrors
- aroberge 5y agoOne way might be to do like what IDLE does (I think) which is to essentially print the traceback to a string and extract the information. An alternative is to use https://friendly-traceback.github.io/docs/index.html https://friendly-traceback.github.io/docs/index.html which gets even more information than Python 3.10 does and is compatible with IPython/Jupyter.
- carreau 5y agoIt's probably feasible, I need to look into how the suggestion is stored and display it. You seem to have looked into it more than I, do you want to open an issue with your thoughts ? I'm also hopping to integrate with https://pypi.org/project/friendly-traceback/ https://pypi.org/project/friendly-traceback/ at some point.
- xtreak29 5y agoThanks, opened an issue for discussion : https://github.com/ipython/ipython/issues/13445 https://github.com/ipython/ipython/issues/13445
- ulnarkressty 5y agoJupyter notebooks are a favorite among our data scientists. However, we have gone back to plain python scripts for our bigger projects due to a simple reason - one must keep alive the notebook page while running lengthy experiments on a remote server. Due to some rogue windows updates we had a couple of destroyed experiments, which (as these things go), happened at a very inopportune moment. OTOH for quick experiments notebooks are great, although I feel like the more modern the GUI the farther back we go in terms of experience. The latest updates to visual studio code's Jupyter extension for example have turned this into a thoroughly frustrating experience for the visually impaired - gray-on-gray-on-gray text and even more gray and transparent thin lines that are supposed to clearly mark where a cell ends and where the output begins. Unfortunately no amount of fiddling with the color scheme could fix these 'design' choices...
- Jugurtha 5y ago>However, we have gone back to plain python scripts for our bigger projects due to a simple reason - one must keep alive the notebook page while running lengthy experiments on a remote server. Known issue (it's a six year old issue IIRC). They're working on it if I'm not mistaken. They're also working on real-time collaboration. Plug: We have long-running notebook scheduling in the background and the output is streamed and saved whether you close your browser or visit from another device. We run the notebooks on your own Kubernetes cluster on GCP's GKE, AWS' EKS, Azure's AKS, DigitalOcean, and pretty much anything. https://iko.ai/static/assets/img/landing/async-notebook-on-cluster.gif https://iko.ai/static/assets/img/landing/async-notebook-on-c... The run saves everything as an experiment: it automatically detects model parameters without tagging cells, tinkering with metadata, or you calling a tracking library. We also automatically detect the model that is produced, and the model's metrics (again, without you doing anything). Show HN: https://news.ycombinator.com/item?id=29450940 https://news.ycombinator.com/item?id=29450940
- ehvatum 5y ago> Due to some rogue windows updates we had a couple of destroyed experiments, which (as these things go), happened at a very inopportune moment. PSA: on all process control equipment running Windows 10, install O&O shutup10 and enable the default set of disablements. Finding out that an incubator has been sitting there baking $300,000 of Andor cameras for 61 hours while the organism library died because the Windows 10 box running the Python control stack decided to update: it’s a bad time. https://www.oo-software.com/en/shutup10 https://www.oo-software.com/en/shutup10
- pattt 5y agoAny recommended workflow of integrating IPython and vim in 2022 preferably being able to edit the notebooks, execute cells etc.? Currently this is one of the few reasons why I’m running a full-blown IDE with Jupyter integration. A mature plugin for integration having similar qualities to, say, Fugitive, would be vim users dream I suppose.
- jknz 5y agoStart a jupyterqtconsole and use vim-jupyter. With vim and the qtconsole side by side you can send lines and selections (or entire cells delimited with #%%) to execute in the qtconsole. Plots appear in the qtconsole.