Skip to main content

Simple tracking of your home directory with easy-to-read diffs.

Project description

Baldwin

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy uv pytest Ruff Downloads Stargazers pre-commit Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

This is a conversion of my simple scripts to version my home directory with very specific excludes and formatting every file upon commit so that readable diffs can be generated.

Installation

Pip

pip install baldwin

Usage

 $ bw -h
Usage: bw [OPTIONS] COMMAND [ARGS]...

  Manage a home directory with Git.

Options:
  -d, --debug  Enable debug logging.
  -h, --help   Show this message and exit.

Commands:
  auto-commit
  format
  git
  info
  init
  install-units

In addition to the bw command, hgit is a shortcut for bw git.

Start a new repository

bw init

Find out where the Git directory is by running bw info. This can be done even if init has not been run.

Automation

systemd

bw install-units

This will install a timer that will automatically make a new commit every 6 hours. It does not push.

Keep in mind that systemd units require a full path to the executable, so you must keep the unit up-to-date if you move where you install this package. Simply run bw install-units again.

Note that user systemd units only run while logged in.

To disable and remove the units, use the following commands:

systemctl disable --now home-vcs.timer
rm ~/.config/systemd/user/home-vcs.*

Pushing

To push, use either of the following:

  • bw git push
  • hgit push

The above also demonstrates that bw git/hgit are just frontends to git with the correct environment applied.

Formatting

If Prettier is installed, it will be used to format files. The configuration used comes with this package. Having consistent formatting allows for nice diffs to be generated.

If you have initialised a repository without having prettier or jq in PATH, you need to run the following commands to enable readable diffs:

hgit config diff.json.textconv 'jq -MS .'
hgit config diff.json.cachetextconv true
hgit config diff.yaml.textconv 'prettier --no-editorconfig --parser yaml'
hgit config diff.yaml.cachetextconv true

If you have the XML plugin installed:

hgit config diff.xml.textconv 'prettier --no-editorconfig --parser xml --xml-whitespace-sensitivity ignore'
hgit config diff.xml.cachetextconv true

Binary files

Any file that is untracked and detected to be binary will not be added. Use hgit add to add a binary file manually.

Other details

Default .gitignore and .gitattributes files are installed on initialisation. They are never modified by this tool. Please customise as necessary.

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

baldwin-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

baldwin-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file baldwin-0.1.0.tar.gz.

File metadata

  • Download URL: baldwin-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baldwin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4cbef60e67696a4a5f61c58167aeb0f1f698ad8bcfc673153e175fb76157abdc
MD5 094b674559c70d0632ad1f2cfee20a2e
BLAKE2b-256 173279d82784f4b54cad72a7d4d759362fd97b05e0bd95ae63138ca28668523d

See more details on using hashes here.

Provenance

The following attestation bundles were made for baldwin-0.1.0.tar.gz:

Publisher: publish.yml on Tatsh/baldwin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: baldwin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baldwin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6117103193e8cf8449a93b40c637712ed3ff008605fc35b79b1018da08269d8
MD5 7b8247b200f908093417a72d05b2890c
BLAKE2b-256 9f625052dbdf606c8b51235b83681161c15ae80c317b92806486cf7be7606656

See more details on using hashes here.

Provenance

The following attestation bundles were made for baldwin-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Tatsh/baldwin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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