Pipenv install with all the flags, explained

Posted on Thu 19 November 2020 in programming • Tagged with python, pipenv, docker

A common pattern of using pipenv in containers is to install as follows:

COPY Pipfile Pipfile.lock ./
RUN pip install --upgrade pip && \
    pip install pipenv && \
    pipenv install --system --deploy --ignore-pipfile && \
    pipenv --clear

What is going on here, exactly? How does one understand the intersection of the flags given to pipenv …


Continue reading

Dataclasses and mutable defaults

Posted on Tue 14 January 2020 in programming • Tagged with python

One common Python gotcha is the use of mutable objects as defaults for function keyword arguments. There are approximately one billion questions on SO about this or nice discussions elsewhere. I came across a nice feature in Python's dataclasses library that addresses a similar problem.

Mutable defaults are bad

As …


Continue reading

Using autoreload in IPython

Posted on Fri 13 September 2019 in programming • Tagged with python, ipython, jupyter

Using the autoreload extension.

%load_ext autoreload
%aimport mymodule
%autoreload 1

The autoreload command understands three levels:

  • 0 -> extension is disabled
  • 1 -> reload modules that were marked with %aimport
  • 2 -> reload everything

The easiest usage of autoreload is to not aimport anything and set %autoreload 2, which causes the extension to …


Continue reading

You need a doorbell

Posted on Fri 03 February 2017 in programming • Tagged with life, programming, python, twilio, flask

Sometimes a dumb technical approach can be a solution to a real world problem.

I live in a graduate residence that doesn't have a buzzer system. To be granted access, my guests have to text/call me directly and I have to walk downstairs to let them in. Though this …


Continue reading

Why I'm bailing on Julia for machine learning

Posted on Fri 04 November 2016 in programming • Tagged with julia, python, ml

I'm bailing on Julia for machine learning — just for my one class, that is. Don't worry ~too much~!

I'm taking graduate machine learning (6.867) this semester at MIT. There are three homework assignments in the course that are structured as mini-projects, in which students implement canonical algorithms from scratch …


Continue reading