Skip to content

ReproNim/reproschema-protocol-cookiecutter

Repository files navigation

reproschema-protocol-cookiecutter

A Cookiecutter for ReproSchema protocols.

You can find a demo protocol here generated by this cookiecutter. Here is our online document to help you customize your newly generated protocol based on specific research needs. The relevant chapters are as follows:

Prerequisites

The following are required and recommended tools for using this cookiecutter and the ReproSchema protocol it generates. This is all a one-time setup, so if you have already done it, skip to the next section!

  • pipx

    pipx is a tool for managing isolated Python-based applications. It is the recommended way to install Poetry and cruft. To install pipx follow the instructions here: https://pypa.github.io/pipx/installation/

  • cruft

    cruft is a tool for generating projects based on a cookiecutter (like this one!) and keeping those projects updated if the original cookiecutter changes. Install it with pipx by running:

    pipx install cruft

    You may also choose to not have a persistent installation of cruft, in which case you would replace any calls to the cruft command below with pipx run cruft.

Creating a new protocol

Step 1: Generate the protocol files

To generate a new Reproschema protocol, run the following:

cruft create https://github.com/ReproNim/reproschema-protocol-cookiecutter

You will be prompted for a few values. The defaults are fine for most protocols, but do name your protocol something that makes sense to you! The interactive session will guide you through the process:

  1. protocol_name: Name of the protocol; use kebab-case with no spaces. Suggestions:
    • reproschema-protocol
    • mood-protocol
    • media-selection
    • mental-health-survey
  2. github_org: Your GitHub username or organization name. This is used to construct links to documentation pages.
  3. protocol_description: Description of the protocol.
    • A single brief sentence is recommended
    • Can easily be modified later
  4. number_of_activities: How many activities/assessments do you want to create? Choose between 1 and 5; later, it will randomly generate the number of activities you choose for your protocol.
  5. full_name: Your name
  6. email: Your email
  7. license: Choose a license for the project. If your desired license is not listed, you can update or remove the LICENSE file in the generated project.

Then, go to your protocol folder

cd my-reproschema-protocol  # using the folder example above
make setup

Step 2: Create a GitHub repository

  1. Go to https://github.com/new and follow the instructions, being sure NOT to add a README or .gitignore file (this cookiecutter template will take care of those files for you). Be sure your GitHub repo uses the same protocol_name

  2. Add the remote to your local git repository

    git remote add origin https://github.com/{github-user-or-organization}/{protocol_name}.git
    git branch -M main
    git push -u origin main
  3. Create the gh-pages branch

    • Fetch the latest changes from your repository (if any):
      git fetch origin 
    • Create and switch to the new gh-pages branch:
      git checkout -b gh-pages 
    • Push the gh-pages branch to remote:
      git push --set-upstream origin gh-pages

    This branch allows you to deploy your ReproSchema UI publicly.

Keeping your project up to date

To be up-to-date with the template, first check if there is a mismatch between the project's boilerplate code and the template by running:

cruft check

This indicates if there is a difference between the current project's boilerplate code and the latest version of the project template. If the project is up-to-date with the template:

SUCCESS: Good work! Protocol's cruft is up to date and as clean as possible :).

Otherwise, it will indicate that the project's boilerplate code is not up-to-date by the following:

FAILURE: Protocol's cruft is out of date! Run `cruft update` to clean this mess up.

Credits

This cookiecutter was made with pieces from Cookiecutter and linkml-project-cookiecutter.