wxPython: How to Open a Second Window / Frame

I see questions relating to the title of this article a lot. How do I open a second frame / window? How do I get all the frames to close when I close the main application? When you are first learning wxPython, these kinds of questions can be kind of hard to find answers for as you aren’t familiar enough with the framework or the terminology to know how to search for the answers.

Hopefully this article will help. We will learn how to open multiple frames and how to make them all close too. Let’s get started! Continue reading wxPython: How to Open a Second Window / Frame

Jupyter Notebook Debugging

Debugging is an important concept. The concept of debugging is trying to figure out what is wrong with your code or just trying to understand the code. There are many times where I will come to unfamiliar code and I will need to step through it in a debugger to grasp how it works. Most Python IDEs have good debuggers built into them. I personally like Wing IDE for instance. Others like PyCharm or PyDev. But what if you want to debug the code in your Jupyter Notebook? How does that work?

In this chapter we will look at a couple of different methods of debugging a Notebook. The first one is by using Python’s own pdb module. Continue reading Jupyter Notebook Debugging

Testing Jupyter Notebooks

The more you do programming, the more you will here about how you should test your code. You will hear about things like Extreme Programming and Test Driven Development (TDD). These are great ways to create quality code. But how does testing fit in with Jupyter? Frankly, it really doesn’t. If you want to test your code properly, you should write your code outside of Jupyter and import it into cells if you need to. This allows you to use Python’s unittest module or py.test to write tests for your code separately from Jupyter. This will also let you add on test runners like nose or put your code into a Continuous Integration setup using something like Travis CI or Jenkins.

However all is now lost. You can do some testing of your Jupyter Notebooks even though you won’t have the full flexibility that you would get from keeping your code separate. We will look at some ideas that you can use to do some basic testing with Jupyter. Continue reading Testing Jupyter Notebooks

PyDev of the Week: Marc Garcia

This week we welcome Marc Garcia (@datapythonista) as our PyDev of the Week! Marc is a core developer of pandas, a Python data analysis library. If you’d like to know more about Marc, you can check out his website which has links to his talks that he has given at PyData in Europe as well as talks at EuroPython.

In fact, here is one of his talks on pandas in case you are interested:

You can also see what projects he is a part of over on Github. Now, let’s take some time to get to know Marc!

Can you tell us a little about yourself (hobbies, education, etc):

My background is in computer engineering, with a master’s degree in AI. I wrote my first program when I was 9, and not many years later I learned about free software, and I still think it’s one of the most amazing achievements of humanity.

I’ve been working professionally with Python for more than 10 years, and this year I became a Python fellow. I’m a pandas core developer, and been involved in the Python community almost since I started coding in Python.

I started as a regular of the Barcelona Python meetup when we were less than 10 members in the events. I contributed to Django before it reached its 1.0. I was one of the founders of PyData Mallorca. I was a NumFOCUS ambassador. I speak regularly to PyCon and PyData conferences. And I organize the London Python Sprints group, where we mentor people who wants to contribute to open source Python projects. Most people know me for leading the pandas documentation sprint, a worldwide event last March, in which around 500 people worked on improving the pandas documentation. Around 300 pull requests were sent, I still need to review and merge some of them. 🙂

Regarding hobbies, I love hiking, travelling, yoga, playing tennis, dancing forro, playing djembe drums, and watching Bollywood movies. I don’t have time to do all that regularly, but hopefully I will at some point. Continue reading PyDev of the Week: Marc Garcia

How to Export Jupyter Notebooks into Other Formats

When working with Jupyter Notebook, you will find yourself needing to distribute your Notebook as something other than a Notebook file. The most likely reason is that you want to share the content of your Notebook to non-technical users that don’t want to install Python or the other dependencies necessary to use your Notebook. The most popular solution for exporting your Notebook into other formats is the built-in nbconvert tool. You can use nbconvert to export to the following formats:

  • HTML (–to html)
  • LaTeX (–to latex)
  • PDF (–to pdf)
  • Reveal JS (–to slides)
  • Markdown (md) (–to markdown)
  • ReStructured Text (rst) (–to rst)
  • executable script (–to script)

The nbconvert tool uses Jinja templates to convert your Notebook files (.ipynb) to these other static formats. Jinja is a template engine for Python. The nbconvert tool depends on Pandoc and TeX for some of the conversions that it does. You may need to install these separately on your machine. This is documented on ReadTheDocs. Continue reading How to Export Jupyter Notebooks into Other Formats

PyDev of the Week: K Lars Lohn

This week we welcome K Lars Lohn (@2braids) as our PyDev of the Week! He has been a part of the Python community for quite a few years. You can learn a bit more about him over on his blog or by checking out his Github account. Let’s spend some time getting to know him a bit more!

Can you tell us a little about yourself (hobbies, education, etc):

I’m a product of the education system of the State of Montana in the 1980s. I studied Electrical Engineering at Montana State, but switched to Computer Science at the University of Montana. I switched universities to get access to U of M’s VAX-750 running Unix. I graduated with a BS degree in ’83 and then, later, an MS in’ 91.

My hobbies include unusual plants, intricate drawing and baroque music. I have seven greenhouses filled with organic veggies, orchids and carnivorous plants. In the last few years I’ve discovered that I can draw well enough show pieces in art galleries. Finally, while I own an oboe and a family of baroque recorders, I’ve settled on an electronic woodwind instrument, a Yamaha WX-5. Oh yeah, then there are the Harleys: ’08 FX-STB Night Train and a ’15 Fat Boy Low.

I work for the Mozilla Corporation. My first contributions to Mozilla projects began while working at the OSUOSL in ’04. Later as an employee, I was the lead developer in Socorro, the Python based server side of the Firefox crash reporting system. Continue reading PyDev of the Week: K Lars Lohn