Pythonista Kenneth Reitz on — the UX of code, open source tips, and 🐍 humour

Requests is the most famous Python library to have ever been written — period. As mentioned before, Kenneth Reitz’s (Request’s author) “Software for Humans” motto sure did shine through, in becoming one of the reasons behind Requests ballooning to a gargantuan popularity. So, we have invited Kenneth over on Hashnode, to host an AMA , to pick his mind on topics ranging from Open Source, Python, to Making Music. And pick his mind, we did.

We’ve curated the best of questions, and answers for you; in the off chance you missed the AMA. You can find the full AMA here.

Check out what Kenneth had a to say about the importance of documentation, the story behind requests, polishing the art of programming; and the reason behind the Pythonista crossing the road. 😄

UX of code

How important do you think documentation is for any library? You seem to have done most of the initial documentation yourself, how do you motivate yourself to do that? - @vasan

In many of my talks, you'll hear me say that the API is the most important part of a codebase. That is true, because it's the most primary part of the UX of the code itself.

When it comes to the project as a whole though, beyond just the codebase, there are many other places were UX opportunities are surfaced, and one of the biggest ones is documentation.

Documentation is incredibly important for doing a handful of things:

  • Communicating with your userbase the expectations and tone of the project
  • Explaining how to use it (e.g. a quickstart) in simple terms
  • Explaining how to get really deep into it (e.g. an advanced section)
  • API reference

As a bonus, it also helps you, as a developer, explain your crazy technical ideas in layman's terms. Sometimes, this may prove to be a difficult task, which may lead you to re-visit the code you are attempting to document.

All of the above things make writing documentation a very important part of writing any library that will have a userbase (which is ideally, all of them), in my opinion. There's tons of motivation there. Why are you writing the code in the first place?

The origin of requests

What did you create the requests library, and how did you come up with the idea? - @ry4n

Well, it was originally a little file called requests.py inside a module that I was working on — an API wrapper for Convore, a hot new chat service that everyone was using at the time. Working the API client, with this submodule called requests.py that I wanted to be perfect, led me to create a separate repository just for that. I was planning to make many API clients, so I wanted requests to be perfect, and do absolutely everything I'd ever want to with HTTP in Python without any bullshit (e.g. with a great API). And, that's what happened! Much to my surprise, Requests really resonated with people on a level that no other project I had created yet had.

Python overlord @ Heroku

What sort of work do you do at Heroku? - @ry4n

I call myself the "Python Overlord" at Heroku. Effectively, there is a team of "language owners" — one for each major language that Heroku, as a platform, officially supports. I am the Language Owner of Python. This includes wearing many hats, from software engineering, to community engagement and support, to customer engagement and support, to marketing, etc.

Open source awesomeness

What are the tips that you have for an aspiring developer who also wants to release an awesome open source library. - @mariacarey

  • Communicate clearly and concisely. Have a great, useful README.
  • Don't waste anyone's time.
  • Why should they use your project? It should be immediately obvious.
  • How do they use your project? It should be immediately obvious.
  • How do they install your project? It should be immediately obvious.
  • Be really open about the development, if you're on social media (e.g. Twitter).
  • You have to be excited about what you're building, for others to be excited about it.

Polishing the skill of programming

Thinking retrospectively, could you share a couple of pieces of advice for polishing the knowledge and skills, for all of the aspiring Python Overlords. - @waqas

For me, I think polishing the "craftsmanship" side of programming Python was all about forming strong opinions — normally influenced by others I respected. I would find people who's code really resonated with me (for example, for me, Armin Ronacher, now a good friend), and I would scan through their codestyle, setup, repo structure, documentation style on GitHub. I'd note what I liked, what I didn't like. Rinse and repeat. Over and over.

Then, of course, while writing code, developing strong informed preferences is equally valuable. There are a lot of Python programmers out there that want everyone to code the exact same way. For example, there's a blog post going around about how hasattr() in Python 2 "misbehaves" and should be avoided. Some people read that blog post and start sending pull requests to their favorite projects, well intentioned, to remove the use of this perfectly non-misbehaving function (this happened with Requests actually). These are the type of people that are either following someone they respect too closely without question, or have no opinion of their own at all, and just hop on board where whoever "above" them says to.

Now, there's nothing wrong with that blog post — I just disagree with its tone of what I consider to be effectively soft fear-mongering. And, there's nothing wrong with following such a blog post. But you should be the one writing those blog posts. But, only if you're ready. Be ready :)

On improving your craft

How long did it take for you to be this good in Python and what steps did you take to make yourself better each day? - @Covenant

I feel like I haven't gotten any better at Python in about 2.5 years. I'm not sure if that's true or not, but it feels that way. It feels like the culture around the code has changed a bit, as least in my circles, which is primarily web development. I build and maintain rock-solid, stable software. I have all the tools I need to do so. There's nothing new or exciting for me to play with to accomplish any of these tasks anymore.

Docker is the only exception that rule that I know of. And, Kafka, if I ever get around to figuring it out :)

As to improving, I just always had a bunch of ideas, and I was always working on them. Working on one idea would teach me something, which would lead me to the next idea, etc etc.

So, build things! You'll keep getting better and better at it.

It's not an academic exercise. It's like carpentry. You get better primarily by... doing it.

The "aha!" moment

I've been doing Python for about 2 years now, I don't yet feel like I've had that 'Ah ha!' moment, where I'm good at Python. when did you get over that hump? - @Dann

About 9 months into it. I didn't do anything for it to happen—it just happened on its own. I just woke up one day, and sort of "knew" Python—after struggling with basic things for months and giving up.

I had to experiment a lot with different things of course, but that's what makes Python so great, in my opinion—the ease of experimentation with the interpreter and the object model.

This is the most useful part of the Python documentation, in my opinion: https://docs.python.org/3/reference/datamodel.html#basic-customization

Rinse and repeat

At any time, I have several ideas for various software projects. But due to time constraints I don't get to finish them. What's your advice? How should we manage our time so that we can finish side projects without hampering professional commitments? - @kohwang76

I have the same problem, severely. Honestly, if I can't finish something in a single setting, it's never going to get done. So, most of the things I'm most proud of, like Requests, were the result of staying up far too late at night and just getting it done, at least the first version. Then, the next day, make it a little better. Rinse and repeat.

That's what works for me.

Hacking productivity

What are some of your productivity hacks? - @ry4n

Well, I love Things.app—I've been using it for at least 6 years. About once a month or so, I get a flood of new and exciting ideas that I want to work on, but can't possibly come close to approaching them all. So, I just start entering everything into Things.app blindly. Then, when I'm done, I sort them all out into the nice categories and areas of responsibilities that I have, and my next month or two of inspired ideas is nicely organized. :)

Also, some of my best digital creations start away from the computer—on paper. Blog posts, talks for Python conferences, new Python library ideas. I sit down somewhere away from my machine with my favorite notebook and pen and start hashing out the idea. I can think much clearer without the ever-pressing distraction of a computer in front of me sometimes :)

Code editors & IDEs

What editor would you recommend to Python developers working on web apps? - @derrimap

I recommend everyone use Sublime Text. It's really the best editor available for the type of development that I do.

Some people do prefer IDEs, which can be really fantastic tools at times. If so, I highly recommend PyCharm IDE. I have done a significant amount of work with it in the past (including a lot of Requests development!)

Python in ten years

Where do you see the python landscape in ten years time? - @kragniz

  • Everyone using Python 3 (or 4, by then).
  • PyPy being far more prevalent, but not the default.
  • More serious datascience users. Much more.
  • Ideally, the standard library will start to shrink in size.
  • PyCon, if it is to somehow remain a single gathering as it is today, will reach the size of 8000+ attendees.

The answers that made us giggle 😄

If you could pick one Python keyword that you had to replace with an emoji, which would it be and what emoji would you choose? - @tyrel

pass would be 🔜

If requests was an animal, what animal would it be? - @iamsharon2kx

If Requests were an animal, it would be a mantis shrimp — for many reasons, especially their eyes.

Why did the Pythonista cross the road? - @iamsharon2kx

The Pythonista crossed the road while waiting for a GIL context switch to randomly occur.

Find the full AMA here.