This is a template for a standard git repository.
The core parts of this repo layout are: conda, pre-commit and code organised in a custom package.
Conda takes care of environments. If you haven't already, install conda.
Create a new conda environment:
conda env create -f environment.yaml
pre-commit is an easy way to organise your git hooks.
Set up pre-commit:
pre-commit install
Use gitignore.io to generate .gitignore files. For this default repository the following tags were used: python, jupyternotebooks, macos, windows, linux, visualstudiocode
Specify a conda environment for a repository. This makes it
name: conda_env_name
dependencies:
- python=3.9 # change python version
- pip
- pip:
- e . # install package from current directory
- pre-commit
# add your requirements
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: detect-private-key
- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-use-type-annotations
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.8.2
hooks:
- id: reorder-python-imports
setup_repo.sh
Most folders should be self-explanatory. For example: Final reports should be in the reports folder, every trained model should be in the models folder. If the files are too large, maybe add a link to where you can download them.
Contains all data necessary for analysis or training.
Documentation goes here
Everything regarding logging is going in here
All models should be in this folder
All notebooks (except final reports) go in here
Try to keep all references in this folder.
All final reports go in here.
All scripts go in here.
Here goes the code for the repo specific package. This makes it easy to install the code with pip, so relative imports are a thing of the past. With the -e
flag it get's installed in editable mode, which means you don't have to reinstall the package everytime you change something.
Per default this package gets installed with the conda environment setup.
Write tests and put them into this folder.