Tag Archives: Python

Holiday Sale on Python Books

It’s the holiday season so I am putting all my books on sale starting today. The sale will run through December 23rd. You can purchase any of my books for $6.99 on Gumroad or Leanpub. I’m actually recommending Leanpub now as I find its user interface much easier to navigate for my readers, but if you already have a Gumroad account, then feel free to use that.

You will receive the books in PDF, mobi and epub from both Leanpub and Gumroad.

Here are the links:

Gumroad

Leanpub

Softcover editions

I have 10 more copies of the first run of Python 201: Intermediate Python that you can now purchase. You will also receive the digital versions of the book. Note that the first run had a mistake in the asyncio chapter that has been rectified in the digital copies. The future versions of the paperback will be fixed soon.

PyDev of the Week: Alex Clark

This week we welcome Alex Clark (@aclark4life) as our PyDev of the Week! Alex is fork author and project leader of pillow, a “friendly” fork of the Python Imaging Library. Alex writes at his own Python blog which is certainly worth checking out. He is also the author of Plone 3.3 Site Administration. You might also want to check our Alex’s Github profile to see what projects are worthy of his attention. Let’s take some time to get to know him!

aclark-jobs

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

I’ve been calling myself a “Python Web Developer” professionally for the last 10 years or so, occasionally adding “& Musician” to the end; so music is a big part of what I do, or at least think about doing, outside of Python. I’m from Baltimore, MD, USA and I attended both Loyola High School and University (College when I attended) in Maryland. It took about 10 years, but I earned my Bachelor of Science Degree in Computer Science in May of 1998. Not all who wander are lost, but in my case I had no idea what I wanted to do until I saw a room full of Digital DECStations in the UNIX lab; at that moment, I decided I wanted to be in that room and I switched my major from Accounting to Computer Science.

Continue reading PyDev of the Week: Alex Clark

PyDev of the Week: Jim Fulton

This week we welcome Jim Fulton (@j1mfulton) as our PyDev of the Week! He has been doing software development for over a quarter century. Jim is the chief architect of Zope, which is a object-oriented web application server written in Python. You will actually find various other Python packages using some Zope components, such as Twisted. Anyway, Jim has a nice website that goes over what he’s been up to over the years. You can also check out what projects he’s a part of on Github. Let’s take a few minutes to get to know our fellow Pythonista better!

jim_fulton-cropped

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

I started my career working with rainfall-runoff models. I was in a combined BS/MS Civil Engineering/Systems Engineering Water-Resources program, where I explored rainfall-runoff model calibration. Later I applied rainfall-runoff models at the US Geological Survey. Over the years, my modeling work and work applying, supporting, and developing data-analysis software took me further and further into software engineering. Eventually, I switched to software engineering full time, after getting a Masters in software engineering and joining Digital Creations, which later became Zope Corporation.

Since joining Digital Creations/Zope Corporation I’ve been fortunate to help create the Zope ecosystem and work on a variety of interesting projects.

I’ve been using Python since 1992, have been an on-again and off-again Python contributor and was involved in early efforts to promote Python, such as the PSA and early conferences. I was at SPAM I, hosted SPAM II and SPAM III at the USGS, and was sad to see “SPAM” replaced by IPC :), but am really impressed with the way PyCon(s) has evolved.

As far as hobbies, I most enjoy solving practical problems, from software problems, to projects around the house, to roasting my own coffee to get coffee that tastes like coffee.

Continue reading PyDev of the Week: Jim Fulton

PyDev of the Week: David Mertz

This week we welcome David Mertz (@mertz_david) as our PyDev of the Week! David is the author of Text Processing in Python as well as many interesting articles about Python on IBM developerWorks. I’m pretty sure I read some of those articles when I was first learning Python. You can check out a pretty intensive listing here. He was a member of the board of directors of the Python Software Foundation for 6 years. Let’s spend some moments getting to know him better!

dqm-maybe-belarus

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

I took a curious path to writing Python code, and to writing about Python code. My doctorate is in Post-Structuralist Marxist Political Philosophy. I did some wonderful work in that area, and loved writing for academic journals and giving papers at those sorts of conferences. But I was also slightly slow-witted, so it took me a decade to figure out that no one would actually pay me money to know that stuff; sadly, the system of real tenure, especially in the humanities, is mostly dead, and adjunct jobs mostly pay around minimum wage (or less).

Continue reading PyDev of the Week: David Mertz

PyDev of the Week: Kirby Urner

This week we welcome Kirby Urner (@thekirbster) as our PyDev of the Week. Kirby teaches Python for the O‚ÄôReilly School of Technology. He also speaks at PyCon USA from time to time. You might also want to check out his website to learn more about his passions. Let’s take a few moments to get to know him better.

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

When a younger guy in the Philippines, my dad and I took up scuba diving as a hobby, not so expensive when you probably don’t need a wet suit and equipment comes at Costco prices on base. We were civilians but had US military base access where gear was inexpensive (Clark and Subic were bigger then).

Dad was an urban / regional and later education system planner.

We had a great trainer, an ex-marine by the name of Gill Gilleland, a commercial diver when not teaching newbies. Mom and sis had their own hobbies.

From the Philippines I went to Princeton for higher learning.

Although I ended up focusing in philosophy (on Wittgenstein’s stuff in particular), I was an avid student of computer science and other topics in engineering throughout my four years there.

I studied programming a lot and really liked APL by Kenneth Iverson. Sometimes I’d seek out the table with the most computer geeks in the cafeteria and just sit there and listen, picking up their banter about operating systems.

APL ran on an IBM 370 mainframe at the computer center, with terminals scattered around campus, including in the basement of my dorm.

Continue reading PyDev of the Week: Kirby Urner

An intro to aiohttp

Python 3.5 added some new syntax that allows developers to create asynchronous applications and packages easier. One such package is aiohttp which is an HTTP client/server for asyncio. Basically it allows you to write asynchronous clients and servers. The aiohttp package also supports Server WebSockets and Client WebSockets. You can install aiohttp using pip:


pip install aiohttp

Now that we have aiohttp installed, let’s take a look at one of their examples!


Fetching a Web Page

The documentation for aiohtpp has a fun example that shows how to grab a web page’s HTML. Let’s take a look at it and see how it works:

import aiohttp
import asyncio
import async_timeout
 
async def fetch(session, url):
    with async_timeout.timeout(10):
        async with session.get(url) as response:
            return await response.text()
 
async def main(loop):
    async with aiohttp.ClientSession(loop=loop) as session:
        html = await fetch(session, 'http://www.blog.pythonlibrary.org')
        print(html)
 
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))

Here we just import aiohttp, Python’s asyncio and async_timeout, which gives us the ability to timeout a coroutine. We create our event loop at the bottom of the code and call the main() function. It will create a ClientSession object that we pass to our fetch() function along with what URL to fetch. Finally in the fetch() function, we use set our timeout and attempt to get the URL’s HTML. If everything works without timing out, you will see a bunch of text spewed into stdout.

Continue reading An intro to aiohttp

Python 201 is the Featured Book on Leanpub Today

Leanpub is featuring my second book on their homepage today:

py201_featured_leanpub

You can get the book for 50% off until tomorrow by using the following link: http://leanpub.com/python201/c/50percent

Python 201 covers the following topics:

Part I – Intermediate Modules

  • Chapter 1 – The argparse module
  • Chapter 2 – The collections module
  • Chapter 3 – The contextlib module (Context Managers)
  • Chapter 4 – The functools module (Function overloading, caching, etc)
  • Chapter 5 – All about imports
  • Chapter 6 – The importlib module
  • Chapter 7 – The itertools module
  • Chapter 8 – The re module (An Intro to Regex in Python)
  • Chapter 9 – The typing module (Type Hinting)

Part II – Odds and Ends

  • Chapter 10 –¬†generators / iterators
  • Chapter 11 – map, filter, reduce
  • Chapter 12 – unicode
  • Chapter 13 – benchmarking
  • Chapter 14 – encryption
  • Chapter 15 – Connecting to databases
  • Chapter 16 – super
  • Chapter 17 – descriptors (magic methods)
  • Chapter 18 – Scope (local, global and the new non_local)

Part III – Web

  • Chapter 19 – Web scraping
  • Chapter 20 – Working with web APIs
  • Chapter 21 – ftplib
  • Chapter 22 – urllib / httplib (client / server)

Part IV – Testing

  • Chapter 23 – Doctest
  • Chapter 24 – unittest
  • Chapter 25 – mock
  • Chapter 26 – coverage.py

Python 101 is FREE for 48 hours!

Today I am releasing my first book, Python 101, for free for 48 hours. Python 101 was written as an introduction to the Python programming language. While it is intended for beginners, some have claimed that they needed more hand-holding than this book provided for them. So I currently recommend it as an introductory and intermediate book for developers that are looking to learn Python.

When I originally wrote the book, I noticed that there were few or no books available that described how to create executables of your code or distribute your code via Python’s Package Index (PyPI). Python 101 covers these topics as well as introducing the reader to Python’s standard library, how to install 3rd party packages and an introduction to some of the most popular 3rd party packages for Python, such as SQLAlchemy, requests and virtualenv.

Python 101 has 5 sections, 44 chapters and 295 pages.

You can get Python 101 for free on Leanpub using the following link: http://leanpub.com/python_101/c/48hours

If you happen to have a Gumroad account, then you’ll be able to get the book free there as well by using the following offer code: 48hours

You will get the PDF, epub and mobi versions of the book. You can see a full table of contents on the Leanpub site

If you like my first book, you can get its sequel, Python 201: Intermediate Python for 50% off here: http://leanpub.com/python201/c/50percent

PyDev of the Week: Al Sweigart

This week we welcome Al Sweigart as our PyDev of the Week. Al is the author of the PyAutoGUI and Pyperclip packages. He is also the author of several Python books such as:

He has also released a book on Scratch called Scratch Programming Playground. Al is quite well known in the Python world and his books have received really good reviews. Let’s take some time to get to know him better!

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

I was fortunate enough to be introduced to programming early on and then majored in computer science at UT Austin (“hook ’em!”) but I hate telling people this. A lot of folks think programming is something you have to have started in as a toddler in order to become proficient. The truth is everything I learned about programming in between the 3rd and 12th grade can be learned in a dozen free weekends.

Aside from coding, I like to write coding tutorials and record coding screencasts. I also volunteer at the San Francisco SPCA and Oakland’s video game museum, the MADE.

Continue reading PyDev of the Week: Al Sweigart

wxPython Cookbook Writing Update: Beta Version Available

I am happy to announce that I now have all the chapters for my latest book, wxPython Cookbook, ready to be checked out. I still consider the book to be in beta mode as I need to go through each chapter and check them over as much as possible this month, but I am also pretty confident that the book is over 90% complete. Some chapters still need a screenshot or two added and I also plan to add another chapter or two as well.

For those of you who like raw data, there are currently 51 recipes in the book + the introduction and installation chapters. There are over 300 pages of content, which is more than either of my previous books!

I hope to do some polishing this week by adding the missing screenshots and also writing a brand new chapter. I am also hoping to get some of the code examples into Github this week. I do apologize for the delay in getting that done. Life has been really crazy on my end.

You can get early access to the book on Leanpub and Gumroad. You will also receive the final product + updates if you purchase the book from either of those websites. You can also check out the original Kickstarter campaign to learn more about the book.

Thanks again for all your support!

wxcookbook_small