Skip to main content

No project description provided

Project description

Ruff Code style: black

License: MIT

Table of Contents

๐Ÿช 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:

  1. Open a terminal or command prompt.
  2. cd to the directory where you want to create the project.
  3. Run the following command: cookiecutter myproject where myproject is the name of your project.
  4. 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:

  1. Open a text editor and create a new file called templates.py.
  2. Import the necessary classes Folder and FileTemplate by adding the following lines to templates.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 isort and black.
  • lint: Performs linting and static type checking using ruff and mypy

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

datascience_cookiecutter-0.4.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file datascience_cookiecutter-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for datascience_cookiecutter-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9e97021ce0e77eb30fcb2f58a9b389f97299642ef1d3a3fa3015eb86c6ff541b
MD5 cb7a67628b8c92dccbaa35cd3e9ba907
BLAKE2b-256 b23c311c5f1f16fa806c37879352bb45c19f228db6e7de9e2babcabc98507f1d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page