PyDev of the Week: Martin Fitzpatrick

This week we welcome Martin Fitzpatrick (@mfitzp) as our PyDev of the Week! Martin is the author of “Create Simple GUI Applications with Python and Qt 5” and the creator of the LearnPyQt website. You can also check out his personal site or see what he’s up to by visiting his Github profile. Let’s spend some time getting to know Martin better!

Martin Fitzpatrick

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

I’m a developer from the United Kingdom, who’s been working with Python for the past 12 years, and living in the Netherlands (Amersfoort) for the past 5.

I started coding on 8 bit machines back in the early 90s, creating platform games of dubious quality — in my defence we didn’t have StackOverflow back then. Later I moved onto the PC, first writing DOS games and then, after someone invented the internet, doing a stint of web dev. I’ve been programming on and off ever since.

Rather than pursue software development as a career, I instead took a long detour into healthcare/biology. I worked first in the ambulance service, then as a physiotherapy assistant and finally completed a degree and PhD in Bioinformatics & Immunology. This last step was where I discovered Python, ultimately leading me to where I am now.

In my spare time I tinker in my workshop, creating daft electronic games and robots.

I like robots. Continue reading PyDev of the Week: Martin Fitzpatrick

The NSA Has a Beginner Python Course

The National Security Agency (NSA) recently released a free Python programming course for beginners after a Freedom of Information Act (FOIA) request according to ZDNet. There is almost 400 pages of material that has been uploaded to Digital Oceans Spaces by Chris Swenson, the software developer who made the original request.

You can access the course PDF directly here. Interestingly, the document mentions a couple of No Starch Press’s most popular books, such as “Automate the Boring Stuff with Python” and “Python Crash Course”.

The document is a bit dry, but it is interesting to see how the United States government is teaching Python.

Kushal Das has spent more time than I have digging through the materials and has posted about his discoveries on his blog. I personally found it interesting that they were using the Anaconda distribution rather than the CPython one.

Anyway, if you have some time, you should check it out.

 

Python 101 2nd Edition Kickstarter Preview

I have been kicking around the idea of updating my first book, Python 101, for over a year. After doing a lot of planning and outlining, I am ready to announce that I have started work on the book.

Python 101 2nd Ed Kickstarter

The new Python 101, 2nd Edition, will be a completely new book rather than just an updated book like a lot of publishers like to do. I feel like updating a chapter or two is a disservice to my readers. This new book will cover most of the items in the the original. However I am dropping the the tour of the standard library and replacing it with a “How-To” section as I think seeing live, working code is better than talking about syntax.

You can follow my Kickstarter now if you’d like to. The Kickstarter will go live February 17th at approx 8 a.m. CST and run 30 days.

PyDev of the Week: Paul Sokolovsky

This week we welcome Paul Sokolovsky as our PyDev of the Week! Paul is the creator of Pycopy, which is described as “a minimalist and memory-efficient Python implementation for constrained systems, microcontrollers, and just everything”. You can check out more of his contributions to open source on Github. Let’s take a few moments to get to know Paul better!

Paul Sokolovsky

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

I have Computer Science as my first masters, and later got another masters in Linguistics – when I was a CS student I was interested in Natural Language Processing subfield of AI, and wanted to get a formal degree to work in that areas, perhaps in academia, but that never panned out, I got sucked up into the IT industry, a common story ;-).

Hobbies – well, nothing special, I like to travel, and even if a plane carries me far away, I like to get on my feet and explore like humans did it for millennia. Though if there’s a motorbike for rent, I like to ride it to a more distant mountain before climbing it. My latest interest is history. Like, everyone took history lessons in school and might have their “favorite” history of a particular country at particular timeframe, but trying to grasp history of mankind across the mentioned millennia is a different matter. Continue reading PyDev of the Week: Paul Sokolovsky

How to Check if a File is a Valid Image with Python

Python has many modules in its standard library. One that is often overlooked is imghdr which lets you identify what image type that is contained in a file, byte stream or path-like object.

The imghdr can recognize the following image types:

  • rgb
  • gif
  • pbm
  • pgm
  • ppm
  • tiff
  • rast
  • xbm
  • jpeg / jpg
  • bmp
  • png
  • webp
  • exr

Here is how you would use it imghdr to detect the image type of a file:

>>> import imghdr
>>> path = 'python.jpg'
>>> imghdr.what(path)
'jpeg'
>>> path = 'python.png'
>>> imghdr.what(path)
'png'

All you need to do is pass a path to imghdr.what(path) and it will tell you what it thinks the image type is.

An alternative method to use would be to use the Pillow package which you can install with pip if you don’t already have it.

Here is how you can use Pillow:

>>> from PIL import Image
>>> img = Image.open('/home/mdriscoll/Pictures/all_python.jpg')
>>> img.format
'JPEG'

This method is almost as easy as using imghdr. In this case, you need to create an Image object and then call its format attribute. Pillow supports more image types than imghdr, but the documentation doesn’t really say if the format attribute will work for all those image types.

Anyway, I hope this helps you in identifying the image type of your files.

PyDev of the Week: Alessia Marcolini

This week we welcome Alessia Marcolini (@viperale) as our PyDev of the Week! Alessia is a Python blogger and speaker. You can check out some of her work over on Medium. You can also see some of her coding skills on Github. Let’s spend a few moments getting to know her better!

Alessia Marcolini

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

Hello everybody, my name is Alessia and I’m 21. I come from a little town near Verona, a beautiful city in the north of Italy.

I’ve been living in Trento (Italy) for 2 years and a half now. I moved here to attend university: I’m currently enrolled in the third year of a Bachelor’s degree in Computer Science.

In 2017 I started working part time as a Junior Research Assistant in the Bruno Kessler Foundation, too. FBK is a research foundation based in Trento, working on Science, Technology, and Social Sciences. I’m part of the MPBA unit which focuses on novel applications of Deep Learning from complex data: e.g. Precision Medicine, Imaging and Portable Spectroscopy in industry processes, Nowcasting on time-spatial data. I’m currently working on deep learning frameworks to integrate multiple medical imaging modalities and different clinical data to get more precise prognostic/diagnostic functions.

When not coding, I love dancing and listening to music. I have also been part of a hip hop crew until 2017. Continue reading PyDev of the Week: Alessia Marcolini

PyDev of the Week: Thomas Wouters

This week we welcome Thomas Wouters (@Yhg1s) as our PyDev of the Week! Thomas is a core developer of the Python language. He is very active in open source in general and has been a director of the Python Software Foundation in the past. Let’s spend some time getting to know him better!

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

I’m a self-taught programmer, a high school dropout, a core CPython developer, and a former PSF Board Director from Amsterdam, The Netherlands. I’ve been playing with computers for a long time, starting when my parents got a Commodore 64 with a couple books on BASIC, when I was 6 or 7. I learned a lot by just playing around on it. Then in 1994 I discovered the internet, while I was still in high school. This was before the days of the World Wide Web or (most) graphics, but I was sucked in by a programmable MUD, a text-based “adventure” environment, called LambdaMOO. LambdaMOO lets you create your own part of the world by making rooms and objects, and programming their behaviour, in a programming language that was similar to Python (albeit unrelated to it). One thing led to another and I dropped out of high school and got a job at a Dutch ISP (XS4ALL), doing tech support for customers. A year later I moved to the Sysadmin department, where I worked for ten years. I gradually moved from system administration to programming, even before I learned about Python.

 

Besides working with computers I also like playing computer games of all kinds, and non-computer games like board games or card games. I do kickboxing, and I have a bunch of lovely cats, about whom I sometimes tweet. I’m pretty active on IRC as well, and I’m a channel owner of #python on Freenode. I also keep ending up in administration-adjacent situations, like the PSF Board of Directors and the Python Steering Council, not so much because I like it but because I don’t mind doing it, I’m apparently not bad at it, and it’s important stuff that needs to be done well.

Continue reading PyDev of the Week: Thomas Wouters

PyDev of the Week: Sebastián Ramírez

This week we welcome Sebastián Ramírez (@tiangolo) as our PyDev of the Week! Sebastián is the creator of the FastAPI Python web framework. He maintains his own website/blog which you should check out if you have some free time. You can also see his open source projects there. You can also see what projects he is contributing to over on Github.

Let’s take a few moments to get to know Sebastián better!

Sebastián Ramírez

Can you tell us a little about yourself (hobbies, education, etc):
Hey! I’m Sebastián Ramírez, I’m from Colombia, and currently living in Berlin, Germany.
I was “homeschooled” since I was a kid, there wasn’t even a term for that, it wasn’t common. I didn’t go to school nor university, I studied everything at home. At about (I think) 14 I started fiddling with video edition and visual effects, some music production, and then graphic design to help with my parent’s business.
Then I thought that building a website should be almost the same …soon I realized I had to learn some of those scary “programming languages”. HTML, CSS, and JavaScript (“but!!! HTML and CSS are not…” I know, I know). But soon I was able to write a very short text, in a text file, and use it to make a browser show a button, that when clicked would show a pop-up saying “Hello world!”… I was so proud and excited about it, I guess it was a huge “I maked these” moment for me. I still feel that rush, that excitement from time to time. That’s what makes me keep loving code.
I also like to play videogames and watch movies, but many times I end up just coding in my free time too. I’m boring like that… 😂

Continue reading PyDev of the Week: Sebastián Ramírez

Getting Jenkins Jobs by Build State with Python

I have been working with Python and Jenkins a lot lately and recently needed to find a way to check the job’s status at the build level. I discovered the jenkinsapi package and played around with it to see if it would give me the ability to drill down to the build and resultset level within Jenkins.

In the builds that I run, there are X number of sub-jobs. Each of these sub-jobs can pass or fail. If one of them fails, the entire build is marked with the color yellow and tagged as “UNSTABLE”, which is failed in my book. I want a way to track which of these sub-jobs is failing and how often over a time period. Some of these jobs can be unstable because they access network resources, which others may have been broken by a recent commit to the code base.

I eventually came up with some code that helps me figure out some of this information. But before you can dive into the code, you will need to install a package. Continue reading Getting Jenkins Jobs by Build State with Python

PyDev of the Week: Tyler Reddy

This week we welcome Tyler Reddy (@Tyler_Reddy) as our PyDev of the Week! Tyler is a core developer of Scipy and Numpy. He has also worked on the MDAnalysis library, which is for particle physics simulation analysis. If you’re interested in seeing some of his contributions, you can check out his Github profile. Let’s spend some time getting to know Tyler better!

Tyler Reddy

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

I grew up in Dartmouth, Nova Scotia, Canada and stayed there until my late twenties. My Bachelor and PhD degrees were both in biochemistry, focused on structural biology. I did travel a lot for chess, winning a few notable tournaments in my early teen years and achieving a master rating in Canada by my late teens. Dartmouth is also known as the “City of Lakes,” and I grew up paddling on the nearby Lake Banook. In the cold Canadian Winter the lake would freeze over and training would switch to a routine including distance running—this is where my biggest “hobby” really took off. I still run about 11 miles daily in the early morning.

I did an almost six year post-doc in Oxford, United Kingdom. I had started to realize during my PhD that my skill set was better suited to computational work than work on the lab bench. Formally, I was still a biol- ogist while at Oxford, but it was becoming clear that my contributions were starting to look a lot more like applied computer science and computational geometry in particular. I was recruited to Los Alamos National Labora- tory to work on viruses (the kind that make a person, not computer, sick), but ultimately my job has evolved into applied computer scientist here, and nothing beats distance running in beautiful Santa Fe, NM. Continue reading PyDev of the Week: Tyler Reddy