Package: datascience_cookiecutter
Table of ContentsMotivationFeaturesInstallationBasic UsageDefault TemplateCustomizing TemplatesMakefilePDMpytest🍪 Data Science CookiecutterThe 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.🎯 MotivationData 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.✨ FeaturesStandardized project structure for data science projectsAutomatic generation of project files and foldersCustomizable templates for different project needsCustomizable for multiple programming languages (currently, the default template currently only has Python)Easy project initialization with just a few command-line arguments⚙️ InstallationThe Data Science Cookiecutter is onpypiand can be installed usingpip,poetry,pdmorconda.pdmadddatascience-cookiecutter🚀 Basic UsageTo 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.
├── Makefile         <- Makefile for project automation
├── README.md        <- Project documentation and instructions
├── pyproject.toml   <- Configuration file for dependencies and project metadata
├── data             <- Folder to store data
│   ├── final        <- Folder for final processed data
│   ├── processed    <- Folder for intermediate processed data
│   ├── raw          <- Folder for raw data
│   └── sim          <- Folder for simulated data
├── dev              <- Folder for development-related files
│   ├── notebooks    <- Folder for Jupyter notebooks
│   └── scripts      <- Folder for development scripts
├── docs             <- Folder for project documentation
├── myproject        <- Placeholder folder for the project itself (replaced with your project name)
│   ├──__init__.py  <- Python package initialization file
│   └── main.py      <- Main Python script for the project
├── references       <- Folder for reference materials
├── reports          <- Folder for project reports
│   ├── img          <- Folder for images and visualizations used in reports
│   └── report.md    <- Sample report file (Markdown format)
└── tests            <- Folder for project tests🛠️ Customizing TemplatesIf you want to customize the default template used bycookiecutter, you can create atemplates.pyfile in your$HOME/.config/cookiecutterdirectory. Follow these steps:Open a text editor and create a new file calledtemplates.py.Import the necessary classesFolderandFileTemplateby adding the following lines totemplates.py:fromdatascience_cookiecutterimportFolder,FileTemplateDefine 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
withcookiecutter myprojectname. To use your custom template, simply run the
cookiecutter command with the--templateoption followed by the name of
your custom template. For example:$cookiecuttermyproject--template=MYTEMPLATEEnjoy customizing your templates! ✨🧙‍♂️🛠️ MakefileA 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 usingpdm install.test: Runs project tests withpytestformat: Applies code formatting usingisortandblack.lint: Performs linting and static type checking usingruffandmypyTo 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:makeinstall❤️ PDMPDMis a Python package manager and build tool that provides an alternative to other package managers like pip or Poetry. It aims to simplify and enhance the management of project dependencies, virtual environments, and building distributions. Follow the link to install it. If you dont want to use it, you can customize the template to create your own Makefile and pyproject.toml.The template (and PDM) follow thePEP 621standard for project metadata to use a pyproject.toml file instead of setup.py. This file contains the project metadata and dependencies. It also allows you to specify details like the Python version and the project entry point.🔬 pytestPytest 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