# conflict-collection
[](https://badge.fury.io/py/conflict-collection)
[](LICENSE)
[](https://pypi.org/project/conflict-collection/)
[](#status)
> Data collection toolkit for Git merge conflicts: structural types, social signals, and similarity metrics.
`conflict-collection` builds on [`conflict-parser`](https://github.com/jinu-jang/conflict-parser) to turn raw in-progress merges into rich, typed records suitable for research, analytics, or ML.
---
## ✨ Features
- Classify and enumerate merge conflict cases (modify/modify, add/add, delete/modify, etc.)
- Produce structured frozen dataclasses with per-side contents & resolution metadata
- Build canonical 5‑tuples (A,B,O,M,R) for dataset curation
- Extract social / ownership signals (recency, blame composition, integrator priors)
- Compute a 3‑way anchored similarity ratio between two resolution candidates
- Fully typed (PEP 561) & test‑covered
---
## 📦 Install
```bash
pip install conflict-collection
# or with documentation extras
pip install conflict-collection[docs]
```
---
## 🚀 Quick Start
```python
from conflict_collection.collectors.conflict_type import collect as collect_conflicts
from conflict_collection.collectors.societal import collect as collect_social
from conflict_collection.metrics.anchored_ratio import anchored_ratio
# 1) Enumerate conflict cases after a merge produced conflicts
cases = collect_conflicts(repo_path='.', resolution_sha='<resolved-commit-sha>')
print(len(cases), 'cases')
print(cases[0].conflict_type, cases[0].conflict_path)
# 2) Capture social signals
signals = collect_social(repo_path='.')
for path, rec in signals.items():
print(path, rec.ours_author, rec.owner_commits_ours)
# 3) Similarity metric example
O = 'line1\nline2\nline3'
R = 'line1\nX\nline3'
R_hat = 'line1\nY\nline3'
print('anchored ratio =', anchored_ratio(O, R, R_hat))
```
---
## 📚 Documentation
Full docs (usage guides + auto-generated API reference) are published with MkDocs & mkdocstrings:
https://jinu-jang.github.io/conflict-collection
Local build:
```bash
pip install -e .[docs]
mkdocs serve
```
---
## 🧩 Data Models
| Model | Purpose |
| ----- | ------- |
| Typed Conflict Cases | Frozen dataclasses per conflict archetype |
| `Conflict5Tuple` | Canonical (A,B,O,M,R) capture |
| Social Signals | Ownership & recency metrics per file |
| Anchored Ratio | Algorithmic similarity between two edits |
---
## 🔬 Testing
```bash
git clone https://github.com/jinu-jang/conflict-collection
cd conflict-collection
pip install -e .[dev]
pytest -q
```
---
## 🤝 Contributing
PRs welcome! Please:
1. Add or update tests
2. Run `black . && isort . && pytest -q`
3. If adding public API, include docstrings & update docs nav (`mkdocs.yml`)
See `docs/contributing.md` for details.
---
## 📄 License
MIT © 2025 Jinu Jang
---
## 🔖 Status
Beta. Interfaces may change before 0.1. Feedback appreciated.
Raw data
{
"_id": null,
"home_page": null,
"name": "conflict-collection",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "conflict, git, merge, parser, version-control",
"author": "Jinu Jang",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0b/42/43f1f299e2dbce3fc83ad7d4d6117a19adee22821487613d182bbfe7a3a7/conflict_collection-0.0.1.tar.gz",
"platform": null,
"description": "# conflict-collection\n\n[](https://badge.fury.io/py/conflict-collection)\n[](LICENSE)\n[](https://pypi.org/project/conflict-collection/)\n[](#status)\n\n> Data collection toolkit for Git merge conflicts: structural types, social signals, and similarity metrics.\n\n`conflict-collection` builds on [`conflict-parser`](https://github.com/jinu-jang/conflict-parser) to turn raw in-progress merges into rich, typed records suitable for research, analytics, or ML.\n\n---\n\n## \u2728 Features\n\n- Classify and enumerate merge conflict cases (modify/modify, add/add, delete/modify, etc.)\n- Produce structured frozen dataclasses with per-side contents & resolution metadata\n- Build canonical 5\u2011tuples (A,B,O,M,R) for dataset curation\n- Extract social / ownership signals (recency, blame composition, integrator priors)\n- Compute a 3\u2011way anchored similarity ratio between two resolution candidates\n- Fully typed (PEP 561) & test\u2011covered\n\n---\n\n## \ud83d\udce6 Install\n\n```bash\npip install conflict-collection\n# or with documentation extras\npip install conflict-collection[docs]\n```\n\n---\n\n## \ud83d\ude80 Quick Start\n\n```python\nfrom conflict_collection.collectors.conflict_type import collect as collect_conflicts\nfrom conflict_collection.collectors.societal import collect as collect_social\nfrom conflict_collection.metrics.anchored_ratio import anchored_ratio\n\n# 1) Enumerate conflict cases after a merge produced conflicts\ncases = collect_conflicts(repo_path='.', resolution_sha='<resolved-commit-sha>')\nprint(len(cases), 'cases')\nprint(cases[0].conflict_type, cases[0].conflict_path)\n\n# 2) Capture social signals\nsignals = collect_social(repo_path='.')\nfor path, rec in signals.items():\n\tprint(path, rec.ours_author, rec.owner_commits_ours)\n\n# 3) Similarity metric example\nO = 'line1\\nline2\\nline3'\nR = 'line1\\nX\\nline3'\nR_hat = 'line1\\nY\\nline3'\nprint('anchored ratio =', anchored_ratio(O, R, R_hat))\n```\n\n---\n\n## \ud83d\udcda Documentation\n\nFull docs (usage guides + auto-generated API reference) are published with MkDocs & mkdocstrings:\n\nhttps://jinu-jang.github.io/conflict-collection\n\nLocal build:\n\n```bash\npip install -e .[docs]\nmkdocs serve\n```\n\n---\n\n## \ud83e\udde9 Data Models\n\n| Model | Purpose |\n| ----- | ------- |\n| Typed Conflict Cases | Frozen dataclasses per conflict archetype |\n| `Conflict5Tuple` | Canonical (A,B,O,M,R) capture |\n| Social Signals | Ownership & recency metrics per file |\n| Anchored Ratio | Algorithmic similarity between two edits |\n\n---\n\n## \ud83d\udd2c Testing\n\n```bash\ngit clone https://github.com/jinu-jang/conflict-collection\ncd conflict-collection\npip install -e .[dev]\npytest -q\n```\n\n---\n\n## \ud83e\udd1d Contributing\n\nPRs welcome! Please:\n\n1. Add or update tests\n2. Run `black . && isort . && pytest -q`\n3. If adding public API, include docstrings & update docs nav (`mkdocs.yml`)\n\nSee `docs/contributing.md` for details.\n\n---\n\n## \ud83d\udcc4 License\n\nMIT \u00a9 2025 Jinu Jang\n\n---\n\n## \ud83d\udd16 Status\n\nBeta. Interfaces may change before 0.1. Feedback appreciated.",
"bugtrack_url": null,
"license": null,
"summary": "Data collection from Git merge conflicts.",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/jinu-jang/conflict-collection",
"Issues": "https://github.com/jinu-jang/conflict-collection/issues",
"Repository": "https://github.com/jinu-jang/conflict-collection.git"
},
"split_keywords": [
"conflict",
" git",
" merge",
" parser",
" version-control"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "48aa21436db0c285e6c8f69f0c38d6365e1fa64870f6545a4841c87dd3dfada8",
"md5": "6038bfe1927b64c068b835d934b0823d",
"sha256": "b187468be33eafbdf19c93c699d6c97f264d610a1546d788f3fccf6bdf48b690"
},
"downloads": -1,
"filename": "conflict_collection-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6038bfe1927b64c068b835d934b0823d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 21051,
"upload_time": "2025-08-26T07:34:37",
"upload_time_iso_8601": "2025-08-26T07:34:37.143567Z",
"url": "https://files.pythonhosted.org/packages/48/aa/21436db0c285e6c8f69f0c38d6365e1fa64870f6545a4841c87dd3dfada8/conflict_collection-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0b4243f1f299e2dbce3fc83ad7d4d6117a19adee22821487613d182bbfe7a3a7",
"md5": "05dbd7673ef69a21018abc2c98d1b58e",
"sha256": "82aea1d97c03328ceaf046a430ca12f766a25be00fac8303483b33ad987f59b8"
},
"downloads": -1,
"filename": "conflict_collection-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "05dbd7673ef69a21018abc2c98d1b58e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 17610,
"upload_time": "2025-08-26T07:34:38",
"upload_time_iso_8601": "2025-08-26T07:34:38.320024Z",
"url": "https://files.pythonhosted.org/packages/0b/42/43f1f299e2dbce3fc83ad7d4d6117a19adee22821487613d182bbfe7a3a7/conflict_collection-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-26 07:34:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jinu-jang",
"github_project": "conflict-collection",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "conflict-collection"
}