Skip to main content

Lithography mask library

Project description

lethe README

lethe is a Python module for git-based snapshotting.

lethe is intended as a mechanism for creating commits outside the standard git branching/tagging workflows. It is meant to enable additional use-cases without disrupting the standard workflows. Use cases include:

  • Short-lived:
    • On-disk undo log
    • Syncing work-in-progress between computers before it's ready
  • Long-lived:
    • lab notebook: Recording the code / configuration state that resulted in a given output
    • incremental backup: Space-efficient time-based backups of a codebase

Usage

Creating a commit from the command line

$ cd path/to/repo
$ lethe
122d058e375274a186c407f28602c3b14a2cab95

This effectively snapshots the current state of the repository (as would be seen by git add --all) and creates a new commit (122d058e375274a186c407f28602c3b14a2cab95) which points to it. The current branch and index are not changed.

Flags:

  • -p my_parent_ref is used to provide "parent" refs which become the parents of the created commit. If a parent ref is a symbolic ref, both the provided ref and the ref it points to are used as parents. If not present, defaults to -p HEAD.
  • -t ref/lethe/my_target_ref is used to provide "target" refs which will be created/updated to point to the created commit. If not present, defaults to adding an entry of the form -t refs/lethe/my_branch for each parent ref of the form refs/heads/my_branch, and -t refs/lethe/my/refpath for non-head refs of the form refs/my/refpath. All provided parent refs and any dereferenced parent refs are used to generate default target refs. If any of the target refs already exist, the commits they point to become parents of the created commit.
  • -m "my message" sets the commit message for the snapshot. By default, "snapshot " is used.
  • -r path/to/repo can be provided to specify a repository outside of the current working directory.
$ cd path/to/repo
$ git branch
* master
$ lethe

is equivalent to

lethe -r path/to/repo -p HEAD

or

lethe -r path/to/repo -p HEAD -p refs/heads/master -t refs/lethe/HEAD -t refs/lethe/master

Creating a commit programmatically

import lethe
REPO = '/path/to/repo'

commit_sha = lethe.snap(cwd=REPO)
tree_sha = lethe.get_tree(commit_sha, cwd=REPO)

print('Created new commit with hash ' + commit_sha + ' aka refs/lethe/HEAD')
print('Code (tree) state is ' + tree_sha)

Installation

Requirements:

  • python 3 (written and tested with 3.6)
  • git (accessible on the system PATH)

Install with pip:

pip3 install lethe

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

lethe-0.13.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

lethe-0.13-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file lethe-0.13.tar.gz.

File metadata

  • Download URL: lethe-0.13.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for lethe-0.13.tar.gz
Algorithm Hash digest
SHA256 bbe39ada2992580cfdf1c26578be0d9cfabc4b35299e78522adf908bbbdbf921
MD5 da157431d6f0821793c8493ca5171fa4
BLAKE2b-256 50dbbb34b15b85fcdc071c2c5a5cf31151e75d177c1f55362d8427ec8480722f

See more details on using hashes here.

File details

Details for the file lethe-0.13-py3-none-any.whl.

File metadata

  • Download URL: lethe-0.13-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for lethe-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d75b1a1a701e5d15ebb7c72ce6de623336bcbeb71f50124b2602e3a6baa1b4f5
MD5 bb14e9eb6b9d753530001f2a3b4fa4ea
BLAKE2b-256 833d7deac2667b0dab1633fd0d8e1da3e64cf944837a910dd18c89bf4a6161ff

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