Skip to main content

Msgspec FastAPI Integration: High Performance, Validation, and OpenAPI Docs

5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

msgspec is a Python library designed for high-performance serialization and validation, which makes it a powerful partner for FastAPI. It can be used as a drop-in replacement for FastAPI's default Pydantic models to handle data validation and schema generation, often leading to a significant speedup in API performance.

Msgspec Struct: High-Performance Data Classes and Why Choose Msgspec Over Pydantic

5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

msgspec.Struct is a powerful data class in the msgspec library that's used to define the schema of your data. It's similar to Python's built-in dataclasses or typing.NamedTuple, but it's specifically optimized for high-performance serialization and validation. When you use a Struct, msgspec can perform operations like JSON encoding and decoding significantly faster than standard Python methods because it has a predefined, static understanding of your data's layout.

How is GFM different from CommonMark?

3 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

GitHub Flavored Markdown (GFM) is a strict superset of the CommonMark specification. This means that GFM includes all the features of CommonMark and adds several of its own, making it a more feature-rich dialect of Markdown.

The key differences between GFM and CommonMark lie in the extra features GFM provides to support the collaborative nature of a platform like GitHub.

Github flavored markdown syntax

3 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

GitHub Flavored Markdown (GFM) is a superset of the CommonMark specification, which means it includes all the standard Markdown features plus several useful additions. It's the dialect of Markdown used on GitHub for things like issues, pull requests, wikis, and comments.

Git: Discard All Local Changes and Pull the Latest Remote Version

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

To discard all your local changes and pull the latest version from a GitHub repository, you need to completely reset your local branch to match the remote's state. This process removes all uncommitted and committed local changes.

This guide covers the most reliable methods, including situations where you want to preserve specific local files like .gitignore or clean up untracked files.

VIM Commands Cheatsheet

3 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

VIM Commands Cheatsheet no water, just straight to the point, such as - how to save and exit vim editor?!

ZSH: permission denied

3 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

zsh: permission denied: /Users/username/.zshrc occurs because your user account doesn't have the necessary file permissions to write to or execute the .zshrc file. This is a common issue after certain system updates, migrations, or when a file is created with elevated privileges.

To solve this, you need to change the file's ownership or permissions.

Markdown Reference Cheatsheet 2025

5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Markdown is a lightweight markup language that allows you to format plain text. It is widely used for documentation, writing articles, and creating web content.

Ultimate pre-commit Configuration for Python: Complete setup & Advanced practices

8 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Maintaining code consistency and preventing quality regressions across a development team can be challenging. Manually checking styles or reminding teammates about formatting imports leads to cognitive overhead and code reviews cluttered with style arguments.

By implementing pre-commit, you can automate code formatting, import sorting, stylistic linting, and static type checking directly into your Git commit lifecycle. This guide outlines the ultimate pre-commit configuration for Python, demonstrates how to centralize settings, and provides advanced optimization tips.

A Guide to Preserving YAML Formatting with PyYAML

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Python's PyYAML library is a powerful tool for working with YAML, but it has one common limitation: when you load a YAML file and dump it back, it doesn't preserve the original formatting. This can be a problem if you have multi-line strings formatted as literal blocks (|) and want to keep them that way for readability.

Fortunately, there's a straightforward and effective way to solve this by creating a custom representer for PyYAML. This guide will walk you through the process, using the code you provided, to ensure your multi-line strings are always dumped as literal blocks.

Looking for more content?
Hrekov Blog contains 165 articles. Browse the blog archive or Explore the full timeline.