git-json
A Python tool to generate comprehensive git information for your projects.
Installation
pip install git-json
Usage
Command Line
# Generate git info to default 'resources' directory
git-json
# Generate git info to custom directory
git-json --package-path my-resources
Python API
from git_json import GitJsonGenerator
generator = GitJsonGenerator()
generator.generate_git_json("output-directory")
Configuration
You can configure default output paths in your pyproject.toml:
Single path:
[tool.git-json]
path = "my-custom-path"
Multiple paths (generates git.json in each location):
[tool.git-json]
path = ["src/resources", "dist/info", "build/metadata"]
This is useful when using git-json as a poetry script:
[tool.poetry.scripts]
git-json = "git_json.cli:main"
[tool.git-json]
path = ["src/resources", "dist/info"]
Output
Generates a git.json file with comprehensive git information including:
- Branch information
- Commit details (hash, message, author, time)
- Build information (host, time, user)
- Repository status (dirty, ahead/behind)
- Tags and version information
Development
# Install dependencies
poetry install --with dev
# Run tests
poetry run pytest
# Run linting
poetry run ruff check .
# Generate git info
poetry run git-json
Release files for git-json 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| git_json-1.0.1.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_json-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / git_json-1.0.1.tar.gz
| Download URL | git_json-1.0.1.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a20213171681a2abbdc007c5b9fa61d42a949dcc542054b18b95d3de9b3ed20e
|
|
BLAKE2b-256 checksum How to use checksums |
743a2cb1f306df58db2a79d6d169d7b6b86e944b36d676d546a8c290dc8f7bbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.11 Linux/6.11.0-1018-azure
|
Release files / git_json-1.0.1-py3-none-any.whl
| Download URL | git_json-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb486c52b04e9afe8e6896d57f3238c11274ac8849477159c050fc60af2023ca
|
|
BLAKE2b-256 checksum How to use checksums |
a99ebf803bab007e8581d0d2f9ee84a4abd9ad5b3b6465ceebcd008ac32d6b13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.11 Linux/6.11.0-1018-azure
|