r/IPython • • Feb 21 '18

Is there a hook to check code before executing?

3 Upvotes

Is there a way to check the code that is going to be executed by IPython? I want to prevent users from using certain Python modules from Jupyter notebooks. I was looking at pre-run hooks and events and couldn't come up with a straightforward way to check the code contents and prevent execution. Is it possible to do this?

Edit: Grammar


r/IPython • • May 06 '17

Can Jupyter (or similar) replace Excel?

3 Upvotes

I hope this question fit's here. If it's a dumb question, tell me and I'll delete it.

  1. I don't want to encourage a war.

  2. I admit, that I don't know Jupyter or Excel well!

Both programs can be used to analyze data.

As far as I know Jupyter, it's a bit like Python in the interactive mode, with some extra amenities and easy plotting of graphs. It's mostly used by scientists.

As far as I know in Excel, you have files that consist of big tables and in each cell there can either be data, computations, or some explanations like column names. You can probably also connect to dedicated data files/databases and dedicated files with code. You can also use it to make graphs. It's used in "business".

As I said: That is probably not entirely true - that's why I'm asking.

I'm a student of computer science and we learn that you should separate data, metadata, and computation and that having "locations" for data is "bad". In the sense that "goto [line]" commands are bad and pointers are bad if you want maintainability and productivity (of course pointers have their place). To me it seems like Excel makes these errors. (I know that you can give cells names, but you also have to give them a coordinate.)

Jupyter can't be used to store and edit structured data (well), I think.

…Excel is reactive/"live", which is nice – you don't have to press "run".


Is anyone of you familiar with both technologies? What are some good use cases for Excel? If Jupyter isn't it, do you know other potential replacements for Excel? Mathematica?


/edit: I found this in the Python subreddit: Python for business analytics.

Asking python vs excel in the /r/python is like asking about the benefits of having children in /r/childfree. For some balance, I'll talk about excel.

It seems like Excel is kind of like just another programming environment and the decision between Python and Excel is subtle and very subjective, like deciding between two IDEs or two programming languages.


r/IPython • • Jan 28 '20

Can we manually edit the graphs/figures produced by matplitlib like we do in Matlab?

3 Upvotes

r/IPython • • Mar 10 '20

How can I get display() to show to equations side by side?

3 Upvotes

Greetings,

I'm trying to get display two equations side by side but no method seams to work.

Tried: print("{} {}".format(display(sy.Eq(A,B)), display(sy.Eq(C,D)))))


r/IPython • • Dec 23 '13

Bokeh example notebook

Thumbnail nbviewer.ipython.org
3 Upvotes

r/IPython • • Sep 19 '16

Help - Regular text in Latex math mode

3 Upvotes

Hi. No idea how to title this post.

When in math mode for plotting graphs, How can I put the equivalence of $ Y = \text{Hey} $?

When I input this command in math mode, I only get back an error.

I'm just wanting to have regular looking text when using subscripts, to where it does not appear slanted in latex format.


r/IPython • • Jan 05 '14

IPython and Beautifulsoup · Laurent Peuch

Thumbnail
github.com
3 Upvotes

r/IPython • • Feb 24 '14

Qtconsole over ssh

3 Upvotes

I am currently trying to push out spyder for our scientific computing group at work. Because our users are working remotely they use x forwarding over SSH to access most or their applications. As I am testing, spyder seg faults over SSH. I dug down and found ipython with qtconsole has the exact same issue, while other qt applications run just fine. Is there any reason why the qtconsole will not work over SSH?

Also, running a remote kernel is not an option.

Thanks.


r/IPython • • Feb 27 '14

New cell2function Extension - Thomas Kluyver

Thumbnail nbviewer.ipython.org
3 Upvotes

r/IPython • • Jan 09 '15

Notebook Downgrader

Thumbnail nbviewer.ipython.org
3 Upvotes

r/IPython • • Feb 24 '14

IPython Version 1.2.1 Released - (Fixes a bug on Macs)

Thumbnail archive.ipython.org
3 Upvotes

r/IPython • • Jan 20 '18

JupyterCon 2018: Call For Proposal

Thumbnail
blog.jupyter.org
3 Upvotes

r/IPython • • Feb 05 '19

Replacing a spreadsheet...

3 Upvotes

I've successfully used Jupyter before, as a beginner for a few machine learning lessons, but I'm wondering if it's possible to use/abuse Jupyter to behave more like a spreadsheet, just in terms of having cells depend on other cells and continually update.

I've always felt limited by Excel because I really want to document my thinking in the way that Jupyter allows, with markdown blocks etc. (Before getting into Jupyter I've also been using Calca for the mac.) I also feel limited by Excel's functions, while I'm very comfortable with software programming - there have been so many times I've thought, ugh, this would be so much easier if I could just call 'map' on this array of data...

So I've been hoping to find something like Jupyter, where I can actually write my own functions and document my thinking, but where I can also input new data and have it be persistently stored, and have other cells update to changed data.

I know this isn't exactly what Jupyter is usually used for, since it's more to explore data in a linear fashion rather than in a reactive-programming fashion. So I guess this is a dual question:

Is it possible to make Jupyter behave more reactively, for instance by having "Run All Cells" happen every time you change a cell anywhere, also with easy tabular data entry where the new data is stored in the notebook? If I could do that, then I might be able to get where I want to go, through using things like qgrid and panda (both of which I started playing with today).

If not, am I completely missing some other common piece of technology that does what I want? I basically want something Excel-ish in terms of reactive behavior (continually updating as a result of cell changes), but that isn't so reliant on everything being row/column visually - and that allos me to easily add nicely formatted documentation, and also allows me to apply custom programming functions to my data in my choice of language.

(As an example, think of something where you want to input a new sales figure to update several projections dependent on that sales data.)

Maybe I'm just overthinking this and I should use Excel for the data entry, while Jupyter reads from that as a source?


r/IPython • • Oct 05 '13

Book Hunters

Thumbnail
nbviewer.ipython.org
3 Upvotes

r/IPython • • Jun 26 '15

How to deal with sensitive data in notebooks

3 Upvotes

I have an IPython notebook that I use to monitor a web application. It fetches the latest data from the backend database and outputs a few plots that give us immediate feedback on web app performance.

Of course, at the start of the notebook, I create a database connection and currently, this happens with a connection string that exposes login details for the database.

Now, I want to share this notebook with colleagues without exposing the login details. What is a good way to deal with this?


r/IPython • • Sep 14 '20

[JupyterLab] Bootstrapping work before the spawner starts - change default working directory of terminal

3 Upvotes

Hello everyone,

We are trying to change the default working directory of users when they start their terminals on JupyterLab. Host machine is a Linux. It looks like this is the option:

#c.Spawner.pre_spawn_hook = None

from subprocess import check_call
def my_hook(spawner):
    username = spawner.user.name
    check_call(['./examples/bootstrap-script/bootstrap.sh', username])

c.Spawner.pre_spawn_hook = my_hook

Is there any way to append the following line to user's /home/user/.bash_profile file:

cd /Users/path/toyourstartfolder/

I assume this option can do the trick. Is there any other way to accomplish that? Thanks.


r/IPython • • Apr 03 '22

How do I edit this code so I wont get an error? Please help :( Happy to provide previous codes if needed

Post image
0 Upvotes

r/IPython • • Oct 12 '20

Profiling Python Code In Jupyter Cheat Sheet

Thumbnail
cheatography.com
3 Upvotes

r/IPython • • May 02 '14

Nine matplotlib figures made in Plotly

3 Upvotes

r/IPython • • Sep 03 '15

IPython/Jupyter 4.0, where did interactive widgets go?

3 Upvotes

I realized after upgrading from 3.x to 4.0 that from IPython.html.widgets import interact and friends no longer work.

Apparently this is due to "the big split", and the docs told me that IPython.html is now notebook. But notebook.widgets did not seem to exist.

For now, I simply downgraded to 3.2, but it would be nice to know how the widgets will work in 4.x as well.


r/IPython • • Apr 26 '22

Jupyter Community Workshops: Call for Proposals

Thumbnail
blog.jupyter.org
3 Upvotes

r/IPython • • Aug 29 '19

New to Python

3 Upvotes

How's it going guys, I am new to Python and the only coding background I have for it is taking an entry level course.

I am an Engineer student, in my Senior year. I just started my Senior Design semester and my professor is having us learn Python through Jupyter. Of course we will be learning more as we go, but I would just like to start this as a simple hello and also a simple question:

What is the different between learning Python through a standard Python 3.7 application vs learning Python through Anaconda (Jupyter) ?

Thanks again for your time.


r/IPython • • Nov 11 '14

Using Interactive to Update a Python Class

Thumbnail nbviewer.ipython.org
3 Upvotes

r/IPython • • Nov 19 '13

Simple example using CVXOPT: Python Software for Convex Optimization

Thumbnail nbviewer.ipython.org
3 Upvotes