Documenting how to use the generated project
Updating defaults
Producing a docker image
This is a Cookiecutter template to bootstrap a Python Flask based application.
pip install --user cookiecutter
cookiecutter https://git.sr.ht/~jgillis/python-flask-cookiecutter
Answer the questions prompted by cookiecutter and your project will be generated.
Start by initiating a git repository in your generated project:
git init
git add *
git commit -m "Initial commit"
git tag v0.0.1
Run the init goal of the Makefile. This installs all dependencies and creates a virtual environment:
make init
Enter the virtual environment
poetry shell
Build a docker image:
make clean docker
In the dist
folder you should find three files.
One tar file, containing the docker image.
One tar.gz file containing the source distribution of your Python package.
One whl file containing the binary distribution of your Python package.
Now you can either use poetry publish
to publish the Python artifacts to PyPI or your local repository.
The docker artifact can be deployed to your docker registry.
Or you use docker load < <your-project>-<version>.tar
to load it into a Docker engine.
Do note the difference between python_package_name
and module_name
.
The former is the name of you Python package (as used by pip and PyPi).
The latter is the name of the Python module.
For example, py-project
is a valid python_package_name
and py_project
(note the dash became an underscore) is a module name.
Make sure that python_package_name
and module_name
are equivalent, except that dashes in the python package name are replaced by underscores in the module name.