Name | fugit JSON |
Version |
0.3.1
JSON |
| download |
home_page | |
Summary | Git diff handling in Python. |
upload_time | 2023-12-17 11:09:31 |
maintainer | |
docs_url | None |
author | |
requires_python | <3.12,>=3.10 |
license | MIT |
keywords |
git
pydantic
pypi
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
# fugit
<img src="https://github.com/lmmx/fugit/raw/master/docs/assets/images/hero.png" alt="Fugit Logo" width=300></img>
[![PyPI](https://img.shields.io/pypi/v/fugit?logo=python&logoColor=%23cccccc)](https://pypi.org/project/fugit)
[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/lmmx/fugit/master.svg)](https://results.pre-commit.ci/latest/github/lmmx/fugit/master)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/fugit.svg)](https://pypi.org/project/fugit)
[![license](https://img.shields.io/github/license/lmmx/fugit.svg)](https://github.com/lmmx/fugit/blob/main/LICENSE)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://docs.pydantic.dev/latest/contributing/#badges)
[![Documentation](https://readthedocs.org/projects/fugit/badge/?version=latest)](https://fugit.readthedocs.io/en/latest/?version=latest)
### Git diff handling in Python
</div>
> _sed fugit interea fugit irreparabile tempus_
(“meanwhile, the irreplaceable time escapes”)
## Motivation
Accessing structured diffs in a Git repository remains challenging, even with tools like GitPython.
This issue is especially pronounced when dealing with large diff sets, such as those generated
during transitions between linters (e.g., from Black to Ruff). Currently, without a straightforward
programmatic solution, understanding the essence of these diffs requires cumbersome manual effort.
Before writing this library I explored fast parsing approaches (Pydantic's integration with Rust's regex
crate in particular) and reviewed GitPython internals, as well as its pitfalls.
_fugit_ simplifies access to git diffs, and will help you avoid the covert hazards in GitPython's API.
## Installation
```py
pip install fugit
```
## Usage
Use fugit on the command line as a replacement to `git diff`:
```sh
fugit
```
```
usage: fugit [-h] [--repo REPO] [--revision REVISION] [-c [CHANGE_TYPE ...]]
[-q] [-p] [-n] [--version]
Configure input filtering and output display.
options:
-h, --help show this help message and exit
--repo REPO The repo whose git diff is to be computed.
(type: Path, default: .)
--revision REVISION Specify the commit for comparison with the index. Use "HEAD" to
refer to the latest branch commit, or "HEAD~{$n}" (e.g. "HEAD~1")
to indicate a specific number of commits before the latest.
(type: str, default: HEAD)
-c [CHANGE_TYPE ...], --change-type [CHANGE_TYPE ...]
Change types to filter diffs for.
(type: str, default: ['A', 'C', 'D', 'M', 'R', 'T', 'U', 'X', 'B'])
-q, --quiet (default: False)
-p, --plain (default: False)
-n, --no-pager (default: False)
--version show program's version number and exit
```
Or the Python interface:
```py
from fugit import diff
diff(repo="/path/to/your/repo", quiet=True)
```
## Development
- To set up pre-commit hooks (to keep the CI bot happy) run `pre-commit install-hooks` so all git
commits trigger the pre-commit checks. I use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
This runs `black`, `flake8`, `autopep8`, `pyupgrade`, etc.
- To set up a dev env, I first create a new conda environment and use it in PDM with `which python > .pdm-python`.
To use `virtualenv` environment instead of conda, skip that. Run `pdm install` and a `.venv` will be created if no
Python binary path is found in `.pdm-python`.
- To run tests, run `pdm run python -m pytest` and the PDM environment will be used to run the test suite.
Raw data
{
"_id": null,
"home_page": "",
"name": "fugit",
"maintainer": "",
"docs_url": null,
"requires_python": "<3.12,>=3.10",
"maintainer_email": "",
"keywords": "git pydantic pypi",
"author": "",
"author_email": "Louis Maddox <louismmx@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/35/38/1942dbf3fa6bc764b2f0105c9ab82e45ebe43299d36124efb543793d77d7/fugit-0.3.1.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n# fugit\n\n<img src=\"https://github.com/lmmx/fugit/raw/master/docs/assets/images/hero.png\" alt=\"Fugit Logo\" width=300></img>\n\n[![PyPI](https://img.shields.io/pypi/v/fugit?logo=python&logoColor=%23cccccc)](https://pypi.org/project/fugit)\n[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/lmmx/fugit/master.svg)](https://results.pre-commit.ci/latest/github/lmmx/fugit/master)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/fugit.svg)](https://pypi.org/project/fugit)\n[![license](https://img.shields.io/github/license/lmmx/fugit.svg)](https://github.com/lmmx/fugit/blob/main/LICENSE)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://docs.pydantic.dev/latest/contributing/#badges)\n[![Documentation](https://readthedocs.org/projects/fugit/badge/?version=latest)](https://fugit.readthedocs.io/en/latest/?version=latest)\n\n### Git diff handling in Python\n\n</div>\n\n> _sed fugit interea fugit irreparabile tempus_\n\n(\u201cmeanwhile, the irreplaceable time escapes\u201d)\n\n## Motivation\n\nAccessing structured diffs in a Git repository remains challenging, even with tools like GitPython.\nThis issue is especially pronounced when dealing with large diff sets, such as those generated\nduring transitions between linters (e.g., from Black to Ruff). Currently, without a straightforward\nprogrammatic solution, understanding the essence of these diffs requires cumbersome manual effort.\n\nBefore writing this library I explored fast parsing approaches (Pydantic's integration with Rust's regex\ncrate in particular) and reviewed GitPython internals, as well as its pitfalls.\n\n_fugit_ simplifies access to git diffs, and will help you avoid the covert hazards in GitPython's API.\n\n## Installation\n\n```py\npip install fugit\n```\n\n## Usage\n\nUse fugit on the command line as a replacement to `git diff`:\n\n```sh\nfugit\n```\n\n```\nusage: fugit [-h] [--repo REPO] [--revision REVISION] [-c [CHANGE_TYPE ...]]\n [-q] [-p] [-n] [--version]\n\nConfigure input filtering and output display.\n\noptions:\n -h, --help show this help message and exit\n --repo REPO The repo whose git diff is to be computed.\n (type: Path, default: .)\n --revision REVISION Specify the commit for comparison with the index. Use \"HEAD\" to\n refer to the latest branch commit, or \"HEAD~{$n}\" (e.g. \"HEAD~1\")\n to indicate a specific number of commits before the latest.\n (type: str, default: HEAD)\n -c [CHANGE_TYPE ...], --change-type [CHANGE_TYPE ...]\n Change types to filter diffs for.\n (type: str, default: ['A', 'C', 'D', 'M', 'R', 'T', 'U', 'X', 'B'])\n -q, --quiet (default: False)\n -p, --plain (default: False)\n -n, --no-pager (default: False)\n --version show program's version number and exit\n```\n\nOr the Python interface:\n\n```py\nfrom fugit import diff\n\ndiff(repo=\"/path/to/your/repo\", quiet=True)\n```\n\n## Development\n\n- To set up pre-commit hooks (to keep the CI bot happy) run `pre-commit install-hooks` so all git\n commits trigger the pre-commit checks. I use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).\n This runs `black`, `flake8`, `autopep8`, `pyupgrade`, etc.\n\n- To set up a dev env, I first create a new conda environment and use it in PDM with `which python > .pdm-python`.\n To use `virtualenv` environment instead of conda, skip that. Run `pdm install` and a `.venv` will be created if no\n Python binary path is found in `.pdm-python`.\n\n- To run tests, run `pdm run python -m pytest` and the PDM environment will be used to run the test suite.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Git diff handling in Python.",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/lmmx/fugit",
"Repository": "https://github.com/lmmx/fugit.git"
},
"split_keywords": [
"git",
"pydantic",
"pypi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ed64b0ec3e967030d5b6058251822e840c0aa38c5691a4d6974f5e5cff8da58",
"md5": "ad92a424b4f2a26fe1fd04a284f2b7a4",
"sha256": "f53ec1128d6597a6cb4482ba6765c14e95497f00e3ea14cf40e02895fa31e8d6"
},
"downloads": -1,
"filename": "fugit-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ad92a424b4f2a26fe1fd04a284f2b7a4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.10",
"size": 14906,
"upload_time": "2023-12-17T11:09:29",
"upload_time_iso_8601": "2023-12-17T11:09:29.863094Z",
"url": "https://files.pythonhosted.org/packages/1e/d6/4b0ec3e967030d5b6058251822e840c0aa38c5691a4d6974f5e5cff8da58/fugit-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "35381942dbf3fa6bc764b2f0105c9ab82e45ebe43299d36124efb543793d77d7",
"md5": "6aa79228bf5f3d0109c7a6a1f9fa55d5",
"sha256": "bd250b9ea412601dbfb146c71b3f3dad1184b540183adcea11edf70e0be4e65d"
},
"downloads": -1,
"filename": "fugit-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "6aa79228bf5f3d0109c7a6a1f9fa55d5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.10",
"size": 13096,
"upload_time": "2023-12-17T11:09:31",
"upload_time_iso_8601": "2023-12-17T11:09:31.294796Z",
"url": "https://files.pythonhosted.org/packages/35/38/1942dbf3fa6bc764b2f0105c9ab82e45ebe43299d36124efb543793d77d7/fugit-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-17 11:09:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lmmx",
"github_project": "fugit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "fugit"
}