All posts by Mike

PyDev of the Week: Elana Hashman

This week we welcome Elana Hashman (@ehashdn) as our PyDev of the Week! Elana is a director of the Open Source Initiative and a fellow of the Python Software Foundation. She is also the Clojure Packaging Team lead and a Java Packaging Team member. You can see some of her work over on Github. You can also learn more about Elana on her website. Let’s take a few moments to get to know her better!

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

I love to bake and cook, so my Twitter feed tends to be full of various bread pictures or whatever dish I’ve whipped up over the weekend. When I was a kid, I was completely hooked on the cooking channel—my favourite shows were “Iron Chef” and “Good Eats”—and I thought I’d become a chef when I grew up. That’s my back up plan if I ever drop out of tech!

I’m Canadian, and I attended the University of Waterloo in Ontario to study mathematics, majoring in Combinatorics & Optimization with a Computer Science minor. The University of Waterloo is famous for its co-operative study program, where students take an extra year to finish their degrees and forfeit their summers off to complete 5-6 paid co-op work terms. To give my schedule a bit more flexibility, I actually dropped out of the co-op program, but prior to graduating I completed 4 co-op terms, a Google Summer of Code internship, some consulting, and even became an open source maintainer. I learned how to admin servers for the Computer Science Club, and a group of my friends and I revived the Amateur Radio Club after it had been inactive for a decade.

Amateur (or “ham”) radio got me into playing with electronics, so I learned how to solder and now I occasionally build cool things like the PiDP-11 kit. And now that I can solder a PCB, I want to see if I can solder silver, so I’m signing up to take some jewellery-making classes this fall. I also take care of a bunch of wonderful, mostly low-maintenance houseplants. One day I hope to have a full-sized backyard for growing vegetables and setting up radio antennas! Continue reading PyDev of the Week: Elana Hashman

Thousands of Scientific Papers May be Invalid Due to Misunderstanding Python

It was recently discovered that several thousand scientific articles could be invalid in their conclusions because scientists did not understand that Python’s glob.glob() does not return sorted results.

This is being reported on by Vice, Slashdot and there’s an interesting discussion going on over on Reddit as well.

Some are reporting this as a glitch in Python, but glob has never guaranteed that is results were returned sorted. As always, I would recommend reading the documentation closely to fully understand what your code does. It would also be a good idea if you can write tests around your code. Python includes a unittest module which makes this easier.

PyDev of the Week: Paul Ivanov

This week we welcome Paul Ivanov (@ivanov) as our PyDev of the Week! Paul is a core developer of IPython and Jupyter. He is also an instructor at Software Carpentry. You can learn more about Paul on his website. You can also see what he’s been up to in open source by visiting his Github profile. Let’s take some time to get to know Paul!

Paul Ivanov (courtesy of Robert Sexton)

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

I grew up in Moscow and moved to the United States with my family when I was 10. I have lived in Northern California ever since. I earned a degree in Computer Science at UC Davis. After that, I worked on a Ph.D. in Vision Science at UC Berkeley.

I really enjoy a lot of different aspects of computing, be it tinkering with hardware (especially microcontrollers) and trying out different operating systems and programming languages. Outside of things involving a keyboard, my main hobby is endurance cycling. I have a touring bike with a front basket that I’ve ridden on for a dozen 200km, two 300km, two 400km and one 600km rides. I also write in my journal (the pen and paper kind), which sometimes turns into poetry, some of which I have posted on my website. Continue reading PyDev of the Week: Paul Ivanov

PyDev of the Week: Marlene Mhangami

This week we welcome Marlene Mhangami (@marlene_zw) as our PyDev of the Week! Marlene is the PyCon Africa (@pyconafrica) chair, the co-founder of @zimbopy and a director for the Python Software Foundation. Let’s spend some time getting to know her!

Marlene Mhangami

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

Sure, in college I studied molecular biology. I was actually in the schools pre-medicine track because I initially thought I wanted to become a doctor. Looking back on it now I laugh because I hate blood, just the sight of it in movies makes me shut my eyes tightly, so I’m genuinely happy that didn’t work out! I went to a liberal arts college and appreciate that I had the space to take courses in other fields like philosophy and politics which I really enjoy.

I get asked about what hobbies I have quite often, and I’m not sure if I have anything I do consistently enough to call a hobby. I read, and sometimes run, and love to journal. I also occasionally paint, but the last time I told someone I painted they asked me where my studios were and started listing off artists that I had never heard of before, so I like to disclaimer that I don’t paint in a way that is cultured or sophisticated but just as a way to express myself and have fun. Continue reading PyDev of the Week: Marlene Mhangami

PyDev of the Week: Peter Farrell

This week we welcome Peter Farrell (@hackingmath) as our PyDev of the Week! Peter is the author Math Adventures with Python and two other math related Python books. You can learn more about Peter by visiting his website.

Let’s take a few moments to get to know Peter!

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

I was brought up in the US, earned a B.A. in Math and taught Math for 8 years in big and small schools. I always wanted to show students the real-world applications of the stuff they were learning, all of which turned out to be computer-related. I learned to program in my 30’s in Logo by going page-by-page through Samuel Papert’s brilliant book Mindstorms. After that I taught all my math classes turtle programming. A student turned me on to Python and I never looked back. Away from the computer, I like to play guitar and watch documentaries. Continue reading PyDev of the Week: Peter Farrell

Python Code Kata: Fizzbuzz

A code kata is a fun way for computer programmers to practice coding. They are also used a lot for learning how to implement Test Driven Development (TDD) when writing code. One of the popular programming katas is called FizzBuzz. This is also a popular interview question for computer programmers.

The concept behind FizzBuzz is as follows:

  • Write a program that prints the numbers 1-100, each on a new line
  • For each number that is a multiple of 3, print “Fizz” instead of the number
  • For each number that is a multiple of 5, print “Buzz” instead of the number
  • For each number that is a multiple of both 3 and 5, print “FizzBuzz” instead of the number

Now that you know what you need to write, you can get started! Continue reading Python Code Kata: Fizzbuzz

PyDev of the Week: Veronica Hanus

This week we welcome Veronica Hanus (@veronica_hanus) as our PyDev of the Week! Veronica is a regular tech speaker at Python and other tech conferences and meetups. You can see some of her talks and her schedule on her website. She has been active in the Python community for the past few years. Let’s take a few moments to get to know her better!

Veronica Hanus

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

I enjoy writing and taking pictures. For me, the challenge is to help someone feel what I was feeling when I decided the moment was picture- or story-worthy, and both take a combination of skill-that-you-can-study and plain-old-caring that I find immensely rewarding. Photo-taking excursions are one of my favorite ways to spend time with friends, because they’re a nice combination of “quiet, contemplative side-by-side activity” and “let’s get out and do something”!

I once carved out time to take silly pictures with a new conference friend in a funny upside-down room at the conference venue. It amazed me how nice it felt to be fussed over after the stress of my first conference talk. As I started speaking more, I started offering to take pictures of conference attendees and many shared the same sentiment. Many people find conferences overwhelming and it’s nice to take a few minutes and relax, make a new friend, and maybe go home with new headshots.

My education often surprises people because it violates many people’s expectations: I don’t hold a CS degree, and I never attended a bootcamp. In college, I studied Geology with a combined geochemical and planetary science twist. Since shifting into software, I have heard countless times “Geology!? That must have been such a… change”. Even today, comments like that feel challenging and exclusionary and early in my career shift it felt terrible. We hear again and again that having folks from diverse backgrounds help teams innovate, but when meeting someone who doesn’t fit our expectations, most of us still do a double-take. If I get that as a white, degree-touting former-scientist, imagine the uncomfortable responses folks in groups with more bias encounter when we express our surprise!

It turns out that my winding path toward programming has allowed me to make some of my most useful contributions. We don’t talk about it enough, but many use programming skills even if they haven’t written a line of code. If you’re considering development but are wondering how you will fit in, I encourage you to take a peek at communities like Write the Docs (their Slack), #CodeNewbie (their Twitter), or send me a hello via my Twitter or email. Continue reading PyDev of the Week: Veronica Hanus

wxPython – Creating a PDF Merger / Splitter Utility

The Portable Document Format (PDF) is a well-known format popularized by Adobe. It purports to create a document that should render the same across platforms.

Python has several libraries that you can use to work with PDFs:

  • ReportLab – Creating PDFs
  • PyPDF2 – Manipulating preexisting PDFs
  • pdfrw – Also for manipulating preexisting PDFs, but also works with ReportLab
  • PDFMiner – Extracts text from PDFs

There are several more Python PDF-related packages, but those four are probably the most well known. One common task of working with PDFs is the need for merging or concatenating multiple PDFs into one PDF. Another common task is taking a PDF and splitting out one or more of its pages into a new PDF.

You will be creating a graphical user interface that does both of these tasks using PyPDF2. Continue reading wxPython – Creating a PDF Merger / Splitter Utility

PyDev of the Week: Aymeric Augustin

This week we welcome Aymeric Augustin (@aymericaugustin) as our PyDev of the Week. Aymeric is a core developer of Django, a Python web framework. He is also an entrepreneur and speaker at several Django related conferences. You can catch up with Aymeric over on his website or check out his FOSS contributions on Github. Let’s take a few moments to get to know him better!

Aymeric Augustin

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

Do you know how to spot a Frenchman? That’s always the first thing they mention! Now that’s out of the way…

These days my hobbies center around being the dad of three wonderful girls 🙂 We’re doing a lot of physical activity together: swimming, cycling, gardening, playing music, etc.

I’m managing a software engineering department of about 200 people at CANAL+, a French audiovisual media group that operates TV services in several countries.

I was trained as a generalist engineer, eventually specializing in Computer Science and Information Technology, but I learnt most of what I do on the job. Continue reading PyDev of the Week: Aymeric Augustin

Rotating Images in ReportLab

There are times when you want to rotate images or other objects in ReportLab while creating a PDF. For example, you might want to rotate an image by 45 degrees for watermarking purposes. Or you might need an image that runs vertically along one of the edges of the PDF.

You can rotate images by using ReportLab’s canvas methods or by using its higher level Flowables that you can find in the platypus. module. Let’s start by looking at how to do this with the canvas directly!


Rotating Images Using Canvas

Rotating images using the canvas is kind of confusing. The reason being that when you rotate the canvas, you may end up inadvertently rotating other elements on your canvas if you’re not careful.

Let’s take a look at the code: Continue reading Rotating Images in ReportLab