A Python tool to generate comprehensive git information for your projects.
pip install git-json# Generate git info to default 'resources' directory
git-json
# Generate git info to custom directory
git-json --package-path my-resourcesfrom git_json import GitJsonGenerator
generator = GitJsonGenerator()
generator.generate_git_json("output-directory")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"]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
# Install dependencies
poetry install --with dev
# Run tests
poetry run pytest
# Run linting
poetry run ruff check .
# Generate git info
poetry run git-json