Project is undergoing renovation. This was written before
uvandjustwere a thing. I am currently updating it to what I more recently have been using.
This repository exists because every time I have to set up a new Python project, there is just too much I have to do. So here is a useful template for myself. Feel free to clone it or download it if you want.
The project contains a justfile so that useful but long commands can be run without too much thinking. Besides, mypy, ruff are also configured.
A .env file lets you choose the project's name, the Python version and more stuff. Check the file please.
This template is to develop a PyTorch project, but you can change it to whatever you want.
It is implied that you are on Mac/Linux. No Windows.
You need to install 2 main tools:
just(see here) commands to facilitate users and developers (also see how we use it);- uv for managing Python.
Please also note that you could install
justviauv:uv tool install just. So we could say, in theory, that onlyuvis necessary to join the development of this project.
These tools will take care of everything for you. So make sure they are installed.
You can then do:
just installDeprecated, work in progress...
Build project's image as follows:
docker build -t <project-name> -f Dockerfile .
# or alternatively
make buildThe present folder will be mounted at /workdir.
- To start a Bash session in the container, run:
make bash - To start a Jupyter Notebook (+ a Tensorboard), run:
make up. Then runmake downwhen you're done. - To run PyTest from the container, run:
make pytest-image - To start a Python session in the container, run:
make docker-python - To start a development container, run:
make dev-containerormake up(if you go for this one, you can then kill the container withmake down). Make sure that you're notrootin the container. To see if a user with your local username and userid exists inside the container, runcat /etc/passwd. Then, you can runsu - <your-username>to change user insinde the dev container.
Please also note that our image's entrypoint is the script entrypoint.sh. This script solves common permission problems for developers who wish to mount their local source code directory on a container, as explained here. TL;DR: you will be logged into your container as your current user, thus avoinding any permission errors.
Please check the examples folder: here
Check the experiments folder: readme
If you wish to contribute to the project, please see here