Question Details

No question body available.

Tags

python import microservices fastapi monolithic

Answers (1)

February 24, 2026 Score: 1 Rep: 578 Quality: Low Completeness: 50%

the cleanest practice is to namespace your code inside src/ with a unique package name per service like this:

users/
    src/
        usersservice/
            init.py
            models.py

all of your code will go inside usersservice/.

Why is this the best practice? because the way your imports become from users_service.models import and there's never a collision with products, even if both services share the exact same folder structure. The IDE resolves it without issues and Docker works the same since you install each service with pip install -e . from its own pyproject.toml. Let me know if there is any question :)