January 12, 2021

Rotoscoping with OpenCV/C++

One of the most basic problems in VFX is separating an object in a video from its background. The object then composited back into new environment or scene. This task has different names such as matting, keying or more popular term rotoscoping. In this demo you can see how a church in the foreground is separated from the background blue sky, which was later replaced with a sky full of stars. Read more

December 21, 2020

How to become a Python developer

In this post I present a Python software developer study plan. It consists of these 8 not-so-easy steps: Pick a project Choose tech specialization Learn Python basics Practice programming Learn the ecosystem Study computer science Prepare yourself for the job Find a mentor Why I’m writing that One of my former colleagues asked me a how to become a Python developer. Of course, there are thousands of courses, boot camps and different programs helping people to start a developer career. Read more

October 14, 2020

Chroma Keying with OpenCV/C++

Chroma keying - or blue/green screen matting - is a process of removing a specific color from the video to be replaced with another picture or video. Historically green or blue colors were used as a background because they are not dominant in human skin or clothes. However, when a weather forecaster puts on a green skirt it can lead to funny situations: Chroma keying became very popular technique not only on TV but in the movies. Read more

September 14, 2020

Uploading files to AWS S3 with Flask

One way to upload files using Flask is to literally create a route that accepts HTTP POST and saves bytes received on the disk. And with horizontal scaling you need to mount an external storage to every running instance that supports replication. Another option is to use object storage - like AWS S3 - and upload files directly from the frontend. In that case Flask will have a route that just generates and URL a frontend will upload to. Read more

September 6, 2020

Advanced fixtures with pytest

Other pytest articles: Why testing is important Types of tests Test driven Development Hello, World! Selecting tests with pytest Testing HTTP client with pytest Testing database with pytest Advanced fixtures with pytest Pytest plugins Now let’s create another test - it will test integration between our 2 components that talk to external systems - API and database cache. Let’s test that when we query a number twice - we call API only once that the result is saved to the database and fetched from it on the second call. Read more

September 6, 2020

Hello, World!

Other pytest articles: Why testing is important Types of tests Test driven Development Hello, World! Selecting tests with pytest Testing HTTP client with pytest Testing database with pytest Advanced fixtures with pytest Pytest plugins In this course, we will be working on a mobile phone number validation application. The application: - Accepts a number as input - For every number in the list - Normalize the number - Check cache if this number was validated before - If it’s not in cache call external service REST API to validate the number - print the normalized number and the result of validation Read more

September 6, 2020

Pytest plugins

Other pytest articles: Why testing is important Types of tests Test driven Development Hello, World! Selecting tests with pytest Testing HTTP client with pytest Testing database with pytest Advanced fixtures with pytest Pytest plugins There are lot of plugins in pytest ecosystem. Some of the widely used are listed here All the plugins can be installed with pip and invoked by providing an argument to pytest executable. pytest-cov This plugin calculates test coverage - how much of our code is covered by test. Read more

September 6, 2020

Selecting tests with pytest

Other pytest articles: Why testing is important Types of tests Test driven Development Hello, World! Selecting tests with pytest Testing HTTP client with pytest Testing database with pytest Advanced fixtures with pytest Pytest plugins Let’s add another requirement for our normalize function - it will raise an exception if the number contains a letter, or if a plus sign is not at the beginning. Now let’s think a bit about the design of the application. Read more

September 6, 2020

Test driven Development

Other pytest articles: Why testing is important Types of tests Test driven Development Hello, World! Selecting tests with pytest Testing HTTP client with pytest Testing database with pytest Advanced fixtures with pytest Pytest plugins Is it better to write test cases after the code has been written or beforehand? Usually, it’s cheaper to detect bugs as early as possible in the development process. And writing test cases first will minimize the time between when a defect is inserted into the code and when the defect is detected and removed. Read more

September 6, 2020

Testing database with pytest

Other pytest articles: Why testing is important Types of tests Test driven Development Hello, World! Selecting tests with pytest Testing HTTP client with pytest Testing database with pytest Advanced fixtures with pytest Pytest plugins We are going to use a database in our number testing application as a cache for API call results - API calls can be costly and we don’t want to check the same number twice against it. Read more

© Alexey Smirnov 2021