Skip to content

A template repository for Python coding projects.

License

Notifications You must be signed in to change notification settings

eringrant/coding-project-template

Repository files navigation

coding-project-template

This repository template is useful for developing research-oriented coding projects as Python packages.

Citation

To cite the work that this code is associated with, use:

@inproceedings{TODO_citation_key,
  title={TODO},
  author={TODO},
  booktitle={TODO},
  year={TODO}
}

Quickstart

Clone the repo:

git clone git@github.com:eringrant/coding-project-template.git
cd coding-project-template/

To install a Conda environment with the requisite packages on CPU:

conda env create --file environment-cpu.yml

To test that the package can be imported successfully:

conda activate TODO_package_name
python -c "import TODO_package_name"

Setup

Installing packages

Any of the following installation methods will allow you to activate the environment with conda activate TODO_package_name.

Option #1: Conda install (CPU-only)

To install via Mamba (recommended) or Conda, do:

conda env create --file environment-cpu.yml

Option #2: Conda install on GPU on a local machine

To install via Mamba (recommended) or Conda with GPU support, do:

conda env create --file environment-gpu.yml

Option #3: Conda install on GPU on a SLURM cluster

If working on the head node of a SLURM cluster, you will need to create a GPU-compatible environment on a compute node with an available GPU via:

srun --partition=gpu --gres=gpu:1 conda env create -f environment-gpu.yml

Note that you may have to adapt the partition name to the available partitions on your cluster; run sinfo -s to display details about partitions.

Storage locations

To avoid using up too much disk space in your home directory, make sure to point some packages to alternative locations by adding the following to a shell configuration file, such as ~/.bashrc or ~/.zshrc. (Remember to replace the ellipsis ... with your desired locations!)

# Transient output.
export SCRATCH_HOME="..."

Devtools

Pre-commit

.pre-commit-config.yaml has been configured to run several autoformatters, including the Black autoformatter as well as Flake8. Run the following to install, update, and cache all pre-commit tools:

pre-commit install && pre-commit run

About

A template repository for Python coding projects.

Resources

License

Stars

Watchers

Forks

Languages