Python

A dynamic programming language used heavily in the startup and scientific community.

  • Running Python in the Browser

    There are several projects that are using WebAssembly to run python in the browser. So far, the most useful looks to be running jupyter in the browser which can be deployed as a static site. That means you get a full fledged notebook and a kernel that can run any PyPi package that is pure python.

  • How to Make Python Functions Extensible

    Let’s say you have a python function that is used widely throughout your code base. You need to make changes to it. You change the arguments and everything breaks. You painstakingly update all call sites and hope that, when the tests pass, it’s all working as expected.

  • List of Boring Technology

    The following list of things are my choices for boring technology.

  • Python Data Classes Are Shorthand Structs

    A Python dataclass simplifies the setup of a class with many attributes. By adding the `datacass` decorator to a `Class` you can any number of typed attributes and it will generate an `_init_` method for you with default values. This is convenient when you are modeling a data heavy application and using classes (rather than dicts) to get better type check errors.

  • Fastapi Logging in ECS Is Kafkaesque

    Getting logging to work using FastAPI in a production ECS environment is a mess of configuration and awkward interfaces. For example, there are multiple modules that interact in subtle ways: the python logging module, uvicorn, and gunicorn. Take a look at this example of the ceremony required to appease all three loggers depending on the run time—not quite the spirit of python ‘explicit over implicit’.

  • Python Type Hinting

    Python 3+ has type annotations that can be used for static type checking using a separate program. There are several competing type checkers (mypy, pyright, pyre) that can be used that are sponsored by different companies (Facebook, Microsoft).

  • Emacs Hyperbole

    Hyperbole is an emacs package that matches text and turns it into links (buttons in hyperbole parlance). Links can execute arbitrary code so it’s kind of like a universal emacs subsystem for linking things together (i.e. hypertext).

  • Chromadb

    ChromaDB is a vector database used for similarity searches on embeddings. It’s extremely easy to use if you are using Python and works well with LangChain.

  • Org-Ai Emacs Integration

    I built org-ai using Python which exposes an AI chat interface through a simple CLI. This makes it a bit clunky when using it from Emacs—I would need to open up an instance of a terminal, activate the virtual environment, and execute the program to start the chat.

  • Coming Back to Rust After 4 Years

    I recently picked up rust for a personal infrastructure project and was amazed at the amount of progress on the language and tooling over the years.

  • Squash Migrations Using Alembic and Postgres

    Over time, a Python project accumulates many migrations using alembic. This can slow down tests (you need to run all migrations every time you create a test DB) and it’s very unlikely you will ever rollback past a certain point in time.

  • Abstractions Save Time Working, but Not Learning

    Software abstractions save us time doing work by not having to write programs from lower level building blocks. Programming languages like Python provide an easier way to write general purpose software than say, assembly language.