/r/IPython

Photograph via snooOG

If you have a question about IPython, (now Jupyter) the programming language written by scientists for scientists with an eye towards presentation, we want you here. If you have tips, Notebooks you want to share, or you want feedback we want you here. We welcome posts about the all versions of the IPython IDE, plus Markdown and LaTex. We discuss the popular libraries Mathplotlab, SciPy, NumPy, & SymPy. If you want to know about features like embedded video or animation check us out.

IPython (now Jupyter) was originally started by Fernando Perez as a way to improve the Python work flow for scientific computing. Since then it has grown in popularity, and gaining to the ability to make XKCD styled plots using matplotlib hasn't hurt. With new additions like the IPython Notebook, which runs in a browser, and the Notebook Viewer, IPython is a scientist's best friend.


Related subreddits

Useful Libraries


Cloud Services

Official IPython Sites


Official Example Notebooks

Additional Good Examples


Installation

Other Educational Resources

NBViewer Browser Extensions


Additional References


Comment Guidelines

The visitors to /r/IPython come from very different backgrounds and some even have little programming experience. Since this site is primarily here to provide help in the use of IPython, and host discussions about current and future features, make sure that it is clear how comments are relevant to the original post or the previous comment.

/r/IPython

9,958 Subscribers

1

Data analytics

Hi, I’m in a course on data analytics - our teacher keeps saying that we will find our niche within the spectrum of visualisation, machine learning or coding. I’m not sure how that works? Like how are we supposed to get better at visualisation without mastering coding. At times he says coding is important if you are interested in becoming a junior data analyst. how does the job market work? Can someone explain it to me? I’m not sure where my strength lies.

6 Comments
2024/11/05
21:15 UTC

0

Help

Hy guys can you suggest me what is best way to create database for our simulation team ?

So that we can access it whenever we want to check the properties of material.

If we wanna import new material also once validated we can do that also.

Anyone out there to help me out ?

2 Comments
2024/10/31
14:52 UTC

4

Manim : python package for animation for maths

0 Comments
2024/10/25
03:44 UTC

0

How to enable zsh terminal in jupyter when launching from conda environment

So basically I want the terminal that is launched within jupyter (specifically jupyter-lab) to be zsh instead of bash. If I am have not expressed the my querry clearly attached screenshots might help. ss-1: default zsh shell with 'ml0' conda env ss-2 : terminal launched from jupyter-lab uses bash by default and also loses the conda env And my major motive is to preserve the conda environment in the jupyter from which it is launched.

0 Comments
2024/10/14
07:48 UTC

3

Generating nice iPython notebooks diffs with Git pre-commit hooks

https://preview.redd.it/u4e94ccihztd1.png?width=897&format=png&auto=webp&s=28a6d23da591912c6aa712556731798ddbfa9c7c

I like to use iPython notebooks to store experimental code and debugging results, but it's a pain to use version control to look at them.

So I wrote some pre-commit hooks that makes it easy to diff iPython notebooks in Git. It auto-generates a copy of the file with just the Python code, so that you can just inspect code changes.

I wrote a bit more about why here, along with instructions on how to use them: https://blog.moonglow.ai/diffing-ipython-notebook-code-in-git/

And the git repo for the hooks (MIT-licensed) is here: https://github.com/moonglow-ai/pre-commit-hooks

0 Comments
2024/10/10
19:53 UTC

3

Python is awesome! Speed up Pandas point queries by 100x or even 1000x times.

0 Comments
2024/10/06
19:29 UTC

8

ryp: R inside Python

Excited to release ryp, a Python package for running R code inside Python! ryp makes it a breeze to use R packages in your Python projects, and includes out-of-the-box support for inline plotting in Jupyter notebooks.

https://github.com/Wainberg/ryp

2 Comments
2024/10/03
05:15 UTC

3

Converting Jupyter Notebooks to PDF: Exploring Your Options

Converting Jupyter notebooks to PDF can be quite handy, especially when you want to share your analyses with others who may not have Jupyter installed. However, navigating the various options for conversion can be a challenge. I've recently put together a blog post that reviews two popular methods: nbconvert and Quarto.

In the post, I break down the setup process, features, and limitations of each method to help you decide which one might be the best fit for your needs.

nbconvert

nbconvert is the official library from the Jupyter team that's designed for this task. It offers versatility by letting you convert notebooks into formats like PDF through two approaches: WebPDF and the traditional PDF via LaTeX.

The WebPDF method is simpler to set up, while the LaTeX route tends to yield higher-quality documents—ideal for complex mathematical content but comes with more installation hurdles.

Quarto

On the other hand, Quarto provides a comprehensive solution for converting Jupyter notebooks into PDFs, but it does require a bit more effort to get everything working. It’s feature-rich and offers great customization, though the learning curve can be a bit steep.

In my experience, many users start out with nbconvert using WebPDF for quick needs and then graduate to using XeTeX as their requirements grow more sophisticated. Quarto, while powerful, is often suited for those with very specific document formatting needs.

For anyone interested in learning more about these options and their respective setups, you can check out the full details in my blog post here: Converting Jupyter Notebooks to PDF

3 Comments
2024/09/24
17:32 UTC

2

JupyterAI Local LLM Integration

0 Comments
2024/09/16
08:33 UTC

5

Free tool to convert Jupyter notebooks into PDF (new features!)

Converting a notebook using the LaTeX-based converter and hiding the code

Hi r/IPython,

Two years ago, I announced here a tool to convert Jupyter notebooks to PDF for free.

The tool has now converted more than 10,000 notebooks! So I figured I'd add some extra features.

The tool is available at https://convert.ploomber.io

New features

  • I started by adding a LaTeX-based converter, which is great for generating academic reports (previously, it only had a browser-based converter).
  • Switching the configuration now changes the URL, this will make it easier to bookmark your favorite settings. e.g. this link will select the "hide code" option and select the LaTeX-based converter

Ideas

A few ideas I have:

  • Allowing to generate a static URL to see the notebook
  • Add Quarto as a conversion backend
  • Quarto would open a lot of possibilities for advanced formatting, so I thought of adding templates for exporting PDFs (e.g. one column, two columns, add table of contents)
  • Add support for other formats such as HTML and DOCX

Let me know what other things might be useful!

0 Comments
2024/09/13
17:43 UTC

2

Semantix : Make GenAI Functions easily

What Semantix Does

Current methods for extracting structured outputs from LLMs often rely on libraries such as DSPy, OpenAI Structured Outputs, and Langchain JSON Schema. These libraries typically use Pydantic Models to create JSON schemas representing classes, enums, and types. However, this approach can be costly since many LLMs treat each element of the JSON schema (e.g., {}, :, "$") as separate tokens, leading to increased costs due to the numerous tokens present in JSON schemas.

Semantix offers a different and more cost-effective solution. Instead of using JSON schemas, Semantix represents classes, enums, and objects in a more textual manner, reducing the number of tokens and lowering inference costs. Additionally, Semantix leverages Python's built-in typing system with minor modifications to provide meaning to parameters, function signatures, classes, enums, and functions. This approach eliminates the need for unnecessary Pydantic models and various classes for different prompting methods. Semantix also makes it easy for developers to create GenAI-powered functions.

Target Audience

Semantix is designed for developers who have worked with libraries like Langchain and DSPy and are tired of dealing with Pydantic models and JSON schemas. It is also ideal for those who want to add AI features to existing or new applications without learning extensive new libraries.

Comparison

Semantix supports multimodal inputs, allowing you to use images and videos effortlessly. Unlike other libraries, Semantix requires minimal code changes to achieve excellent results.

Ready to give it a try? Check out our Colab notebook here and explore our GitHub repository here for more details.

0 Comments
2024/09/12
13:34 UTC

3

How to visualize python graphs? Using loom

0 Comments
2024/09/08
06:15 UTC

3

Yes another question

when i try to run this command : for label in labels: !mkdir {'Tensorflow/workspace/images/collectedimages//'+label} cap = cv2.VideoCapture(0) print('Collecting images for {}'.format(label)) time.sleep(5) for imgnum in range(number_imgs): ret, frame = cap.read() imagename = os.path.join(IMAGES_PATH, label, label+'.'+'{}.jpg'.format(str(uuid.uuid1()))) cv2.imwrite(imgname, frame) cv2.imshow('frame', frame) time.sleep(2)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()

it shows this error: The syntax of the command is incorrect.

Does anyone know why?

0 Comments
2024/09/07
13:25 UTC

9

nb2dash: Convert Jupyter notebooks to interactive dashboards with WASM

Hey r/ipython! Today, I'm lauching nb2dash, a tool to convert Jupyter notebooks into dashboards, and I'd love to get your feedback.

https://nb2dash.ploomberapp.io

You can see a sample dashboard here: https://nb2dash.ploomberapp.io/notebook/bb8086c0

https://reddit.com/link/1f9rajw/video/hr40j3dht0nd1/player

What it does

  • Upload your Jupyter notebook (.ipynb file)
  • Get back a link to an interactive dashboard version of your notebook

Target Audience

Data practitioners who want to easily share an interactive analysis, machine learning model or any other interactive app.

Key features

  • Free to use: No sign-up required
  • Easy: Just drag and drop your notebook file
  • Quick: Processing usually takes 1-2 minutes
  • Shareable: Get a link you can send to anyone

Tech stack

  • Flask for the web app (receive uploads and process notebook)
  • NGINX for rendering processed notebooks
  • Voici for converting notebooks into standalone WASM pages
  • Redis and rq for task queueing

Comparison

When people want to share a notebook, they often convert it into HTML or PDF. However, this is hinders interactivity. Alternatively, you might use Voila to deploy it as a web app but that requires paying to a hosting provider. Voici uses WASM, meaning your notebook is a static site and all compute happens locally, reducing cost by a huge margin. Note that WASM and Voici are still early technologies and there are packages that won't work.

I'd really appreciate it if you could try it out and let me know what you think. Any feedback, feature requests, or bug reports are welcome!

(Note: This is a side project, so please be patient if there are any hiccups. I'm actively working on improvements!)

1 Comment
2024/09/05
16:53 UTC

2

One more Question

in jupyter notebook when i try to save a photo for object detection it shows this error:

<string>:1: SyntaxWarning: invalid escape sequence '\w'

even when i try to set variables

Does anyone know the reason?

2 Comments
2024/09/05
13:01 UTC

0

Hello guys i need help with something I'm using jupyter notebook for object detection but when i use this code: if cv2.waitkey(1) & 0xFF == ord('q'): break it shows this error: module 'cv2' has no attribute 'waitkey' Does anyone know why?

4 Comments
2024/09/04
18:31 UTC

5

Created CLI that writes your semantic commit messages in git and more.

I've created CLI, a tool that generates semantic commit messages in Git

Here's a breakdown:

What My Project Does Penify CLI is a command-line tool that:

  1. Automatically generates semantic commit messages based on your staged changes.
  2. Generates documentation for specified files or folders.
  3. Hooks: If you wish to automate documentation generation

Key features:

  • penify-cli commit: Commits code with an auto-generated semantic message for staged files.
  • penify-cli doc-gen: Generates documentation for specified files/folders.

Installation: pip install penify-cli

Target Audience Penify CLI is aimed at developers who want to:

  • Maintain consistent, meaningful commit messages without the mental overhead.
  • Quickly generate documentation for their codebase. It's suitable for both personal projects and professional development environments where consistent commit practices are valued.

Comparison Github-Copilot, aicommit:

  • Penify CLI generates semantic commit messages automatically, reducing manual input. None does.
  • It integrates documentation generation, combining two common developer tasks in one tool.

Note: Currently requires signup at Penify (we're working on Ollama integration for local use).

Check it out:

I'd love to hear your thoughts and feedback!

0 Comments
2024/08/29
19:30 UTC

2

python libraries

1 Comment
2024/08/22
23:27 UTC

3

Moonglow: Start and stop remote iPython servers from VSCode

Hi all - wanted to post about my project Moonglow here as I thought it might be interesting to people!

It's a VSCode extension that lets you start and stop remote servers without leaving your editor. Right now you can connect to Runpod and AWS; the extension will take care of starting and stopping the remote instances, and will also set up the connection from your iPython notebook to the remote kernel.

Here's demo video of how it works! You can check it out at http://moonglow.ai .

https://reddit.com/link/1et9qx6/video/f5egjtcrvwid1/player

0 Comments
2024/08/15
23:24 UTC

2

How to convert ipynb to pdf inside Jupyter notebook? I came across a solution stating we need to install pandoc but the official pandoc redirects us to the GitHub files which one to download now ??

3 Comments
2024/08/09
17:21 UTC

Back To Top