Skip to content

unenv/git-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-json

codecov PyPI version Python versions

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages