Skip to main content

CLI to check if any of the original files in a repository/directory change over the course of a precommit script.

Project description

ChangeGuard

Top language GitHub License PyPI - Version Python Version

Status Stable Unstable
Master Build and Test since tagged last commit
Develop Build and Test since tagged since tagged last commit

CLI to check if your repository/directory files have changed over the span of a script.

What

Like hashdeep, but customized to check if any of the original files in a repository/directory change over the course of a precommit script.

Features

  • Can use any sha256sum-like command (uses xxhash by default).
  • Use .changeguard-ignore to ignore files that should not be checked for changes.

Getting Started

Install

Tested on

  • WSL2 Ubuntu 20.04, Python 3.8.0
  • Ubuntu 20.04, Python 3.8.0, 3.9.0, 3.10.0, 3.11.0, 3.12.0, tested in GitHub Actions workflow (build-and-test.yml).

Requirements:

  • Linux-like environment
    • Why: Uses pexpect.spawn().
  • Python 3.8+
    • Why: Some dev dependencies require Python 3.8+.
# Install from pypi (https://pypi.org/project/changeguard/)
pip install changeguard

# Install from git (https://github.com/realazthat/changeguard)
pip install git+https://github.com/realazthat/changeguard.git@v0.3.1

Use

Contributions

Development environment: Linux-like

  • For running pre.sh (Linux-like environment).
    • Requires pyenv, or an exact matching version of python as in .python-version.
    • nvm for prettier (markdown formatting).
    • bash, grep, xxd, git, xxhash (for scripts/workflows/tests).
    • jq, (installation) required for yq, which is itself required for our README.md generation, which uses tomlq (from the yq package) to include version strings from pyproject.toml.
    • Requires nodejs (for act).
    • Requires go (to run act).
    • docker (for act).

Commit Process

  1. (Optionally) Fork the develop branch.
  2. Stage your files: git add path/to/file.py.
  3. bash scripts/pre.sh, this will format, lint, and test the code.
  4. git status check if anything changed (generated README.md for example), if so, git add the changes, and go back to the previous step.
  5. git commit -m "...".
  6. Make a PR to develop (or push to develop if you have the rights).

Release Process

These instructions are for maintainers of the project.

  1. develop branch: Run bash scripts/pre.sh to ensure everything is in order.
  2. develop branch: Bump the version in pyproject.toml, following semantic versioning principles. Also modify the last_unstable_release and last_stable_release in the [tool.changeguard-project-metadata] table as appropriate.
  3. develop branch: Commit these changes with a message like "Prepare release X.Y.Z". (See the contributions section above).
  4. master branch: Merge the develop branch into the master branch: git checkout master && git merge develop --no-ff.
  5. master branch: Tag the release: Create a git tag for the release with git tag -a vX.Y.Z -m "Version X.Y.Z".
  6. Publish to PyPI: Publish the release to PyPI with bash scripts/deploy-to-pypi.sh.
  7. Push to GitHub: Push the commit and tags to GitHub with git push and git push --tags.
  8. git checkout develop && git merge master The --no-ff option adds a commit to the master branch for the merge, so refork the develop branch from the master branch.
  9. git push origin develop Push the develop branch to GitHub.

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

changeguard-0.3.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

changeguard-0.3.1-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file changeguard-0.3.1.tar.gz.

File metadata

  • Download URL: changeguard-0.3.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.0

File hashes

Hashes for changeguard-0.3.1.tar.gz
Algorithm Hash digest
SHA256 fa380adfe51ecd052f82603b3193e6319a2911d87a37aded93e8108d7e3920a4
MD5 86e891e5b24936783eb2b315c368e87a
BLAKE2b-256 59c2fa772bf416615260b85ce5d870c8eae5b7d90c5c015346167a19bd98b0eb

See more details on using hashes here.

File details

Details for the file changeguard-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: changeguard-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.0

File hashes

Hashes for changeguard-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e8fb3f4d9fe89fa81017cdbe18f9f83479cb50dccd2b899db43d6a0a500fdec
MD5 22690548ef715130c849fa70fdaa3fbf
BLAKE2b-256 47f32fa8facf0ff7c68da2f4d08f3f348f8d5797941602cb8eae68c6a2d14d56

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