Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This file is part of the jebel-quant/rhiza repository
# (https://github.com/jebel-quant/rhiza).
#
root = true

# Default settings for all files
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8

# Python, reStructuredText, and text files
[*.{py,rst,txt}]
indent_style = space
indent_size = 4

# YAML, JSON, and other config files
[*.{yml,yaml,json}]
indent_style = space
indent_size = 2

# Markdown files
# [*.{md,markdown}]
# trim_trailing_whitespace = false

# Makefiles require tabs
[{Makefile,*.mk,*.make}]
indent_style = tab
indent_size = 4

# Don't apply editorconfig rules to vendor/ resources
# This is a "defensive" rule for the day we may have
# the vendor folder
[vendor/**]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
67 changes: 67 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This file is part of the jebel-quant/rhiza repository
# (https://github.com/jebel-quant/rhiza).
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-toml
- id: check-yaml
args: ['--unsafe']

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.15.1'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix, --unsafe-fixes ]

# Run the formatter
- id: ruff-format

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.47.0
hooks:
- id: markdownlint
args: ["--disable", "MD013"]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.36.1
hooks:
- id: check-renovate
args: [ "--verbose" ]

- id: check-github-workflows
args: ["--verbose"]

- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
hooks:
- id: actionlint

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject

- repo: https://github.com/PyCQA/bandit
rev: 1.9.3
hooks:
- id: bandit
args: ["--skip", "B101", "--exclude", ".venv,tests,.rhiza/tests,.git,.pytest_cache", "-c", "pyproject.toml"]

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.2
hooks:
- id: uv-lock

- repo: https://github.com/Jebel-Quant/rhiza-hooks
rev: v0.3.0 # Use the latest release
hooks:
# Migrated from rhiza
- id: check-rhiza-workflow-names
- id: update-readme-help
# Additional utility hooks
- id: check-rhiza-config
- id: check-makefile-targets
- id: check-python-version-consistency
# - id: check-template-bundles
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
37 changes: 37 additions & 0 deletions .rhiza/.cfg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[tool.bumpversion]
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(?:-(?P<release>[a-z]+)\\.(?P<pre_n>\\d+))?(?:\\+build\\.(?P<build_n>\\d+))?"
serialize = ["{major}.{minor}.{patch}-{release}.{pre_n}+build.{build_n}", "{major}.{minor}.{patch}+build.{build_n}", "{major}.{minor}.{patch}-{release}.{pre_n}", "{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
commit = true
message = "Chore: bump version {current_version} → {new_version}"
commit_args = ""
pre_commit_hooks = ["uv sync", "git add uv.lock"] # Ensure uv.lock is updated

[tool.bumpversion.parts.release]
optional_value = "prod"
values = [
"dev",
"alpha",
"beta",
"rc",
"prod"
]

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'

# [[tool.bumpversion.files]]
# filename = ".rhiza/template-bundles.yml"
# search = 'version: "{current_version}"'
# replace = 'version: "{new_version}"'
9 changes: 9 additions & 0 deletions .rhiza/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MARIMO_FOLDER=book/marimo/notebooks
SOURCE_FOLDER=src
SCRIPTS_FOLDER=.rhiza/scripts

# Book-specific variables
BOOK_TITLE=Project Documentation
BOOK_SUBTITLE=Generated by minibook
BOOK_TEMPLATE=.rhiza/templates/minibook/custom.html.jinja2
# PDOC_TEMPLATE_DIR is now defined in .rhiza/make.d/08-docs.mk with a default value
2 changes: 2 additions & 0 deletions .rhiza/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dedicated rhiza ignore rules
!.env
1 change: 1 addition & 0 deletions .rhiza/.rhiza-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.11.0
81 changes: 81 additions & 0 deletions .rhiza/assets/rhiza-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions .rhiza/docs/ASSETS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Assets

The `.rhiza/assets/` directory contains static assets used in the Rhiza project, such as logos, images, and other media files.

## Contents

- `rhiza-logo.svg`: The official Rhiza project logo.

## Usage

These assets are primarily used in:
- The main `README.md` file.
- Generated documentation and the companion book.
- Project presentations.
47 changes: 47 additions & 0 deletions .rhiza/docs/CONFIG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Rhiza Configuration

This directory contains platform-agnostic scripts and utilities for the repository that can be used by GitHub Actions, GitLab CI, or other CI/CD systems.

## Important Documentation

### CI/CD & Infrastructure
- **[TOKEN_SETUP.md](TOKEN_SETUP.md)** - Instructions for setting up the `PAT_TOKEN` secret required for the SYNC workflow
- **[PRIVATE_PACKAGES.md](PRIVATE_PACKAGES.md)** - Guide for using private GitHub packages as dependencies
- **[WORKFLOWS.md](WORKFLOWS.md)** - Development workflows and dependency management
- **[RELEASING.md](RELEASING.md)** - Release process and version management
- **[LFS.md](LFS.md)** - Git LFS configuration and make targets
- **[ASSETS.md](ASSETS.md)** - Information about `.rhiza/assets/` directory

## Structure

- **scripts/** - Shell scripts for common tasks (book generation, release, etc.)
- **scripts/customisations/** - Repository-specific customisation hooks
- **utils/** - Python utilities for version management

GitHub-specific composite actions are located in `.github/rhiza/actions/`.

## Workflows

The repository uses several automated workflows (located in `.github/workflows/`):

- **SYNC** (`rhiza_sync.yml`) - Synchronizes with the template repository
- **Requires:** `PAT_TOKEN` secret with `workflow` scope when modifying workflow files
- See [TOKEN_SETUP.md](TOKEN_SETUP.md) for configuration
- **CI** (`rhiza_ci.yml`) - Continuous integration tests
- **Pre-commit** (`rhiza_pre-commit.yml`) - Code quality checks
- **Book** (`rhiza_book.yml`) - Documentation deployment
- **Release** (`rhiza_release.yml`) - Package publishing
- **Deptry** (`rhiza_deptry.yml`) - Dependency checks
- **Marimo** (`rhiza_marimo.yml`) - Interactive notebooks

## Template Synchronization

This repository is synchronized with the template repository defined in `template.yml`.

The synchronization includes:
- GitHub workflows and actions
- Development tools configuration (`.editorconfig`, `ruff.toml`, etc.)
- Testing infrastructure
- Documentation templates

See `template.yml` for the complete list of synchronized files and exclusions.
161 changes: 161 additions & 0 deletions .rhiza/docs/LFS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Git LFS (Large File Storage) Configuration

This document describes the Git LFS integration in the Rhiza framework.

## Overview

Git LFS (Large File Storage) is an extension to Git that allows you to version large files efficiently. Instead of storing large binary files directly in the Git repository, LFS stores them on a remote server and keeps only small pointer files in the repository.

## Available Make Targets

### `make lfs-install`

Installs Git LFS and configures it for the current repository.

**Features:**
- **Cross-platform support**: Works on macOS (both Intel and ARM) and Linux
- **macOS**: Downloads and installs the latest git-lfs binary to `.local/bin/`
- **Linux**: Installs git-lfs via apt-get package manager
- **Automatic configuration**: Runs `git lfs install` to set up LFS hooks

**Usage:**
```bash
make lfs-install
```

**Note for macOS users:** The git-lfs binary is installed locally in `.local/bin/` and added to PATH for the installation. This approach avoids requiring system-level package managers like Homebrew.

### `make lfs-pull`

Downloads all Git LFS files for the current branch.

**Usage:**
```bash
make lfs-pull
```

This is useful after cloning a repository or checking out a branch that contains LFS-tracked files.

### `make lfs-track`

Lists all file patterns currently tracked by Git LFS.

**Usage:**
```bash
make lfs-track
```

### `make lfs-status`

Shows the status of Git LFS files in the repository.

**Usage:**
```bash
make lfs-status
```

## Typical Workflow

1. **Initial setup** (first time only):
```bash
make lfs-install
```

2. **Track large files** (configure which files to store in LFS):
```bash
git lfs track "*.psd"
git lfs track "*.zip"
git lfs track "data/*.csv"
```

3. **Check tracking status**:
```bash
make lfs-track
```

4. **Pull LFS files** (after cloning or checking out):
```bash
make lfs-pull
```

5. **Check LFS status**:
```bash
make lfs-status
```

## CI/CD Integration

### GitHub Actions

When using Git LFS with GitHub Actions, add the `lfs: true` option to your checkout step:

```yaml
- uses: actions/checkout@v4
with:
lfs: true
```

### GitLab CI

For GitLab CI, install and pull LFS files in your before_script:

```yaml
before_script:
- apt-get update && apt-get install -y git-lfs || exit 1
- git lfs pull
```

## Configuration Files

Git LFS uses `.gitattributes` to track which files should be managed by LFS. Example:

```
# .gitattributes
*.psd filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
data/*.csv filter=lfs diff=lfs merge=lfs -text
```

## Resources

- [Git LFS Official Documentation](https://git-lfs.github.com/)
- [Git LFS Tutorial](https://github.com/git-lfs/git-lfs/wiki/Tutorial)
- [Git LFS GitHub Repository](https://github.com/git-lfs/git-lfs)

## Troubleshooting

### Permission denied during installation (Linux)

If you encounter permission errors on Linux during `make lfs-install`, the installation requires elevated privileges. The command will prompt for sudo access automatically. If it fails, you can run:

```bash
sudo apt-get update && sudo apt-get install -y git-lfs
git lfs install
```

Alternatively, if you don't have sudo access, git-lfs can be installed manually by downloading the binary from the [releases page](https://github.com/git-lfs/git-lfs/releases).

### Failed to detect git-lfs version (macOS)

If the installation fails with "Failed to detect git-lfs version", ensure you have internet connectivity and can access the GitHub API:

```bash
curl -s https://api.github.com/repos/git-lfs/git-lfs/releases/latest
```

If the GitHub API is blocked, you can manually download and install git-lfs from [git-lfs.github.com](https://git-lfs.github.com/).

### LFS files not downloading

If LFS files are not downloading, ensure:
1. Git LFS is installed: `git lfs version`
2. LFS is initialized: `git lfs install`
3. Pull LFS files explicitly: `make lfs-pull`

### Checking LFS storage usage

To see how much storage your LFS files are using:

```bash
git lfs ls-files --size
```
Loading