Image for post
Image for post

Ello ello ello my fellow engineers!

This post is a supplement to Episode 3 and Episode 4 of the How to build a Scalable Python Application series on YouTube (you can see Episode 2 here: https://youtu.be/FMUsVwcBOVY)

We’ll be going over how to setup your Python application with a Postgres database connection (created in Episode 2) using Flask and SQLAlchemy.

Firstly, for this project I’m using Pipenv, you can use whatever virtual environment and dependency management you like, but personally I like to use Pipenv.

The documentation for Pipenv is here: https://pipenv.pypa.io/en/latest/.

I wrote a blog about it a long time…


Image for post
Image for post

Ello ello ello my fellow engineers!

I have recently put together a weekly tutorial series for how to build a scalable Python application. The first episode can be seen here: https://youtu.be/0NcZjcGgkpE

This post is to support Episode 2 where we will create a Postgres database for our Python Application to interact with.

We’ll be doing the following to setup the database:

  • Install postgres
  • Create a SQL script:
  • Create a “clothes_shop” database
  • Create a “clothes_stock” table
  • Create a types for Clothes Types, Colours, Sexes and Sizes
  • Create a Rollback SQL script
  • Run script and create database

Installing Postgres

If you are using Mac…


Image for post
Image for post

Ello ello ello my fellow engineers!

I wanted to discuss Python Protocol.

Firstly, we will discuss a few format concepts and reasons for why we should follow a Python protocol. Then I’ll show you three tools that you can use to automate the whole process! We’ll cover the libraries Black, YAPF and iSort. Sound good? Let us begin…

If you are more of an auditory learner I’ve made a video on the basics of this discussion and the tools for automation here: https://youtu.be/q2d5vrw1Lss

What is best practice?

Is it just following PEP 8 style guide?

PEP 8 is code convention that is a living…


Image for post
Image for post

Ello ello ello my fellow engineers!

Recently I had to set up communication between two services we built, which was an interesting task to do. There are many message service options, but we ended up using AWS: SNS and SQS.

To begin, I’ll give you a quick intro into the background of why you use a messaging service. Then I’ll show you an example in Python about how to set up a simple SNS Topic, publish a message, set up an SQS Queue, subscribe to the SNS Topic and read a message consumed by the SQS Queue…so not much…

Have…


Image for post
Image for post

Ello, ello, ello my fellow engineers!

It’s been a while since I wrote one of these, but I’ve recently started a quest in sharing knowledge and maybe saving someone from banging their head against a wall the same way I did to solve a problem.

Here, I’ve put together some of my most commonly used pytest fixture mocks.

All these mocks I store in conftest.py and then just pull them into the tests I create as and when I need them.

Dependencies:

  • pytest
  • pytest_mock
  • flask
  • flask_sqlalchemy

How to Mock an Object:

"""conftest.py"""import pytest@pytest.fixture def mock_object(): class MockObject(object): object_id = "id" some_property = "some_property_value"…


This post is about my first experience from a blank canvas to production ready code using pipenv as the package manager plus testing using its virtual environment.

I would like to start with an analogy. I want you to imagine you are working in a restaurant as a waiter, and the chef says “today we will be serving the components of this meal on individual plates”.

The more complex the meal the more plates you will have to carry to the customers table.

You hear the bell, service is up, but the components of the meal are coming out at…


Image for post
Image for post

__author__ = “Alex Varatharajah”

class SoftwareEngineer:

“””So you made it! Through all the applications, all the tests and all the interviews… Welcome to ONZO! I have been here just over a month now as a Software Engineer, and I’d like to do a short retrospective on what my first month has been like.“””

def __init__ (self, day_one_python_engineer):

What better place to start than your first day? It is highly likely that you will be reading a “Day One Python Engineer” or an equivalent guide for your role on Confluence. You’ll be setting up your virtual environments, installing your IDE’s, setting…

AlexV

while(1): pour coffee | Knowledge (Sharing) is Power

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store