Setup your Python Project with simple steps

Manu
18 min readDec 24, 2022

Here is an example directory structure for a Python project using pytest, conftest.py, pytest.ini, a Makefile, setup.py, and an Azure DevOps pipeline YAML file:

project
├── src
│ ├── module1
│ │ ├── __init__.py
│ │ ├── test_module1.py
│ ├── module2
│ │ ├── __init__.py
│ │ ├── test_module2.py
│ ├── conftest.py
├── tests
│ ├── test_module1.py
│ ├── test_module2.py
├── docs
│ ├── doc1.md
│ ├── doc2.md
├── .gitignore
├── Makefile
├── pytest.ini
├── README.md
├── requirements.txt
├── setup.py
├── azure-pipelines.yml
  • The src directory contains the source code for your project, organized into modules.
  • The module1 and module2 directories contain the source code for your modules, along with test files (test_module1.py and test_module2.py).
  • The conftest.py file is a pytest configuration file that allows you to specify shared fixtures, hooks, and other pytest customization.
  • The tests directory contains test files for your project (test_module1.py and test_module2.py). These test files can be run using pytest.
  • The docs directory contains markdown files with documentation for your project.
  • The .gitignore file specifies files and directories that should be ignored by Git.
  • The Makefile is a file that specifies tasks that can be run from the command line using the make command.
  • The pytest.ini file is a pytest…

--

--