Repository containing scaffolding for a Python 3-based data science project using the scikit-learn ecosystem. Used as a demo for my DockerCon 2021 talk Conda (+pip) and Docker FTW!.
Simply follow the instructions to create a new project repository from this template.
Project organization is based on ideas from Good Enough Practices for Scientific Computing.
- Put each project in its own directory, which is named after the project.
- Put external scripts or compiled programs in the
bin
directory. - Put raw data and metadata in a
data
directory. - Put text documents associated with the project in the
doc
directory. - Put all Docker related files in the
docker
directory. - Install the Conda environment into an
env
directory. - Put all notebooks in the
notebooks
directory. - Put files generated during cleanup and analysis in a
results
directory. - Put project source code in the
src
directory. - Name all files to reflect their content or function.
After adding any necessary dependencies for your project to the Conda environment.yml
file
(or the requirements.txt
file), you can create the environment in a sub-directory of your
project directory by running the following command.
PROJECT_DIR=$PWD
ENV_PREFIX=$PROJECT_DIR/env
conda env create --prefix $ENV_PREFIX --file $PROJECT_DIR/environment.yml --force
Once the new environment has been created you can activate the environment with the following command.
conda activate $ENV_PREFIX
Note that the ENV_PREFIX
directory is not under version control as it can always be re-created as
necessary.
For your convenience these commands have been combined in a shell script ./bin/create-conda-env.sh
.
The script should be run from the project root directory as follows.
./bin/create-conda-env.sh
The list of explicit dependencies for the project are listed in the environment.yml
file. To see
the full lost of packages installed into the environment run the following command.
conda list --prefix $ENV_PREFIX
If you add (remove) dependencies to (from) the environment.yml
file or the requirements.txt
file
after the environment has already been created, then you can re-create the environment with the
following command.
./bin/create-conda-env.sh
In order to build Docker images for your project and run containers you will need to install Docker and Docker Compose.
Detailed instructions for using Docker to build and image and launch containers can be found in
the docker/README.md
.