Tutorials

23 Posts

Forwards compatibility with Python generators

PEP 479 changed how Python handled generators in a backwards incompatible manner, here's how to get compatible code working from Python 3.5+

Published on July 3rd, 2019 by Janis Lesinskis.

Deprecating module level variables

A good strategy when managing your packages is to have a strategy for deprecating functionality across versions. This way developers get…

Published on June 27th, 2019 by Janis Lesinskis.

Getting Altair to render inline in Jupyter

Run into the issue where Altair won't plot inline in your Jupyter notebooks? Here's a reason why it happens and how to fix it.

Published on April 11th, 2019 by Janis Lesinskis.

Making Raw NBConvert cells look visually distinct

When using Jupyter notebooks have you found the styling of code cells to be too visually similar to Raw NBConvert cells? We found the similarities in formatting made it visually harder to see when a cell was set to the wrong cell type when we were running workshops and editing our own data science notebooks. Here's how we changed it.

Published on March 27th, 2019 by Janis Lesinskis.

How to configure Jupyter to not autocomplete

Have you ever found the autocompletion of certain characters like brackets or quotes to be an annoyance in Jupyter? If so here's how to change the configuration to disable this.

Published on March 24th, 2019 by Janis Lesinskis.

How to capture the standard output stream from a Jupyter notebook cell

One thing you may want to do is to capture all of the standard output stream from a cell in a Jupyter notebook. You might also not want to change your code, here's how you can do that...

Published on March 9th, 2019 by Janis Lesinskis.

How to work with Jupyter notebook cell input and output

Wondered what those `In[10]` and `Out[10]` things are in your Jupyter notebooks and how to make use of them?

Published on March 8th, 2019 by Janis Lesinskis.

A hello-world with Python packaging

When you have used Python a lot you'll notice that you will use tools such as you are installing some python code in a way that can be…

Published on December 17th, 2018 by Janis Lesinskis.

Enabling IPv6 on an AWS VPC in the management console

Want those sweet, sweet 128-bit addresses for your AWS services?

Published on October 21st, 2018 by Aapeli Vuorinen.

MiniZinc introduction

You want to solve some kind of a combinatorial problem, it involves putting lots of fiddly pieces in different places and seeing if they fit together. Maybe they are physical things, such as boxes, maybe they are abstract things, such as people's schedules. Is this you? What you need is MiniZinc.

Published on September 18th, 2018 by Nick Downing.

NumPy introduction

You want to deal with bulk data from your Python program. You realise that looping over every cell of a huge array from your Python code would be silly. You also would like the convenience of many kinds of canned routine to transform your data easily and efficiently. Enter NumPy!

Published on September 16th, 2018 by Nick Downing.

Switching between YubiKey's PIV and PGP applets on macOS

Quick tip on using the PIV and PGP applets simultaneously on a YubiKey on macOS.

Published on September 13th, 2018 by Aapeli Vuorinen.

Finding the size of Python Objects

Ever wondered exactly much memory in bytes an arbitrary Python object requires?

Published on September 4th, 2018 by Janis Lesinskis.

How we install Node.js

Here's how we go about installing Node.js

Published on July 12th, 2018 by Janis Lesinskis.

Limiting the runtime of Python unit tests

Ever needed to limit how long your unit tests can run for? Here's an easy way to do that with pytest. There's a package called pytest…

Published on June 23rd, 2018 by Janis Lesinskis.

Cache locality in Python lists

The other day I got asked what the cache locality of lists in CPython was and how the lists are layed out in memory. Because I always tend…

Published on June 18th, 2018 by Janis Lesinskis.

Pytest fixtures with Flask

Recently I've been working on a web API with Flask, here's how I went about making unit tests with pytest work well with Flask and testing the API via requests.

Published on May 27th, 2018 by Janis Lesinskis.

Renaming Git branches

I've spent a few days in a cold office And one thing I notice is that I'm making a lot more typo's when it's cold. One particularly cold day…

Published on May 24th, 2018 by Janis Lesinskis.

Moving commits from one repository to another.

Sometimes you'll have a project where you have some files that you wish to break out into a new repository. For example when we were…

Published on May 11th, 2018 by Janis Lesinskis.

Enforcing foreign key constraints with SQLite

There was a perplexing issue we ran into when testing the [Persephone web API](https://github.com/persephone-tools/persephone-web-API/). There was a foreign key constraint specified in SQLAlchemy but you could add in new entries with bogus foreign keys without the DB engine raising an `IntegrityError`. Why did this happen?

Published on May 7th, 2018 by Janis Lesinskis.

Markdown editing workflows

Even before we moved our site to a JAM stack we found that we edited a number of Markdown files every day, for example those README.md…

Published on April 23rd, 2018 by Janis Lesinskis.

Python self references

This is a bit of Python trivia but Python containers can store items that are self references.

Published on April 22nd, 2018 by Janis Lesinskis.

Logging uncaught exceptions in Python applications

You want to be able to get good logging data from your applications to be able to reduce the amount of time that you require in order to fix issues and debug problems. This is especially important for any unhandled exceptions that crash the program. This tutorial will show you a convenient way of making sure these are logged.

Published on February 6th, 2018 by Janis Lesinskis.