This is just a quick step by step guide taken from DigitalOcean’s tutorial (see the references at the bottom). The main difference is that it has less explanation – so…
Pipenv: basic overview
Pipenv essentially acts as a replacement for pip. It introduces 2 “new” files: Pipfile (“replacement” for requirements.txt) and Pipfile.lock which ensures that builds are deterministic. Pipenv uses pip and virtualenv under the…
Conda cheat sheet
Create new environment: conda create –name sandbox python=3.5 Create the environment from the environment.yml file: conda env create -f environment.yml Activate specific environment: source activate sandbox Export your active environment to a…
tmux cheatsheet
My personal tmux cheat sheet Create a new session: tmux new -s myname Attach: tmux a Attach to a specific named session: tmux a -t myname List of sessions: tmux…
Python3 strings
A bit of background on unicode and UTF-8: Unicode has a different way of thinking about characters. In Unicode, the letter “A“ is a platonic ideal. It’s just floating in…
Python PDB
Last month I attended PyMunich conference and in this blog post I want to highlight a talk by Philip Bauer (“Debug like a pro. How to become a better programmer through…
Releasing Python Packages
When you need to fix a bug, add feature or change existing functionality in a library that you are using there are several ways to do this. Here I will…
How to mock ‘open’ built-in function
Here is a code snippet on how to test open built-in function: Code to test: def my_function(self, id: int) -> None: file_path = ‘path/to/files/{}.txt’.format(id) with open(file_path, ‘w’) as f: f.write(‘< My data…
How to mock __import__ built-in function
So lets say we need to write unit test for piece of code that uses __import__ built-in function: def task_we_want_to_test(task_name: str, task_class: str, env: dict) -> Task: module = __import__(…
Git branch naming convention
The naming convention, I propose, have four sections: Story Type: add == Add Feature fix == Fix, Hotfix, Bug, … clean == Cleanup, Chore, … modify == Modify existing functionality Short Summary: 2-3…