PyDev of the Week: Meredydd Luff

This week we welcome Meredydd Luff (@meredydd) as our PyDev of the Week! Meredydd is the co-founder of Anvil and a core developer for the Skulpt package. You can learn more about Meredydd on his website. Let’s take a few moments to get to know him better!

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

I’ve loved programming since I was first introduced to BASIC at the age of 7. I come from Cambridge (the old one in the UK, not the relatively-new one near Boston), and I studied here too. I actually started out as a biologist, but then switched to computer science for my PhD.

I think programming is the closest thing to magic we have, and I love watching and helping people get their hands on this power. My PhD research was about building usable parallel programming systems, and now I work on Anvil, a tool to make web programming faster and easier for everyone (with Python!).

When I’m not programming, I fly light aeroplanes, which I guess is what happens when your inner six-year-old makes your life decisions. I used to dance competitively (including a few years on England’s top Latin formation team), but it turns out international competitions and startups don’t play well together, so the startup won.
Continue reading PyDev of the Week: Meredydd Luff

PyDev of the Week: Valentin Haenel

This week we welcome Valentin Haenel (@esc___) as our PyDev of the Week! Valentin is a core developer of Numba and several other packages that you can see either on his website or on Github. He has also given several talks at various conferences in Europe. Let’s spend some time getting to know Valentin better!

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

I went to the University of Edinburgh to get a bachelor in computer science and to the Bernstein Center in Berlin to get a master in computational neuroscience. I tend to favour more traditional computer science topics these days such as compression algorithms and compilers. In my spare time, I spend time with my lovely wife Gloria, fly quad-line sports kites and ride longboards through Berlin. I’ve been doing Python and open-source on Github for about 10 years. Continue reading PyDev of the Week: Valentin Haenel

Book Review: Practical Python and OpenCV

I bought Practical Python and OpenCV a couple of years ago during one of its authors Kickstarters. I started reading it and then got busy with other things. The past couple of weeks, I decided to give the book another go and was able to finish it. Note that I started reading the 3rd edition of the book without realizing there was a 4th edition. After finished the 3rd edition, I compared it to the 4th side by side and it looks like they are nearly identical, so I don’t think it matters all that much.


Quick Review

  • Why I picked it up: Computer vision / machine learning sounds interesting to me and the author has a fun blog
  • Why I finished it: It’s short and the writing style is engaging
  • I’d give it to: Anyone looking to get started with OpenCV in Python

Continue reading Book Review: Practical Python and OpenCV

Getting the Correct Notebook Tab Across Platforms in wxPython

I was recently working on a GUI application that had a wx.Notebook in it. When the user changed tabs in the notebook, I wanted the application to do an update based on the newly shown (i.e. selected) tab. I quickly discovered that while it is easy to catch the tab change event, getting the right tab is not as obvious.

This article will walk you through my mistake and show you two solutions to the issue.

Here is an example of what I did originally:

# simple_note.py
 
import random
import wx
 
 
class TabPanel(wx.Panel):
 
    def __init__(self, parent, name):
        """"""
        super().__init__(parent=parent)
        self.name = name
 
        colors = ["red", "blue", "gray", "yellow", "green"]
        self.SetBackgroundColour(random.choice(colors))
 
        btn = wx.Button(self, label="Press Me")
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(btn, 0, wx.ALL, 10)
        self.SetSizer(sizer)
 
 
class DemoFrame(wx.Frame):
    """
    Frame that holds all other widgets
    """
 
 
    def __init__(self):
        """Constructor"""
        super().__init__(None, wx.ID_ANY,
                         "Notebook Tutorial",
                         size=(600,400)
                         )
        panel = wx.Panel(self)
 
        self.notebook = wx.Notebook(panel)
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.on_tab_change)
        tabOne = TabPanel(self.notebook, name='Tab 1')
        self.notebook.AddPage(tabOne, "Tab 1")
 
        tabTwo = TabPanel(self.notebook, name='Tab 2')
        self.notebook.AddPage(tabTwo, "Tab 2")
 
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.notebook, 1, wx.ALL|wx.EXPAND, 5)
        panel.SetSizer(sizer)
        self.Layout()
 
        self.Show()
 
    def on_tab_change(self, event):
        # Works on Windows and Linux, but not Mac
        current_page = self.notebook.GetCurrentPage()
        print(current_page.name)
        event.Skip()
 
 
if __name__ == "__main__":
    app = wx.App(False)
    frame = DemoFrame()
    app.MainLoop()

Continue reading Getting the Correct Notebook Tab Across Platforms in wxPython

Sending email with EZGmail and Python

Have you ever wanted to send an email with GMail using the Python programming language? In 2018, Al Sweigart, best-selling author of Automate the Boring Stuff with Python, created a package called EZGmail. You can also use Google’s own bindings to do this sort of thing, but it’s a lot more complicated than using EZGmail.

In this article, we will take a quick look at how to use this package.


Setting Up

Your first step is to install EZGmail using pip. Here’s how:

pip install ezgmail

Then go to https://developers.google.com/gmail/api/quickstart/python and click the Enable the Gmail API button. This will allow you to download a credentials.json file and also give you a client ID and client secret. You can use the latter credentials with Google’s Python API client and you can manage these credentials here if you need to.

Now copy the credentials file to the location that you plan on writing your code. You will then need to run Python in your terminal in the same location that your downloaded credentials file is located.

The next step is to run ezgmail.init(). This will open up a web browser to Gmail where it will ask you to allow access to your application. If you grant access, EZGmail will download a tokens file so that it doesn’t need to have you reauthorize it every time you use it.

To verify everything is working correctly, you can run the following code:

>>> ezgmail.EMAIL_ADDRESS
'your_email_address@gmail.com'

This should cause your Gmail account name to print out. Continue reading Sending email with EZGmail and Python

PyDev of the Week: Stefan van der Walt

This week we welcome Stefan van der Walt (@stefanvdwalt) as our PyDev of the Week! Stefan is the creator of scikit-image, which is a collection of algorithms for image processing. You can see some of the projects that he is a part of on Github or on Berkeley’s website. Stefan also has his own website which is worth checking out. Let’s take a few moments to get to know Stefan better!

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

I am currently a researcher at the Berkeley Institute for Data Science (BIDS) at the University of California, Berkeley. I was born and raised in the university town of Stellenbosch, South Africa—renowned for its beautiful nature and world-class wines—where I studied electronic engineering, computer science, and applied mathematics. Growing up there, it was easy to fall in love with nature: I love running and hiking in the mountains, and exploring in general. Nowadays, most of my hobby time is spent with my two children, aged 1 and 3. Continue reading PyDev of the Week: Stefan van der Walt

PyDev of the Week: Sean McManus

This week we welcome Sean McManus (@musicandwords) as our PyDev of the Week! Sean is the author of several books, including Mission Python: Code a Space Adventure Game!, which was reviewed on this site in March. There are free chapters from his book available here. You can learn more about Sean on his website. Let’s take some time to get to know him better!

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

I’m a writer specialising in technology. In recent years I’ve written several books to get children and young adults into coding. The launch of the Raspberry Pi and initiatives such as Code Club have helped to make coding much more accessible to young people than it was for many years.

As a kid, I loved programming my Amstrad CPC computer and in many ways it started me on my career path. I had listings and articles published in the leading magazines of the day, and my first book was about Amstrad programming. Today, I can still remember how much I loved programming as a kid, and I hope that my books bring some of that excitement to today’s budding coders.

As well as writing books and articles, I help some of the world’s leading technology companies with their copywriting requirements.

Outside of writing, I enjoy photography and making music. I have recorded an album of electronic music I plan to release online later this year, and I am a member of a singing group which is a great way to unwind. Continue reading PyDev of the Week: Sean McManus

PyDev of the Week: Adrienne Tacke

This week we welcome Adrienne Tacke (@AdrienneTacke) as our PyDev of the Week! Adrienne is the author of Coding for Kids: Python: Learn to Code with 50 Awesome Games and Activities and her book came out earlier this year. You can see what Adrienne is up to on Instagram or via her website. Let’s take some time to get to know her better!

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

I’m a software engineer in Las Vegas and have a degree in Management Information Systems from UNLV. I’ve worked in the education and healthcare industries and now focus on building awesome things in the fintech space. I love learning new languages (spoken and programming), eating every dessert imaginable, traveling the world with my husband, and finding ways to encourage more young girls and women to try out a career as a software engineer. Continue reading PyDev of the Week: Adrienne Tacke

How to Extract Build Info from Jenkins with Python

I work with continuous integration software as a part of my job. I use both Hudson and Jenkins in my role and occasionally need to interact with them programmatically. There are two Python packages you can use for this task:

The Python Jenkins package will work with both Hudson and Jenkins which JenkinsAPI only works with Jenkins. I usually use Python Jenkins because of this, although I have recently started looking to see which one works better with artifacts and I discovered that JenkinsAPI is actually better for that sort of thing. So you will need to evaluate both of these packages depending on what you need to do. Continue reading How to Extract Build Info from Jenkins with Python

PyDev of the Week: Tania Allard

This week we welcome Tania Allard (@ixek) as our PyDev of the Week! Tania is a developer advocate at Microsoft. She is also a speaker at multiple conferences. If you’d like to learn more about her, you should check out her blog. She also has some of her projects up on Github for you to peruse. Let’s take a few moments to get to know Tania!

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

I am originally from Mexico but have lived in the USA and in the UK for the last 8 years.

I have a bachelor’s in Mechatronic engineering and have also always been fascinated by technology and I can class myself as a lifelong learner. As such I got a PhD from the University of Manchester in Data science applied to Materials science, during which I discovered and fell in love with Python. Since completing my PhD I have worked as a research software engineer, research engineer, data engineer, and more recently could advocate.

Apart from tech I love Olympic weightlifting, so I spend quite a good amount of time in the gym every week and I am already looking forward for this year’s competition season!

I also love craft beer and recently joined the women in beer scene in Manchester, UK where I live. Continue reading PyDev of the Week: Tania Allard