Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 128 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,128 @@
# PythonProject-Template
# PythonProject-Template

[![Star on GitHub](https://img.shields.io/github/stars/JeremieGince/PythonProject-Template.svg?style=social)](https://github.com/JeremieGince/PythonProject-Template/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/JeremieGince/PythonProject-Template?style=social)](https://github.com/JeremieGince/PythonProject-Template/network/members)
[![Python 3.6](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-310/)
[![downloads](https://img.shields.io/pypi/dm/MatchCake)](https://pypi.org/project/MatchCake)
[![PyPI version](https://img.shields.io/pypi/v/MatchCake)](https://pypi.org/project/MatchCake)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)

![Tests Workflow](https://github.com/JeremieGince/PythonProject-Template/actions/workflows/tests.yml/badge.svg)
![Dist Workflow](https://github.com/JeremieGince/PythonProject-Template/actions/workflows/build_dist.yml/badge.svg)
![Doc Workflow](https://github.com/JeremieGince/PythonProject-Template/actions/workflows/docs.yml/badge.svg)
![Publish Workflow](https://github.com/JeremieGince/PythonProject-Template/actions/workflows/publish.yml/badge.svg)
![Code coverage](https://raw.githubusercontent.com/JeremieGince/PythonProject-Template/coverage-badge/coverage.svg)

# Description

This is a template for a Python project.
It includes a basic project structure, a Dockerfile, a requirements.txt file a README.md file, etc.
The goal of this template is to provide a starting point for a Python project. Once you have cloned this repository,
you can start by changing the `attributes` of the project using the `change_project_attributes.py` script with
the following command:
```bash
python change_project_attributes.py --help
```

Then you can start developing your project by adding your code to the `src` directory.


The project is constituted by the following parts:

- **.github**: This directory contains the GitHub Actions workflows that are responsible for
- running the tests: `.github/workflows/tests.yml`
- build the distribution: `.github/workflows/build_dist.yml`
- build the documentation: `.github/workflows/docs.yml`
- **data**: This directory will contain the data that will be used and generated by the project.
- **dist**: This directory will contain the distribution of the project.
- **docs**: This directory will contain the documentation of the project.
- **images**: This directory will contain the images that will be used in the README.md file or in the documentation.
- **sphinx**: This directory contains the configuration of the Sphinx documentation.
- **src**: This directory will contain the source code of the project. This is where you will add your own sauce.
- **tests**: This directory will contain the tests of the project.
- **docker_files**: This directory contains the scripts that will help you build the docker image and run the
project in a container.
- *Dockerfile*: This file is responsible for building the docker image of the project.
- *.gitattributes*: This file is responsible for setting the git attributes of the project.
- *.gitignore*: This file is responsible for ignoring the files that you don't want to commit to the repository.
A basic one is already provided and should be enough for most of the projects.
- *requirements.txt*: This file is responsible for listing the dependencies of the project.
- *pyproject.toml*: This file is responsible for listing the dependencies of the project and the
configuration of the project.
- *README.md*: This file is responsible for providing information about the project.
A basic structure is provided after this little introduction.
- *change_project_attributes.py*: This script is responsible for changing the attributes of the project.
Feel free to remove it once you used it.
- *setup.py*: This file is responsible for setting up the project.
- *LICENSE*: This file is responsible for providing the license of the project.
- *run_pytests.py*: This script is used by the github actions to run the tests.

# README TEMPLATE

## Installation
### Development Dependencies

With `python` and `pip` installed, run the following commands to install the dependencies:
```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

With `poetry` installed, run the following commands to install the dependencies:
```bash
python -m venv .venv
source .venv/bin/activate
poetry install
```

## Scripting Usage
To run a single training, you can run the following command:
```bash
python -m <package_name> <your_parameters>
```
and to know the parameters you can use the help command:
```bash
python -m <package_name> --help
```

### Deployment
You will need to install Docker to run the trainings in a container.
You can install Docker by following the instructions [here](https://docs.docker.com/get-docker/).

To build the docker image of the project you can run the following command:
```bash
docker build -t <package_name>:latest .
```

The container can be run in two different modes:

- **release**: This mode is responsible for running the __main__.py of the current package.
- **it**: This is a development mode that is responsible for running the container in the interactive mode.

To run a mode `<mode>` you can run the following command:
```bash
docker run --name <package_name>-<phase> --detach --rm --volume=<data_path>:/<ROOT_DIR>/data -e "MODE=<mode>" <package_name>:latest <your_arguments>
```
where `<data_path>` is the absolute path in your local machine where you want to store the data generated by the phase.
The `<ROOT_DIR>` is the root directory of the project.

There is another way you can do all of this. You can use the `docker_files/build_image_and_run.py` script. This script
will build the image and run the mode you want. You can run the script with the following command:
```bash
python docker_files/build_image_and_run.py --mode=<mode>
```


## References


## License


## Acknowledgements


## Citation
```
```
File renamed without changes.