Python package template for machine learning research
You can use this template for your own project:
- On GitHub, click the "New Repository" buttom.
- Under "Repository template" select "warwick-machine-learning-group/pywmlg".
- Create the repository, then clone it to your computer.
- On your computer, create a new branch.
- Use an IDE such as VSCode to find occurences of "pywmlg", and change them to be the name of your new repo/package.
- Change the name of the directory pywmlg to be the name of your python package.
- Create a pull request, then merge into the main branch once the tests have passed.
We recommend always using a virtual environment for every new project. For example, here is how to create and activate a new conda environment:
conda create -n pywmlg python=3.9
conda activate pywmlg
Install the package with pip
pip install -e .
To install pytest and linting libraries:
pip install -r requirements.txt
Run the unit tests with pytest:
pytest
Docker is great for reprodicible research. To build the image:
docker build -t pywmlg:latest .
Keeps the code neat and tidy.
We use pylint and mypy.
You can change pylint settings in the .pylintrc
file.
pylint pywmlg/*
mypy pywmlg
Some of the smaller linting issues can be cured by running the black formatter:
black */