Published by : Janis

Why import * is not allowed outside the global scope

So today I was looking at import machinery in Python due to this question about import styles in Persephone, an open source natural language processing library I’ve been contributing to. Looking around at this more I’ve found a couple of things that I didn’t realize before: Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0

How a web page request makes it down to the metal

The other day I was interested in how many steps occur between sending a POST or GET request from a website to the actual processing that happens on the CPU of the server. I figured that I knew bits and pieces of the puzzle but I wanted to see the complete path from the highest

Interfacing Python with C or C++

One of the main downsides of writing applications in Python is that they can run slow. When you run into an insurmountable runtime speed issue the commonly accepted wisdom is to either use a more efficient Python implementation such as PyPy or to write the performance critical code in a more efficient compiled language (usually

Putting the MMAP backed array library on PyPi

Given that the MMAP backed array library I have been working on is now in use with multiple projects I figure that the time has come to put it up on PyPi. The project started off as an in-house library that was used in a few projects, given we were making something fast for our

Refactoring: Heuristics library episode 2 – Separation of concerns

In this video we discuss the separation of concerns and apply that to improving some of the code: Summary Discussed the separation of concerns concept Improved code with this in mind Set up an upstream repository and updated the fork of the repo to get new upstream changes Made a PR with the changes in

Resolving CFFI install issues on Ubuntu

Some of my Python projects rely on a variety of packages, most of which install flawlessly via PIP. Recently I’ve been setting up a new machine running Ubuntu 16.04 and I ran into a few issues installing CFFI via PIP. Essentially CFFI requires some packages that are not installed by default on Ubuntu 16.04, the

Refactoring: Heuristics library episode 1 – introduction

We have a whole new refactoring series thanks to a library Billy has asked us to improve: Summary Here’s what happened in this video: First look at code Fixed mutable default parameter Set up Tox for testing Required writing a file Set up TravisCI for continuous integration Set up Coveralls for test coverage reports

Generating python bindings from C++11 with pybind11

Code for this tutorial found here: Recently I was involved in some discussion sparked by this blog post where “rdrewd” was talking about benchmarking a simple program that generated prime numbers in Python. The thing about this that I like is that it’s a very good example of a situation where making pragmatic decisions

Deprecation warnings in python

When you are maintaining a package you want to be able to deprecate functionality and be able to give your users advance warning when you know that something is going away in the future. Because we wish to warn users without breaking the code we want to have the ability to give information without changing

Which techniques help us be more productive?

A couple of years ago I was asked by a junior developer if I had any suggestions for techniques they could learn about to improve their productivity. It was a great question, one which I’m really glad I was asked as it showed interest and also got me seriously thinking about how you can improve