Skip to main content

clone-repos

a basic git repo clone script, with special support for pip and/or editable installs, using reorder_editable

This supports running a preinstall (after cloning) or postinstall step (a shell command) as well

For examples of a clone-repos.yaml file this expects at ~/.config/clone-repos.yaml, see:

I also use this to install plugins/addons for things like ranger or todotxt:

Installation

Requires python3.9+

To install with pip, run:

pip install cl-repos

Usage

Usage: clone-repos [OPTIONS] CONFIG_FILE

  Clones and sets up your repos.

  Can provide a CONFIG_FILE instead of using the default

Options:
  -b, --base-repos DIRECTORY   base repository directory to clone repos into
                               [env var: REPOS; required]
  -P, --parse-config           test parsing the config file instead of running
                               clone
  -B, --break-system-packages  pass the --break-system-packages flag to pip
  --help                       Show this message and exit.

The full format for a repo is:

"url to repository":
  base: path # overwrite base-path for this repo
  dirname: directory_name # directory name to clone into
  symlink_to: directory_name # the parent directory to symlink the cloned repo to
  pip: how # 'install', 'editable' or 'editable_system'
  preinstall:
    - "shell command 1"
    - "shell command 2"
  postinstall: "shell command here"
  pipefail: false # if true, stops multiple preinstall/postinstall if any command fails

The preinstall and postinstall scripts can either be one command (a string), or multiple (a list)

For pip, editable by default uses the --user flag, if you know what you're doing and want to install in your system lib directory, use editable_system (Note that this only works in particular python installations. In a lot of cases, pip will still default to installing into your --user directory instead). See reorder_editable for context.

This expects a $REPOS environment variable to be set, which is the base directory to clone into, e.g. in your shell config set:

export REPOS="${HOME}/Repos"

... or you can provide the --base-repos flag when running

To clone, run clone-repos or python3 -m clone_repos

To run this quickly on new machines, I setup an alias in my dotfiles like:

alias cr="python3 -m pip install --break-system-packages 'git+https://github.com/seanbreckenridge/clone-repos' && clone-repos -B"

Tests

git clone 'https://github.com/seanbreckenridge/clone-repos'
cd ./clone-repos
pip install '.[testing]'
flake8 ./clone-repos
mypy ./clone-repos

Metadata

Release files for cl-repos 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cl-repos 0.1.1
File Size Uploaded
cl_repos-0.1.1.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cl-repos 0.1.1
File Interpreter ABI Platform
cl_repos-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / cl_repos-0.1.1.tar.gz

Download URL cl_repos-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d07c76a40016d338ac11c831a1a370ed7f8759cf69035c649f04bba3dc81fe59
BLAKE2b-256 checksum
How to use checksums
ba6b5af320525aa8d9dd250b744cc1725f51ee500ecba35cc0c66259d922bff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / cl_repos-0.1.1-py3-none-any.whl

Download URL cl_repos-0.1.1-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cb6eb68712bcc6aa7d4687e571bc674e8bf73624dc09f18d438b3805b8529d4
BLAKE2b-256 checksum
How to use checksums
43bd3aa1fbe00f8e0acd62b2b6b0e273857274ea59af93aaa5fdca190c5b1414
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page