Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • How small businesses can leverage AI
    • Robots-Blog | Humanoide Robotik aus Deutschland: igus bringt neuen Serviceroboter auf den Markt
    • GM reimagines Hummer off-roader with California ideas unit
    • London’s DEScycle secures over €10 million in grant funding to scale critical metals recovery platform
    • How to Edit, Merge, and Split PDFs With Free Online Tools
    • Florida crackdown targets illegal machines in Sarasota
    • Audiophile-Oriented Noble Audio Debuts More Affordable Osprey Earbuds
    • New radio bursts detected from binary stars
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Tuesday, June 2
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»How to Spin Up a Project Structure with Cookiecutter
    Artificial Intelligence

    How to Spin Up a Project Structure with Cookiecutter

    Editor Times FeaturedBy Editor Times FeaturedOctober 13, 2025No Comments7 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    you’re something like me, “procrastination” would possibly as properly be your center identify. There’s all the time that nagging hesitation earlier than beginning a brand new venture. Simply fascinated by establishing the venture construction, creating documentation, or writing a good README is sufficient to set off yawns. It looks like watching a clean web page for a dreaded college essay. However bear in mind how a lot simpler it will get as soon as some useful LLM (like ChatGPT) offers a beginning template? The identical magic can apply to your coding initiatives. That’s the place Cookiecutter steps in.

    What Is Cookiecutter? 

    Cookiecutter is an open-source instrument that helps you create venture templates. It’s language-agnostic and works with nearly any programming language (and even exterior coding, do you have to want a standardized folder and file construction). With Cookiecutter, you possibly can arrange all of the boilerplate information (like READMEs, Dockerfiles, venture directories, or the rest), then rapidly generate new initiatives primarily based on that construction.

    The Cookiecutter workflow consists of three important steps:

    1. You outline your venture template.
    2. The person enters values for the variables you specify.
    3. Cookiecutter generates a brand new venture, robotically filling in information, folders, and variable values primarily based on the person’s enter.

    The next picture illustrates this course of:

    Workflow of a cookiecutter template utilization for “baking” new initiatives based on the predefined template. picture by creator

    1. Fundamental Laptop Setup

    You want minimal programming expertise to put in and use Cookiecutter. When you can open a command line window, you’re good to go.

    • On Home windows, sort “cmd” within the search bar and open the “Command Immediate.” 

    • When you haven’t already, set up pipx with:

    pip set up pipx

    Take a look at your set up by working: 

    pipx --version

    When you get a “command not discovered” error, add pipx to your PATH. First, discover the place pipx was put in: python -m website –user-base.

    This would possibly return one thing like /residence/username/.native. Search for the folder containing pipx.exe (on Home windows) or pipx (on macOS or Linux). In case you have no admin rights, the listing could be C:UsersusernameAppDataRoamingPythonPythonxxxScripts.

    I had so as to add pipx to my path and should you don’t have admin rights, you will have to do it every time you begin a brand new terminal window. It’s due to this fact really useful so as to add the situation completely to your Surroundings Variables settings. Nonetheless, if this setting is behind admin privileges, you continue to can add

    set PATH=C:UsersusernameAppDataRoamingPythonPythonxxxScripts;%PATH%

    Or

    set PATH=/residence/username/.native/bin;%PATH%

    Hopefully, you get a significant response for pipx --version now.

    2. Putting in and Setting Up Cookiecutter

    Cookiecutter is distributed as a Python bundle, so you possibly can set up it with pipx:

      pipx set up cookiecutter 

    Or just run it on the fly with: 

      pipx run cookiecutter ...

    Let’s stroll via making a venture template. On this instance, we’ll arrange a template for Streamlit apps (cookiecutter_streamlit_ml). 

    3. Creating the Template Construction

    Inside your cookiecutter_streamlit_ml folder, you want these two key elements:

    • cookiecutter.json – a JSON file that defines the variables you need customers to fill in (venture identify, creator, Python model, and so on.). 

    • {{ cookiecutter.directory_name }} – A placeholder folder identify outlined utilizing curly braces. This listing will comprise your venture’s construction and information. When the person creates a brand new venture out of your template, Cookiecutter will exchange this placeholder with the identify they offered. Be careful to maintain the curly braces! 

    Instance content material of a Cookiecutter template folder. picture by creator

    Your cookiecutter.json would possibly look one thing like this:

    Instance cookiecutter.json file. picture by creator

    First, you outline variables in cookiecutter.json which might be used all through the generated venture. At a minimal, you’ll desire a variable for the venture identify.

    For instance, I usually reference my GitHub repository in documentation. Moderately than getting into it repeatedly, I set a variable as soon as and let Cookiecutter populate each occasion robotically. Equally, I don’t wish to write out my identify in every readme or documentation file, so I set it initially.

    To keep away from points with Docker and ensure the right Python model is specified, I immediate for the Python model at venture creation, making certain it’s used within the generated Dockerfile.

    You may outline default values for every discipline in cookiecutter.json. Cookiecutter will robotically exchange each occasion of {{ cookiecutter.variable }} in your template information with the person’s enter. You can too use transformations like decrease() or exchange(‘ ‘, ‘_’) to keep away from points with areas in listing names.

    In my template, I choose offering detailed directions to customers somewhat than setting default values. This helps information those that would possibly skip studying the README and soar straight into venture creation.

    4. Constructing Out Your Template

    Now begins the enjoyable half, specifically defining your template. You might be doing it as soon as and for all, so it’s worthwhile to spend a while on it, which can drastically cut back your venture setup time in the long term.

    First, create the folder construction on your venture. This contains creating all folders that you just anticipate to make use of in your venture. Don’t fear, no matter is lacking or seems to be superfluous will be edited within the precise venture. For now, you’re merely creating the blueprint; the whistles and bells will probably be project-specific.

    Instance of predefined folder construction for future initiatives. This folder construction and all information will probably be instantiated as soon as the person executes the cookiecutter command. picture by creator

    After getting your folders prepared, you possibly can populate them with information. These will be both empty and even have some content material that you just would possibly in any other case continually copy-paste from different paperwork. In these information, consult with your cookiecutter variables wherever one thing must be set dynamically (e.g., the venture identify or the GitHub repo). Cookiecutter will robotically exchange these placeholders with person inputs, which will probably be requested for throughout venture setup. This spares you a whole lot of tedious copy-paste work, notably in your documentation information.

    A part of the content material of the Readme file, which will probably be instantiated whenever you “unbox” your cookiecutter template within the venture. Within the spinoff venture, the fields {{ cookiecutter. }} will probably be populated with the values offered throughout “unboxing”. picture by creator

    Lastly, deposit the entire cookiecutter_py_streamlit folder in your GitHub account, zip it, or depart it as it’s. Both manner, now you can …

    5. Use your template

    As soon as your template is prepared, creating a brand new venture turns into a snap:

    1. Open your terminal and navigate to the place you’d wish to create the venture. 

    2. Run one of many following instructions:

       • From GitHub: 

         pipx run cookiecutter gh:ElenJ/cookiecutter_streamlit_ml  (exchange along with your repo)

       • From a neighborhood folder: 

         pipx run cookiecutter /path/to/template_folder 

       • From a zipper: 

         pipx run cookiecutter /path/to/template.zip 

    3. Cookiecutter will ask you the questions outlined in cookiecutter.json. Present solutions—or simply press enter should you’ve set default values. 

    You might be requested to supply solutions to the questions you outlined within the cookiecutter template. The solutions you present will probably be used because the respective variables within the fields outlined by {{ cookiecutter.variable }}. picture by creator

    4. Voilà 🎉 your new venture folder is generated, full with folders, information, and references personalized to your inputs.

    Instantiated Readme with variables the person offered throughout setup. picture by creator

    You may synchronize your new venture with GitHub by both pushing it straight out of your IDE’s built-in Git performance or by creating a brand new repo on GitHub (making certain it’s empty and doesn’t embrace a Readme) after which transferring your generated venture folder there.

    And that’s it! You’ve turned what was a day-long chore right into a swift course of and have immediately generated plenty of information ready to be stuffed in along with your concepts. Trying on the new venture, you positively ought to have a sense of a productive day. When you’re nonetheless searching for steering on finest practices, take a look at the official Cookiecutter templates here.

    And as all the time: Glad coding!



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    Escaping the Valley of Choice in BI

    June 2, 2026

    Ensuring Data Integrity with Cryptographic Hashing and the Ethereum Blockchain

    June 1, 2026

    RAG Is Not Machine Learning, and the ML Toolkit Solves the Wrong Problem

    June 1, 2026

    How to Combine Claude Code and Codex for Maximum Coding Power

    June 1, 2026

    It’s the Lessons We Learned Along the Way. Or, Is It?

    June 1, 2026

    Proxy-Pointer RAG: Eliminating Wasteful Entity & Relations Extraction in Knowledge Graphs

    May 31, 2026

    Comments are closed.

    Editors Picks

    How small businesses can leverage AI

    June 2, 2026

    Robots-Blog | Humanoide Robotik aus Deutschland: igus bringt neuen Serviceroboter auf den Markt

    June 2, 2026

    GM reimagines Hummer off-roader with California ideas unit

    June 2, 2026

    London’s DEScycle secures over €10 million in grant funding to scale critical metals recovery platform

    June 2, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    Today’s NYT Connections: Sports Edition Hints, Answers for June 18 #268

    June 17, 2025

    Taiwan’s Energy Future: Nuclear or Renewables?

    October 2, 2025

    This Thanksgiving, we’re thankful for innovation and the teams making it happen

    November 25, 2025
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

    Type above and press Enter to search. Press Esc to cancel.