Jacob Kaplan-Moss

Tag: python

TIL: A DictWriter interface for Google Spreadsheets August 21st, 2023

I’ve been using Python’s csv library approximately forever so its interfaces – particularly the DictReader and DictWriter interfaces – are almost literally muscle memory at this point. So when I needed to push a bunch of data to Google Sheets, I naturally wanted an interface that worked like DictWriter. Here’s the code: class WorksheetDictWriter: """ Something like a `csv.DictWriter`, except for a `gspread.Worksheet` """ def __init__(self, worksheet: gspread.Worksheet, fieldnames: list[str], column="A"): self.…

🔗 Thoughts on the Python packaging ecosystem January 21st, 2023

The best piece on Python packaging — why it’s the mess that it is — written yet. Required reading if you want to understand how we got here and maybe how we’ll get out.

My Python Development Environment: My Python Development Environment, 2020 Edition November 11th, 2019

For years I’ve noodled around with various setups for a Python development environment. A couple of years ago I wrote about a setup I finally liked; this is an update to that post. Bad news: this stuff still isn’t stable, and I’ve had to make some changes. Good news: the general concepts still hold, and the new tools a generally a bit better. If you’re curious about the changes and why I made them, there’s a section at the very end about that.…

My Python Development Environment: My Python Development Environment, 2018 Edition February 21st, 2018

This is out of date. For a newer version, see My Python Development Environment, 2020 Edition For years I’ve noodled around with various setups for a Python development environment, and never really found something I loved – until now. My setup pieces together pyenv, pipenv, and pipsi. It’s probably a tad more complex that is ideal for most Python users, but for the things I need, it’s perfect. My Requirements I do have somewhat specific (maybe unusual?…

Auto-building Sphinx docs May 24th, 2012

Here’s a quick way to automatically regenerate your Sphinx docs as you make changes to the source. There’s probably a million ways to do this; here’s mine: $ pip install watchdog $ watchmedo shell-command \ --patterns="*.txt" \ --ignore-pattern='_build/*' \ --recursive \ --command='make html'

What to do when PyPI goes down July 20th, 2010

Lately PyPI, the Python package index, has been having some availability issues. When PyPI goes down it really hurts Python developers: we can’t install new packages, bring up new development environments or virtualenvs, or deploy code with depedencies. Work is ongoing – see PEP 381 – to add much-needed resiliency to PyPI, and the fruits of these labors are starting to become available. In particular, a number of PyPI mirrors are now available: b.…

Python is Unix October 6th, 2009

Ryan Tomayko’s I like Unicorn because it’s Unix should be required reading for anyone doing anything involving networks or unixes these days. Like Ryan, I share a deep appreciation for the dark art of Unix system calls, and like Ryan I’m a bit dismayed to see them relegated to the dusty corners of our shiny dynamic languages. So I read I like Unicorn because it’s Unix with glee; it’s perhaps the cleanest, clearest explanation of how preforking socket servers work, and I enjoyed seeing Ruby’s twist on the old standard.…

Snakes on the Web September 4th, 2009

A talk given at PyCon Argentina and PyCon Brazil, 2009. Web development sucks. It’s true: web development, at its worst, is difficult, repetitive, and boring. The tools we have suck. At best, they make web development slightly less painful, but we’re a long way from making web development awesome. The history of web development tools is a history of trying to solve this problem. It’s a history of asking, “how can we make this suck less?…

More buildout notes April 20th, 2009

I got a lot of great feedback on my buildout tutorial I posted last week. In general, the comments there have some excellent tips, tricks, and extra pointer, so check ’em out. After reading the comments and a few more I got over email, I thought I’d share a selected grab-bag of updates, hints, and details for those fooling around with Buildout and Django. Django trove identifier James Bennett pointed out that Django has its very own PyPI classification, Framework :: Django.…

Nobody expects Python packaging! April 13th, 2009

Python has one package distribution system: source files and setup.py install. And easy_install. Python has two package distribution systems: setup.py install and easy_install. And zc.buildout. Python has three package distribution systems: setup.py install, easy_install, and zc.buildout. And pip. Amongst Python’s package distribution are such diverse elements as…

Python implementation details March 26th, 2009

I’m sitting here at PyCon at the Python Language summit discussing differences between Python versions, and the topic of implementation details came up. The main part of getting Django working on alternate Python VMs was fixing the various assumptions we made about implementation details of Python. I went back and dug through Django’s ticket tracker for the issues alternate VM issues (most from the Jython developers, some from the PyPy developers) that we had to fix; it’s a pretty instructive list of things you shouldn’t rely on if you’d like your Python code to run on alternate VMs:…

Why I'm excited about Python 3 January 22nd, 2009

This is a rough transcript, with links, of a 3-minute lightning talk I gave at LCA. It’s obviously not a complete argument; just a 180-second pitch for why the drama about Py3k is all smoke and no fire. I’m excited about porting my code to Python 3, and you should be, too. I’m sure all the Python users here are aware of the recent release of Python 3.0. Python 3.0 is the first Python release in something like a decade that is fundamentally incompatible with the previous release.…

PyCon Braindump March 19th, 2008

PyCon 2008 Brain Dump There are some great roundups of the content at PyCon out there; this isn’t one of them. See, I have this notebook (Moleskine FTW!) I carry with me everywhere, and now it’s chock-full of note from PyCon; this is a braindump. EAV Mammoth replicator Django 1.0 will support Python 2.3, but later releases likely will not. We’ll need to start working on moving to Python 3.…

Five things I hate about Python March 4th, 2007

Inspired by Titus (who was in turn inspired by brian d foy), here’s what I hate about Python. I completely agree with Brian that you can’t trust any advocate who doesn’t know enough to find stuff to hate. Given that I spend a lot of time advocating Python, writing down what I hate seems a good exercise. Perhaps I’ll do the same for Django in the future… Anyway, here are the five things I hate about Python, presented Letterman-style:…