TIL - Importing annotations from future for concise Python typing

Posted on Fri 18 March 2022 in Dispatches • Tagged with python, til • 1 min read

Python 3.10 introduced several improvements for type hints, including a much more concise Union operator. This means that instead of using:

def square(number: Union[int, float]) -> Union[int, float]:
    return number ** 2

You can instead write this:

def square(number: int | float) -> int | float:
    return number ** 2

The …


Continue reading

TIL - Running make apidocs for Read the Docs

Posted on Mon 28 February 2022 in Dispatches • Tagged with python, til • 1 min read

I was hacking on my quote service the other day, and notice that Read the Docs wasn’t building my module level documentation, which meant that anyone that wanted to look at said modules in more detail was getting a 404 error. One option was to simply make running make …


Continue reading