Azure Functions and FastAPI

I’m a huge fan of FastAPI. It’s a high-performance web framework for building APIs in Python, based on type hints and Pydantic, which enables automatic documentation and data validation. At work, we extensively use Azure Functions. These are serverless resources that reduce the need for infrastructure configuration and maintenance, allowing us to focus more on writing code. To create Azure Functions in Python, we can use the azure-functions package. However, I really love FastAPI as a framework for building APIs....

December 14, 2024 · Max Scheijen

HTML Form and JSON for single endpoint in FastAPI

A common challenge when building a FastAPI application is handling different content types, like JSON and Form data. Any many cases your API needs to support both formats, especially when dealing with web forms and modern front-end applications that often send json payloads. This post demonstrates how to build a FastAPI application that handles and validates both JSON and from data inputs on a single endpoint. The Challenge: Handling Different Content Types By default, web browsers use application/x-www-form-urlencoded or multipart/form-data content types when submitting forms....

October 5, 2024 · Max Scheijen

Python Development Setup

Recently, I started to center my python development around uv and other tooling developed by astral.sh. It allows me to manage python environments, linting and formatting. Managing Python Packages using uv uv is an extremely fast Python package and recently also became a full on package manager. You can install it using curl. curl -LsSf https://astral.sh/uv/install.sh | sh You can then create a new a new Python project, or use an existing one by running the uv init command:...

September 7, 2024 · Max Scheijen

Python to Change VIM

The programming language I’m most familiar with is python. I also started to learn vim recently. How can I combine the two? I discovered that I can use python (or any programming language for that matter) to manipulate text in vim. You simply need to read from the standard input, and provide a output. Script So I wrote a basic python script that can lower case a string. ~/.dotfiles/scripts/lower #!/usr/bin/python3 import sys def to_lower() -> str: return sys....

August 22, 2024 · Max Scheijen