Case Study: Developing And Testing Python Packages With Uv - Pybites
Briefly

The article discusses the complexities of structuring Python projects, particularly for packages. It highlights common organizational challenges developers face, such as where to place tests and how to handle imports efficiently. The author demonstrates folder organization using the uv package manager, detailing that with Python 3.3 and higher, importing modules from a `src` directory is straightforward. However, complications arise in earlier versions, emphasizing the importance of understanding Python's import behavior in different structures.
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.
With Python 3.3 or higher, you will not see any error: $ python main.py I am a helper function.
A typical and recurring problem in Python is how to import code that lives in a different place from where it is called.
Things get tricky once you have enough code and decide to organise your code into folders.
Read at Pybites
[
|
]