Packaging Python Packages with Poetry

Posted by Jack McKew on Wed 25 March 2020 in Python • Tagged with python • 6 min read

Packaging Python code to easily share code with others!

Building upon a previous post on "How many words have I written in this blog?", let's dive into how to share this code with other on PyPI and integrate into this website with a 'word ticker' which updates whenever a new …


Continue reading

Counting Words with Python

Posted by Jack McKew on Thu 19 March 2020 in Python • Tagged with python • 5 min read

Recursively counting words in markdown within a folder

In the last 55 posts, I've written 34846 words in this blog. In comparison, my engineering thesis for graduating university was 9916 words across 69 pages.

A question had popped into my mind this week, "How many words have I written in …


Continue reading

Python Bytes Awesome Package List

Posted by Jack McKew on Wed 11 March 2020 in Python • Tagged with python • 6 min read

Python Bytes is a weekly, short & sweet podcast by Michael Kennedy & Brian Okken. After having the podcast recommended numerous times by friends & colleagues, I decided to download every episode thus far on the 14th of September 2019. Over the next 174 days, whenever I was commuting, I'd listen to 171 …


Continue reading

3D Gradient Descent in Python

Posted by Jack McKew on Wed 26 February 2020 in Python • Tagged with python, visualisation, generative • 40 min read

Visualising gradient descent in 3 dimensions

Building upon our terrain generator from the blog post: https://jackmckew.dev/3d-terrain-in-python.html, today we will implement a demonstration of how gradient descent behaves in 3 dimensions and produce an interactive visualisation similar to the terrain visualisation. Note that my understanding of gradient …


Continue reading

Getting Started in Python

Posted by Jack McKew on Thu 20 February 2020 in Python • Tagged with python • 4 min read

Resources & tips for getting started in Python

Glossary

One of the most useful skills in my opinion in all walks of life is the ability to find information & answers. A very useful tool for doing this is the internet & search engines like Google. In my opinion being able to search …


Continue reading

Automatically Generate Documentation with Sphinx

Posted by Jack McKew on Mon 03 February 2020 in Python • Tagged with python • 5 min read

Document code automatically through docstrings with Sphinx

This post goes into how to generate documentation for your python projects automatically with Sphinx!

First off we have to install sphinx into our virtual environment. Pending on your flavour, we can do any of the following

1
2
3
pip install sphinx …

Continue reading

3D Terrain in Python

Posted by Jack McKew on Fri 24 January 2020 in Python • Tagged with python, visualisation, generative • 21 min read

Generating & Visualising 3D Terrains in Python

Today, let's put together a 3D visualisation of randomly generated 'terrain' with Python. Data visualisation is an absolutely key skill in any developers pocket, as communicating both data, analysis and more is thoroughly simplified through the use of graphs. While a picture tells a …


Continue reading

Intro To GeoPandas

Posted by Jack McKew on Wed 15 January 2020 in Python • Tagged with python, visualisation • 6 min read

Pandas for geospatial data

Personally whenever I am faced with a problem that involves analysing geospatial data, GeoPandas is the first tool/package I reach for. Extending on the Pandas dataframe data structure, GeoPandas brings functionality for working with points, polygons and more out of the box. This post is …


Continue reading

Migrating from Wordpress to Pelican

Posted by Jack McKew on Fri 20 December 2019 in Software Development • Tagged with python • 5 min read

For some time now I have been wanting to move away from Wordpress, due to my specific case of wanting to embed custom HTML and JavaScript code snippets to enable interactive data visualisation. Furthermore my previous workflow of posts was disjointed in which I would develop the code in a …


Continue reading

Making Executables Installable with Inno Setup

Posted by Jack McKew on Fri 08 November 2019 in Software Development • Tagged with python • 1 min read

Following on from last week's post on making executable GUIs with Gooey, this post will cover how to make the executables we have packaged up into installable files so our users can run them easily.

Once we have created the executable file for our GUI (which will be located in …


Continue reading

Making Executable GUIs with Python, Gooey & Pyinstaller

Posted by Jack McKew on Fri 01 November 2019 in Python • Tagged with python • 4 min read

Today we will go through how to go from a python script to packaged executable with a guided user interface (GUI) for users. First off we still start by writing the scripts that we would like to share with others to be able to use, especially for users that may …


Continue reading

Hands On Machine Learning Chapter 3

Posted by Jack McKew on Sat 12 October 2019 in Machine Learning • Tagged with machinelearning, ai, python • 3 min read

Chapter 3 is focusing in on classification systems. As brought up earlier, most common supervised machine learning tasks are regression (predicting values) and classification (predicting classes). This chapter goes through the 'Hello World' of classification tasks, the MNIST dataset. The MNIST dataset is a set of 70,000 images of …


Continue reading

Intro to Games in Python with Pyglet

Posted by Jack McKew on Fri 04 October 2019 in Python • Tagged with python, pyglet • 3 min read

Recently, I've been researching ways that I could run a 2D simulation (and hopefully 3D) with many moving pieces and there was a desire to make it interactive as well. I stumbled through many visualisation frameworks such as:

Eventually, through the motivation of …


Continue reading

Introduction to Pytest & Pipenv

Posted by Jack McKew on Fri 20 September 2019 in Python • Tagged with python, pytest, pipenv • 2 min read

Unit tests in general are good practice within software development, they are typically automated tests written to ensure that a function or section of a program (a.k.a the 'unit') meets its design and behaves as intended.

This post won't go into testing structures for complex applications, but rather …


Continue reading

Inheritance in Python

Posted by Jack McKew on Fri 13 September 2019 in Python • Tagged with python • 2 min read

As Python is a high level, general purpose programming language, which supports users to define their own types using classes, which are most often following the concept of object-oriented programming. Object-oriented programming is a type of software design in which users not only define the data type (eg, int) of …


Continue reading

Dunders in Python

Posted by Jack McKew on Fri 06 September 2019 in Python • Tagged with python • 3 min read

A 'dunder' (double underscores) in Python (also known as a magic method) are the functions within classes having two prefix and suffix underscores in the function name. These are normally used for operator overloading (eg, __init__, __add__, __len__, __repr__, etc). For this post we will build a customized class for …


Continue reading

Python Project Workflow

Posted by Jack McKew on Fri 30 August 2019 in Python • Tagged with python • 5 min read

This post will go through my personal preference on project structure and workflow for creating a new project and an insight how I work on my projects from a development point of view. I will go from the very start as if I did not have Python/Git installed on …


Continue reading

Linear Regression: Under the Hood with the Normal Equation

Posted by Jack McKew on Sun 25 August 2019 in Data Science • Tagged with python • 3 min read

Let's dive deeper into how linear regression works.

Linear regression follows a general formula:

$$ \hat{y} = \theta_0 + \theta_1x_1 + \theta_2x_2 + \cdots + \theta_nx_n $$

Where \(\hat{y}\) is the predicted value, \(n\) is the number of features, \(x_i\) is the \(i^{th}\) feature value and \(\theta_n\) is the \(n^{th}\) model parameter. This …


Continue reading

Intro to Web Scraping

Posted by Jack McKew on Fri 23 August 2019 in Python • Tagged with python • 4 min read

Following on from last weeks post where we analysed the amount of repeated letters within current New Zealand town names. There was still one part of that analysis that really bugged me, and if you noticed it was from the data set that was used was using the European town …


Continue reading

Looking for Patterns in City Names & Interactive Plotting

Posted by Jack McKew on Fri 16 August 2019 in Python • Tagged with python, datascience • 5 min read

Recently, I was traveling around New Zealand, and noticed in the Maori language they use letters back to back a lot like in the original Maori name for Stratford ("whakaahurangi"). So as any normal person does, I thought, well what town has the most repeated letters, and the idea for …


Continue reading