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.
The pyproject.toml
file contains all the metadata for the project, including the project name, version, author, description, supported Python version, and more.
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.
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 theModuleNotFoundError: No module named 'python_project_boilerplate'
error when running this command, you're probably using the wrongpytest
executable. If you have installed the dependencies in a virtual environment, you should use:$ <path-to-env>/bin/pytest
.
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.
- Create a virtual environment using your favorite tool:
$ virtualenv -p python venv
- Install the project in
editable
mode:
$ 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
This project is licensed under the MIT License.