Posts

Showing posts from May 12, 2025

Python Code Testing

 Let's look at how to test our Python code and follow the code coverage as much as possible. How to follow the MVC pattern in FastAPI How to write Pythonic code Types of testing with pytest Usage of patching , monkeypatching , fixture , and mocking 🚀 How to Follow the MVC Pattern in FastAPI FastAPI doesn’t enforce a strict MVC structure, but you can follow an organized MVC-like structure: 🔹 MVC Directory Structure Example app/ │ ├── models/ # ORM models (e.g., SQLAlchemy) │ └── user.py │ ├── schemas/ # Pydantic schemas (DTOs) │ └── user.py │ ├── controllers/ # Business logic (aka services) │ └── user_controller.py │ ├── routes/ # Route definitions │ └── user_routes.py │ ├── main.py # Entry point └── database.py # DB engine/session 🔹 MVC Mapping Model → app/models/ View → app/routes/ (FastAPI endpoints) Controller → app/controllers/ (business logic) 🐍 How to Write Pythonic Code Follo...

The Indian economy in April 2025

Image
The Indian economy in April 2025 presents a mixed yet cautiously optimistic outlook, with key indicators reflecting growth driven by domestic demand and services, but lingering structural challenges in manufacturing, exports, and infrastructure. Below is a detailed analysis and insight: --- Key Strengths 1. Improved Economic Activity:    - PMI Expansion: Both manufacturing PMI (57.5) and services PMI (58.5) remained above 50, indicating expansion in these sectors for April 2025. This suggests resilience in production and service delivery.    - GST Collections: Robust growth (9.4% YoY) reflects higher formalization of the economy and stronger domestic consumption.    - Digital Spending: UPI/IMPS transactions surged 32.2% YoY, signaling a deepening digital payment ecosystem and rising consumer confidence. 2. Rural Demand:     - Tractor Sales: A 6.8% YoY increase in April 2025 hints at improved rural income and agricultural activity, though seas...