Skip to main content

a basic git repo clone script

Project description

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

Installation

Requires python3.9+

To install with pip, run:

pip install git+https://github.com/seanbreckenridge/clone-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

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

cl-repos-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

cl_repos-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file cl-repos-0.1.0.tar.gz.

File metadata

  • Download URL: cl-repos-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for cl-repos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d43a0205753452a83296249d99f463608123089800d8700b2cef09dc1b309ca
MD5 c86b187ae7e8422558566986f612c888
BLAKE2b-256 35f7bec115a1db3f4632a38f1eec89035997845c5c061fe2351acd80889f4138

See more details on using hashes here.

File details

Details for the file cl_repos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cl_repos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for cl_repos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d4a48eb66a06a3f2217a101b27c29034b63e9e7d06a1ec9adc62279de88d6ba
MD5 f93940359d311261106ce84ad6e67b60
BLAKE2b-256 c7fe6f76713a59f16276d4920573e7cc7ac1948bd85d10c354be211d7fb3bd64

See more details on using hashes here.

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