Skip to main content

PyPI Python Versions Build Status License

check_uncommitted_git_changes

check_uncommitted_git_changes is a command line tool to check for uncommitted git changes to identify outdated generated content during continuous integration.

The problem

While generated code generally should not be committed, there are cases for where it can make sense, for example *.po files containing translations that are derived from source code.

Developers might change the underlying source code but forget to generate the files derived from it. This causes headache for the next developer who wants to a translated message while implementing a separate task, and not has to deal with the outdated content in some way.

The solution

If your project uses continuous integration, you can use it to run the code generators. Ideally they produce the same code that has already been committed to the repository.

However, if a developer forgot to commit up to date generated code, the code generators will produce slightly different code that can for example be viewed using

git status

Calling check_uncommitted_git_changes after the generators have run can check for such changes. If there are none, its exit code is 0 and continuous integration can continue. If changes are found, the exit code is 1 and continuous integration fails.

Usage

Add check_uncommitted_git_changes to your projects using the respective command depending on how you manage your Python packages.

For poetry, run:

poetry add --dev check_uncommitted_git_changes

For setuptools, run:

pip install --upgrade check_uncommitted_git_changes

or add an entry to your *requirements.txt.

The following example outlines a GitHub action step that first collects all translated messages of a Django project and then checks if they differ from the versions found in the repository:

...
jobs:
  build:
    ...
    steps:
      ...
      - name: Check that translations are up to date
        run: |
          python manage.py makemessages --all --ignore venv --no-location --no-obsolete
          check_uncommitted_git_changes

The same principle can be applied to other continuous integration platforms.

License

Check_uncommitted_git_changes is open source and distributed under the BSD license. The source code is available from https://github.com/roskakori/check_uncommitted_git_changes.

Change history

See "CHANGES".

Development and contributing

For information on how to build the project and contribute to it see "CONTRIBUTING".

Metadata

Release files for check-uncommitted-git-changes 1.0.1

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

Source distribution (sdist)

Source distribution for check-uncommitted-git-changes 1.0.1
File Size Uploaded
check_uncommitted_git_changes-1.0.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for check-uncommitted-git-changes 1.0.1
File Interpreter ABI Platform
check_uncommitted_git_changes-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / check_uncommitted_git_changes-1.0.1.tar.gz

Download URL check_uncommitted_git_changes-1.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ca5dbc1960ed1670341bb8474e9e5909c8b5e851ef57061e7202efb3f3f78d50
BLAKE2b-256 checksum
How to use checksums
1679d94418666e8635124e51517a4eecd314a606857d840e88d07720a43429f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Darwin/21.2.0

Release files / check_uncommitted_git_changes-1.0.1-py3-none-any.whl

Download URL check_uncommitted_git_changes-1.0.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa146d68e540f70c46067ebb8b99a89c40d94e10b17bacff6e50b33d79b7fc39
BLAKE2b-256 checksum
How to use checksums
74a46171d6e3194515e9ed2129366f9cc438ccd18d20e754fe00381b72998d05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Darwin/21.2.0

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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