Skip to main content

CLI to create repos

Project description

qCradle

License: MIT PyPI version Coverage Status ci CodeFactor Renovate enabled

qcradle is a command line tool to create repos based on a group of templates. It has been created to accelerate, simplify and harmonize the development of experiments and quantitative strategies.

Assuming the presence of gh, uvx and a valid ssh-connection with GitHub you can start the tool with

uvx qcradle

Creating a repository from the command line

qcradle is a tool inspired by Cookiecutter, but more biased towards quants, researchers, and academics.

Whether you're building entire Python packages or financial models, running simulations, or writing academic papers, qcradle helps you hit the ground running with a structured and efficient setup following the most recent standards set in 2025.

We use uv, hatch, marimo and Tectonic. Supporting DevContainers, Renovate, and Dependabot, we take full advantage of GitHub Workflows.

Each template comes with curated pre-commit hooks. We compile Jupyter Books to collect test reports, API documentation, and notebooks.

Let’s make project setup as rigorous as your research!

Examples

Users can interact with qcradle by either creating templates or by using existing templates to create projects. We would be delighted to list your public work here:

User projects

We would like to encourage our users to point to public repositories created with the qcradle. We start with

  • cvxball. We created badges for you

User templates

Please share your templates with the world!

Install gh

Please install GitHub's official command line tool gh. This tool is used to create GitHub repos from the command line.

Verify the existence of the tool and a valid SSH connection with

ssh -T git@github.com
gh --version

Documentation to establish a new ssh keypair.

Install uv and uvx

uv is a modern, high-performance Python package manager and installer written in Rust. It serves as a drop-in replacement for traditional tools like pip and pipx. For macOS and Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

For Windows follow the official instructions

Understanding uvx

uvx is a command provided by uv to run tools published as Python packages without installing them permanently. It creates temporary, isolated environments for these tools:

uvx qcradle

This command will:

  • Resolve and install the qcradle package in a temporary environment.
  • Execute the qcradle command.

Note: If you plan to use a tool frequently, consider installing it permanently using uv:

uv tool install qcradle

Once the tool is permanently installed it is enough to start it with

qcradle

Templates

You could create your own templates and standardize project structures across your team or organization. It's essentially a project scaffolding tool that helps maintain consistency in Python projects.

We currently offer $4$ standard templates out of the box

  • The document template
  • The experiments template
  • The package template
  • The R template

Standard Templates

We follow the one template, one repository policy. You are encouraged to create your own templates and we give $4$ examples that may serve as inspiration

The document template

The template supports the fast creation of repositories of LaTeX documents. The repo can compile your LaTeX documents with every commit and put them on a dedicated branch.

The experiments template

Here we support the creation of notebooks without the ambition to release software. The repo is not minimalistic but comes with a curated set of pre-commit hooks and follows modern and established guidelines. The notebooks are based on Marimo.

The package template

The package template is most useful when the final goal is the release of software to a registry, e.g. pypi. It offers full uv support and compiles documentation into a Jupyter Book.

The R template

Here we expose R Studio in a devcontainer.

Proprietary templates

Creation

You can create your very own templates and we recommend to start with forking the dedicated repo for the job.

Templates rely on Jinja. At the root level the repo needs a 'copier.yml' file and a 'template' folder.

Each template is tested using act, e.g. we render the project template and test the workflows of the created project. This helps to avoid creating projects starting their life in a broken state.

Usage

We essentially expose the copier interface directly with minor modifications, e.g. if the user is not submitting a source template we offer to choose one of the standard templates.

Any cradle template could be used directly as the first 'template' argument

uvx qcradle --template=git@github.com:tschm/paper.git

By default, Copier (and hence the repo-launcher) will copy from the last release found in template Git tags, sorted as PEP 440.

Update existing projects

Templates are moving targets in most professional setups. It is possible to update projects created with the help of the qcradle by specifying an existing path instead of a template.

uvx qcradle --dst_path=/Users/thomasschmelzer/projects/my_marimo_experiments

The tool expects a full path. Your repo should contain your previous answers in a file '.copier-answers.yml' which serve as default arguments for the questions you have been asked before. All standard templates create the file.

GitHub Actions

This repository provides a collection of reusable GitHub Actions that can be used by other repositories. These actions are defined in the actions directory and can be referenced in your workflows.

Available Actions

  • age: Encrypts and decrypts files using age
  • book: Builds and publishes a Jupyter Book
  • build: Builds a Python package and uploads artifacts
  • coverage: Generates and uploads code coverage reports
  • cradle: Runs the qCradle tool
  • deptry: Checks for dependency issues using deptry
  • docker: Builds and pushes Docker images
  • environment: Sets up Python environment with dependencies
  • flow: Tests GitHub workflows using act
  • jupyter: Runs Jupyter notebooks
  • latex: Compiles LaTeX documents
  • marimo: Runs marimo notebooks
  • pdoc: Generates API documentation using pdoc
  • pre-commit: Runs pre-commit hooks
  • tag: Bumps version, creates a tag, and publishes a release
  • test: Runs tests with pytest

How to Use These Actions

You can use these actions in your GitHub workflows by referencing them with the uses keyword. For example:

jobs:
  tag:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Generate Tag
        uses: tschm/cradle/actions/tag@main
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

Replace tschm/cradle with the appropriate repository owner and name, and @main with the branch, tag, or commit SHA you want to use.

Each action has its own inputs and outputs defined in its action.yml file. You can find more details by examining these files in the repository.

Docker Images

This repository provides a versatile Docker image that can be used by various GitHub Actions.

Multi-purpose Action Docker Image

The repository includes a custom Docker image that serves as a comprehensive environment for running various GitHub Actions:

  • Base: Ubuntu 22.04

  • Development Tools:

    • Node.js 20 with npm
    • Python 3 with pip, venv, and dev packages
    • Git, curl, wget, zip/unzip, jq
    • Build essentials and other utilities
  • Document Processing:

    • Tectonic (LaTeX compiler)
    • Biber (Bibliography processor)
  • Pre-installed Python Packages:

    • Testing: pytest, pytest-cov, pytest-html, pytest-random-order
    • Documentation: jupyter-book, sphinx-math-dollar, pdoc
    • Notebooks: marimo
    • Data processing: pandas, toml, requests, packaging

The Dockerfile for this image is located in the docker directory. The image is built and pushed to GitHub Container Registry (ghcr.io) using the GitHub workflow defined in .github/workflows/docker.yml.

Using the Docker Image

This image is currently used by the flow action to test GitHub workflows using the act tool, but it can be used for various other actions as well. The image is designed to be a comprehensive environment that includes most tools and dependencies needed by the actions in this repository.

You can use this image in your own workflows by referencing it in your workflow file:

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/tschm/cradle/flow-action:latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      # Your steps here

The image is particularly useful for:

  • Running tests with coverage reporting
  • Building documentation (LaTeX, Jupyter Book, pdoc)
  • Processing Marimo notebooks
  • Analyzing dependencies
  • Testing GitHub workflows locally

:warning: Private repositories

Using workflows in private repos will eat into your monthly GitHub bill. You may want to restrict the workflow to operate only when merging on the main branch while operating on a different branch or deactivate the flow.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

qcradle-0.1.66.tar.gz (815.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qcradle-0.1.66-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file qcradle-0.1.66.tar.gz.

File metadata

  • Download URL: qcradle-0.1.66.tar.gz
  • Upload date:
  • Size: 815.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qcradle-0.1.66.tar.gz
Algorithm Hash digest
SHA256 4a32209a4299abfd5a91d7e73f359e40edd6eec6ed1e6c499d8e45cf23b99198
MD5 f35f00ce70599c840ed220f9acce0dbc
BLAKE2b-256 f9f6b0c8b33703266aeacf94eed5984efbf1f523103fdc9a5c4ecda68a734626

See more details on using hashes here.

Provenance

The following attestation bundles were made for qcradle-0.1.66.tar.gz:

Publisher: release.yml on tschm/cradle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qcradle-0.1.66-py3-none-any.whl.

File metadata

  • Download URL: qcradle-0.1.66-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qcradle-0.1.66-py3-none-any.whl
Algorithm Hash digest
SHA256 703d848571a5486a23de8e96c93f1aa668f52d6f64db785b40394d886a1e95e7
MD5 ed2f146f358e3b6a42d8bfe9a565909c
BLAKE2b-256 493c555bdfbaaa6623f4163fe3f725a1aee2e4bb3dbf3211cc6b96ac4aba3603

See more details on using hashes here.

Provenance

The following attestation bundles were made for qcradle-0.1.66-py3-none-any.whl:

Publisher: release.yml on tschm/cradle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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