Table of Contents
- Motivation
- Features
- Installation
- Basic Usage
- Default Template
- Customizing Templates
- Makefile
- PDM
- pytest
🍪 Data Science Cookiecutter
The Data Science Cookiecutter 🍪 is an opinionated, yet configurable, Python project that provides a template for organizing and setting up data science projects. It uses the Cookiecutter project structure to create a standardized and reproducible project layout.
🎯 Motivation
Data science projects often require a well-structured project layout to ensure reproducibility and collaboration. The Data Science Cookiecutter aims to solve this problem by providing a project template. While it follows certain opinions about project organization, it also allows for easy customization to fit different project needs.
✨ Features
- Standardized project structure for data science projects
- Automatic generation of project files and folders
- Customizable templates for different project needs
- Customizable for multiple programming languages (currently, the default template currently only has Python)
- Easy project initialization with just a few command-line arguments
⚙️ Installation
The Data Science Cookiecutter is on pypi and can be installed using pip, poetry, pdm or conda.
pdm add datascience-cookiecutter
🚀 Basic Usage
To create a new data science project using the Data Science Cookiecutter, follow these steps:
- Open a terminal or command prompt.
cdto the directory where you want to create the project.- Run the following command:
cookiecutter myprojectwheremyprojectis the name of your project. - profit 🎉
📁 Default Template
├── data/
│ ├── processed
│ ├── raw
├── dev/
| ├── notebooks
│ └── scripts
├── src/
│ ├── __init__.py
│ └── main.py
├── tests/
│ ├── __init__.py
│ └── main.py
├── references/
├── Makefile
├── README.md
🛠️ Customizing Templates
If you want to customize the default template used by cookiecutter, you can create a templates.py file in your $HOME/.config/cookiecutter directory. Follow these steps:
- Open a text editor and create a new file called
templates.py. - Import the necessary classes
FolderandFileTemplateby adding the following lines totemplates.py:
from datascience_cookiecutter import Folder, FileTemplate
Define your custom template using the Folder and FileTemplate classes. Here's a minimal example:
MYTEMPLATE = Folder(
name="{{name}}",
subfolders=[
Folder(name="src", files=[FileTemplate(filename="main.py", content="print('Hello, world!')")]),
Folder(name="data"),
Folder(name="docs"),
],
files=[
FileTemplate(filename="README.md", content="# My {{name}}"),
],
)
Occurences of {{name}} will be replaced by the project name as provided
with cookiecutter myprojectname. To use your custom template, simply run the
cookiecutter command with the --template option followed by the name of
your custom template. For example:
$ cookiecutter myproject --template=MYTEMPLATE
Enjoy customizing your templates! ✨🧙♂️
🛠️ Makefile
A Makefile is a file containing a set of instructions, known as targets, used to automate tasks in software development. It provides a convenient way to define and organize common commands for building, testing, and managing a project.
In the provided Makefile, you have the following targets:
- install: Installs project dependencies using
pdm install. - test: Runs project tests with
pytest - format: Applies code formatting using
isortandblack. - lint: Performs linting and static type checking using
ruffandmypy
To use the Makefile, open a terminal or command prompt, navigate to your project directory, and run the desired target using the make command followed by the target name. For example:
make install
🔬 pytest
Pytest is a Python testing framework that allows you to write simple and scalable tests with a clean and expressive syntax. It provides powerful features like fixtures, test discovery, and test selection.
For more information, you can visit the official pytest website: pytest.org
Metadata
Release files for datascience-cookiecutter 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datascience_cookiecutter-0.4.3-py3-none-any.whl | Python 3 | none | any | Details |
Security for datascience-cookiecutter 0.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.