FarmaciaSenovillaSancho.com

From SQL to SQLModel: A Cleaner Way to Work with Databases in Python

SQLModel is a library that lets you interact with databases through Python code with Python objects and type annotations instead of writing direct SQL queries. Created by the same author of the extremely popular framework FastAPI, it aims to make interacting with SQL DBs in Python easier and elegant, with data validation and IDE support,… Continue reading From SQL to SQLModel: A Cleaner Way to Work with Databases in Python

From Backend to Frontend: Connecting FastAPI and Streamlit

In my previous Pybites article, I showed how I built and deployed a book tracking API using FastAPI, Docker, and Fly.io. That project taught me a lot about backend development, containers, and deploying modern APIs. But a backend alone isn’t enough—users need an interface. And FastAPI’s Swagger UI, while useful for testing, just isn’t user-friendly… Continue reading From Backend to Frontend: Connecting FastAPI and Streamlit

Case Study: Developing and Testing Python Packages with uv

Structuring Python projects properly, especially when developing packages, can often be confusing. Many developers struggle with common questions: To help clarify these common challenges, I’ll show how I typically set up Python projects and organise package structures using the Python package and environment manager, uv. The challenge A typical and recurring problem in Python is… Continue reading Case Study: Developing and Testing Python Packages with uv

Optimizing Python: Understanding Generator Mechanics, Expressions, and Efficiency

Python generators provide an elegant mechanism for handling iteration, particularly for large datasets where traditional approaches may be memory-intensive. Unlike standard functions that compute and return all values at once, generators produce values on demand through the yield statement, enabling efficient memory usage and creating new possibilities for data processing workflows. Generator Function Mechanics At… Continue reading Optimizing Python: Understanding Generator Mechanics, Expressions, and Efficiency

The Mutable Trap: Avoiding Unintended Side Effects in Python

Ever had a Python function behave strangely, remembering values between calls when it shouldn’t? You’re not alone! This is one of Python’s sneakiest pitfalls—mutable default parameters. Recently someone asked for help in our Pybites Circle Community with a Bite exercise that seemed to be behaving unexpectedly. It turned out that this was a result of modifying a mutable parameter… Continue reading The Mutable Trap: Avoiding Unintended Side Effects in Python