Saransh Kataria

Parsing and validating data in Python using Pydantic

Parsing and validating data in Python using Pydantic

  • March 23, 2021

The introduction of type hinting opened the gates for many great new features in Python. And data validation and parsing became easier to do with the use of type hints. Pydantic is one such package that enforces type hints at runtime. It throws errors, allowing developers to catch invalid data....

Using the optional chaining operator in JavaScript

Using the optional chaining operator in JavaScript

  • March 18, 2021

Every now and then, you come across a JavaScript feature that vastly changes the way you write it. Destructuring, arrow functions, modules have been some of those features for me. Optional chaining is going to be the next one on that list for me. Optional Chaining is in stage 4...

Statically type checking Python code using Pyright

Statically type checking Python code using Pyright

  • March 16, 2021

With the introduction of type hinting in Python 3.5, static typing and checking Python codes has started to gain popularity. While MyPy was the first tool to do static type checking of Python code, many other frameworks have been built after it. Pyright is one such tool built by Microsoft...

Adding fixtures and parameterized functions to PyTest

Adding fixtures and parameterized functions to PyTest

  • March 11, 2021

As we discussed in our post on getting started with Pytest, the framework allows us to reuse tests by using test fixtures and parameterized functions. In this post, we will learn how to do so. We will build on the simple calculator example that we discussed in the previous post...

Testing Python applications using Pytest

Testing Python applications using Pytest

  • March 9, 2021

Testing our code brings in a variety of benefits, including building confidence in the code’s functioning and having lesser regressions. Writing and maintaining tests requires some additional work, and that is why we want to leverage tools as much as we can. Python does provide inbuilt tools such as unittest...

How to format a Number as Currency using ES2015

How to format a Number as Currency using ES2015

  • March 4, 2021

The process to format a number as currency can be a tedious task. It feels like a small task, but the number of lines and the edge cases can keep on increasing when considering factors such as internationalization and different formatting standards. Luckily, ES2015 introduced an internationalization API which can...

Installing Intel-based packages using Homebrew on the M1 Mac

Installing Intel-based packages using Homebrew on the M1 Mac

  • March 3, 2021

I recently got the new Apple Silicon Mac (aka the M1 mac), which means having to deal with the pain points of buying the first generation of something product. Though things are slowly improving, there are still many gotchas when it comes to using the first generation of a product....

Getting started with Flask: a Python microframework

Getting started with Flask: a Python microframework

  • February 25, 2021

Flask is a python framework for writing web applications. It is a microframework, which as the name suggests, is a small, clean, and simple to use framework. It comes with a minimal set of features, which sounds like a strange choice at first. So why would we choose Flask if...