Skip to main content

checkout_code

Tool to checkout a specific commit to a unique location

installation

pip install .

usage

checkout_code
  --repository /path/to/git/repo
  --checkout-dir /path/to/version/location
  -c commit_hash
  --use-prefix

--use-prefix prefixes the directories in checkout_dir with the repository name

To get the final path use an additional --get-path, i.e.

checkout_code
  --repository /path/to/git/repo
  --checkout-dir /path/to/version/location
  -c commit_hash
  --use-prefix
  --get-path

this will only print the path but not checkout the code. Its intendented to be used in a variable.

example usage in scripts

source env/bin/activate
COMMIT="b59616685000ddb5583186bcb7fd4b3e3d481f19"
checkout_code --repository ~/src/sockeye --checkout-dir ~/work/sockeye/ -c $COMMIT --use-prefix
path=$(checkout_code --repository ~/src/sockeye --checkout-dir ~/work/sockeye/ -c $COMMIT --use-prefix --get-path)
export PYTHONPATH="$path:$PYTHONPATH"

development version a.k.a HEAD

if you specify the commit as HEAD the tool will not checkout anything but the --get-path option will return your repository. That way you can use HEAD to point to your latest, possible uncommited, version

environment files

To make it easier to use you can also use .env files instead or in addition to CLI-options. You can specify the file by using --env /path/to/.env/file or it will automatically search for files. In the environment file just use

repository=/path/to/repo
checkout_dir=/path/to/checkout_dir
use_prefix=True

to specify your settings.

Note command line arguments will always override environment settings

version history

0.1 2018-03-08

  • initial version

0.2 2018-03-08

  • added file lock
  • added requirements

0.3 2018-03-20

  • added loading of env files

0.4 2018-07-13

  • return exit code 1 if checkout_dir does not exists

0.5 2019-02-08

  • add default timeout for filelock (closes #2)
  • added option to change timeout value

Metadata

Release files for checkout-code 0.5

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

Source distribution (sdist)

Source distribution for checkout-code 0.5
File Size Uploaded
checkout_code-0.5.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for checkout-code 0.5
File Interpreter ABI Platform
checkout_code-0.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / checkout_code-0.5.tar.gz

Download URL checkout_code-0.5.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
814e1457a6ed2b50fff54f4473c143dd8f821076340f31c10f3f02df2bd5c0f0
BLAKE2b-256 checksum
How to use checksums
197484cd46eadb02ad942b26b830353f6e02b23fa456784c7d58fd4a06163a40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2

Release files / checkout_code-0.5-py3-none-any.whl

Download URL checkout_code-0.5-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82205516c8c0f50d40134fc4012280e7aa5a8e40d15a9c07cb73c3adfc6af1ca
BLAKE2b-256 checksum
How to use checksums
7b31b91d3b6640e5999b69a97e3d907a73ef640caa7308aed89637fd84e99838
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.5 This release

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