Skip to main content

Metarepo Chef

Project description

Mr. Chef

👨‍🍳 Meta-Repo Chef. Culinary git helper to work with code buffets.

Why

It has features that no other meta-repo manager has:

  • Code is 100% reproducible.
  • Full freeze-warmup-freeze coding cycle.
  • Upstream patching supported.
  • Downstream patching supported.
  • Mixed and multi-patching repo supported.
  • Automated updates.
  • Automatic disk space economization with git-autoshare.
  • Food! 🥘

Let's dive in. Imagine you need to create an app that requires many unrelated modules to be properly glued together. How would you organize your source code?

There are multiple answers to that question:

  • Use separate repos and glue them together through packaging. But what if some code you need isn't properly packaged? What if some dependencies need more than 1 patch to work?
  • Use a monorepo. However, what happens if some parts are open source and you need to upstream or review changes?
  • Use git submodules. However, that requires that every time you do a git checkout... or almost any git command..., you need to use some --recurse-submodules flag. Also it gives a lot of headaches when you move files around and perform basically any operation. And what if you need to merge 2 upstream patches?
  • Use git subtrees. But then, you need even more deep knowledge than with submodules to be able to review or publish patches. And again, how to merge more than one patch?
  • Use Pijul. But the world isn't ready for it yet. Still we need Git.

The solution is to use a meta-repo. There are many meta-repo managers out there, but none of them has all the features that I already told you about Mr. Chef.

Glossary

Mr. Chef introduces a new code management concept based on the metaphor of a buffet. Use this glossary to understand the rest of the recipe... readme! Sorry...

  • Buffet is the main git repository that contains all the instructions to build it.
  • The config file is a file named mrchef.toml that stands in the root of your buffet and configures what Mr. Chef should do.
  • The kitchen is the root folder, inside the buffet, where you can find the meals. It's configured inside the config file.
  • A meal is like a git submodule: another git repo inside your kitchen.
  • A spice is a patch that is added to a meal.
  • The freezer is where we store the gory details needed to make the kitchen 100% reproducible. Mr. Chef saves it in a file called .mrchef.freezer.toml.
  • Warming up means getting meals outside of the freezer and putting them in the kitchen, ready to cook!
  • Freezing means writing a new freezer that can reproduce what's currently warmed up in the kitchen.

How

Using CLI

Install it:

pipx install mrchef

Usually you start by creating a new configuration file:

mrchef init

It will create a new mrchef.toml file with some comments about how to use it. You can delete them once you know how to do it.

Now, you will need to add a meal:

mrchef meal-add kitchen/hello https://github.com/octocat/Hello-World master

💡 Mr. Chef uses git-autoshare automatically. It will help you if you need to clone huge repos! But you have to configure it before adding the meals.

You can add more meals just like that.

Maybe you need to apply a couple of spices to the meal? OK:

mrchef spice-add kitchen/hello https://github.com/octocat/Hello-World/pull/2256
mrchef spice-add kitchen/hello https://github.com/octocat/Hello-World/pull/34

Did master get new commits? Or did those PRs get updated? Update everything:

mrchef update

Cool, huh? 😏 Mr. Chef can do more things! To see all commands and what they do:

mrchef --help-all

Using Python

Install it:

pip install mrchef

Use it:

import mrchef

Using Nix

Install it:

nix profile install gitlab:moduon/mrchef

Did I say buffets are 100% reproducible? Nothing better than Nix for that job.

Go read the flake. You'll find helpers ready to convert a buffet into aggregated source code. Read the minimal test to understand how to use them. Ready to replace git submodules?

Keep in mind this if using nix:

  • You must enable parse-toml-timestamps experimental feature.

  • Most mrchef-based derivations will benefit a lot from pre-filtering the sources before the build. Typically, by just including ./mrchef.toml, ./.mrchef.freezer.toml and ./kitchen/ (if it exists and the kitchen is named like that), you will have all you need to build.

  • Make sure you add require_nar_hash = true to your mrchef.toml, so Mr. Chef will add those hashes when freezing. This way, Nix evaluation won't have to be serialized.

Dealing with private repos

Mr. Chef runs in your environment.

If you're cloning a private Git repository, probably it'll be better if you clone it with SSH. This way, your SSH agent will deal with authentication and Mr. Chef will have nothing special to do.

If you're adding a spice from a Github PR found in a private repository, you can export an environment variable named GITHUB_TOKEN. When found, Mr. Chef will use it to authenticate the spice download. Use that when spicing private meals.

Who

Created and maintained by Moduon Team.

Original idea by Jairo Llopis.

Where

Anywhere you want! 🎁 It's GPL 3.0+.

Project details


Download files

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

Source Distribution

mrchef-0.10.0.tar.gz (72.6 kB view details)

Uploaded Source

Built Distribution

mrchef-0.10.0-py3-none-any.whl (52.8 kB view details)

Uploaded Python 3

File details

Details for the file mrchef-0.10.0.tar.gz.

File metadata

  • Download URL: mrchef-0.10.0.tar.gz
  • Upload date:
  • Size: 72.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for mrchef-0.10.0.tar.gz
Algorithm Hash digest
SHA256 c9c2e3ee6d711692608ac3e7c007ff0a2eea9c0ab015c940aa512bb4eea8f6ce
MD5 e52b2da0bd4b415ee401bc629365311c
BLAKE2b-256 b84a3c4d40aef3f6fe8ebafc6a8968e75b126520e2378bc96384f2fa9eb8d850

See more details on using hashes here.

File details

Details for the file mrchef-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: mrchef-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 52.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for mrchef-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d6638b4a3da135165f459d50c75610748e5beccaa80e987233f82f3e07ccb91
MD5 b5463b66dd657dae42feca209c498045
BLAKE2b-256 dcfbfe07e6b9be4445a7ab1f8e1a56036f5d6821d635c53f487184914760cf6f

See more details on using hashes here.

Supported by

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