Skip to content

A Python boilerplate project using setuptools as build backend 🐍

License

Notifications You must be signed in to change notification settings

compiuta-origin/python-project-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 Python Project Boilerplate

We kept this project simple on purpose, it is intended as a starting point for any Python project: ML packages, backend microservices or whatever the best programming language in the world (🐍) is awesome for! For example, we've used it to bootstrap multiple Connhex services.

This project was developed using the so-called src layout: see here for more details.

✨ Features

πŸ“ƒ Project Metadata

The pyproject.toml file contains all the metadata for the project, including the project name, version, author, description, supported Python version, and more.

πŸ“¦ Dependencies

All dependencies are listed in the requirements.txt file. This file is typically generated using the command:

$ python -m pip freeze > requirements.txt

Instead, the project.dependencies keyword within the pyproject.toml file should be used to specify what the project minimally needs to run correctly.

πŸ§ͺ Testing

The project is set up with pytest for testing. All test files should be placed inside the tests folder.

You can change the target tests folder by updating the testpaths variable in the pyproject.toml file.

To run the tests, simply use the following command:

$ pytest

⚠️ If you encouter the ModuleNotFoundError: No module named 'python_project_boilerplate' error when running this command, you're probably using the wrong pytest executable. If you have installed the dependencies in a virtual environment, you should use: $ <path-to-env>/bin/pytest.

🐳 Docker Support

The project includes a Dockerfile and a docker-build.sh script to build a Docker image of the project.

To build a Docker image of your project, use the following command:

$  ./docker-build.sh

This will create a Docker image with a python-project-boilerplate tag.

🎬 Getting started

  • Create a virtual environment using your favorite tool:
$ virtualenv -p python venv
$ python -m pip install -e .
  • Run:
$ python src/python_project_boilerplate/main.py

or using the console script defined in the pyproject.toml file:

$ python_project_boilerplate

πŸ’» License

This project is licensed under the MIT License.