ticket-precedent 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. ticket_precedent-0.2.0/.github/dependabot.yml +16 -0
  2. ticket_precedent-0.2.0/.github/workflows/ci.yml +57 -0
  3. ticket_precedent-0.2.0/.github/workflows/release.yml +66 -0
  4. ticket_precedent-0.2.0/.gitignore +23 -0
  5. ticket_precedent-0.2.0/.pre-commit-config.yaml +33 -0
  6. ticket_precedent-0.2.0/.python-version +1 -0
  7. ticket_precedent-0.2.0/CHANGELOG.md +40 -0
  8. ticket_precedent-0.2.0/LICENSE +21 -0
  9. ticket_precedent-0.2.0/PKG-INFO +490 -0
  10. ticket_precedent-0.2.0/README.md +461 -0
  11. ticket_precedent-0.2.0/config.example.yaml +61 -0
  12. ticket_precedent-0.2.0/pyproject.toml +92 -0
  13. ticket_precedent-0.2.0/results/derby-comments-bge-m3.json +2338 -0
  14. ticket_precedent-0.2.0/results/derby-nocomments-bge-m3.json +2338 -0
  15. ticket_precedent-0.2.0/results/rerank-derby-chunk-512.json +1128 -0
  16. ticket_precedent-0.2.0/results/rerank-zookeeper-chunk-1024.json +907 -0
  17. ticket_precedent-0.2.0/results/rerank-zookeeper-chunk-512.json +907 -0
  18. ticket_precedent-0.2.0/results/rerank-zookeeper-ticket-1024.json +907 -0
  19. ticket_precedent-0.2.0/results/zookeeper-comments-bge-m3.json +1618 -0
  20. ticket_precedent-0.2.0/results/zookeeper-nocomments-bge-m3.json +1618 -0
  21. ticket_precedent-0.2.0/scripts/eval_rerank.py +217 -0
  22. ticket_precedent-0.2.0/scripts/tune_fusion.py +40 -0
  23. ticket_precedent-0.2.0/src/ticket_precedent/__init__.py +3 -0
  24. ticket_precedent-0.2.0/src/ticket_precedent/autosync.py +75 -0
  25. ticket_precedent-0.2.0/src/ticket_precedent/chunking.py +51 -0
  26. ticket_precedent-0.2.0/src/ticket_precedent/cli.py +372 -0
  27. ticket_precedent-0.2.0/src/ticket_precedent/config.py +231 -0
  28. ticket_precedent-0.2.0/src/ticket_precedent/connectors/__init__.py +11 -0
  29. ticket_precedent-0.2.0/src/ticket_precedent/connectors/github.py +118 -0
  30. ticket_precedent-0.2.0/src/ticket_precedent/connectors/http.py +99 -0
  31. ticket_precedent-0.2.0/src/ticket_precedent/connectors/jira.py +194 -0
  32. ticket_precedent-0.2.0/src/ticket_precedent/connectors/jira_cloud.py +68 -0
  33. ticket_precedent-0.2.0/src/ticket_precedent/connectors/mantis.py +114 -0
  34. ticket_precedent-0.2.0/src/ticket_precedent/demo.py +115 -0
  35. ticket_precedent-0.2.0/src/ticket_precedent/effort.py +108 -0
  36. ticket_precedent-0.2.0/src/ticket_precedent/embeddings.py +88 -0
  37. ticket_precedent-0.2.0/src/ticket_precedent/evaluation/__init__.py +0 -0
  38. ticket_precedent-0.2.0/src/ticket_precedent/evaluation/dataset.py +71 -0
  39. ticket_precedent-0.2.0/src/ticket_precedent/evaluation/metrics.py +96 -0
  40. ticket_precedent-0.2.0/src/ticket_precedent/evaluation/runner.py +46 -0
  41. ticket_precedent-0.2.0/src/ticket_precedent/ingest.py +95 -0
  42. ticket_precedent-0.2.0/src/ticket_precedent/models.py +44 -0
  43. ticket_precedent-0.2.0/src/ticket_precedent/py.typed +0 -0
  44. ticket_precedent-0.2.0/src/ticket_precedent/search.py +347 -0
  45. ticket_precedent-0.2.0/src/ticket_precedent/server.py +176 -0
  46. ticket_precedent-0.2.0/src/ticket_precedent/store.py +323 -0
  47. ticket_precedent-0.2.0/src/ticket_precedent/text.py +80 -0
  48. ticket_precedent-0.2.0/tests/__init__.py +0 -0
  49. ticket_precedent-0.2.0/tests/conftest.py +81 -0
  50. ticket_precedent-0.2.0/tests/test_autosync.py +93 -0
  51. ticket_precedent-0.2.0/tests/test_config.py +123 -0
  52. ticket_precedent-0.2.0/tests/test_connectors.py +338 -0
  53. ticket_precedent-0.2.0/tests/test_demo.py +113 -0
  54. ticket_precedent-0.2.0/tests/test_effort.py +172 -0
  55. ticket_precedent-0.2.0/tests/test_evaluation.py +102 -0
  56. ticket_precedent-0.2.0/tests/test_github.py +193 -0
  57. ticket_precedent-0.2.0/tests/test_platform.py +166 -0
  58. ticket_precedent-0.2.0/tests/test_search.py +209 -0
  59. ticket_precedent-0.2.0/tests/test_server_and_cli.py +167 -0
  60. ticket_precedent-0.2.0/tests/test_text_and_chunking.py +59 -0
  61. ticket_precedent-0.2.0/uv.lock +1426 -0
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: uv
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ groups:
8
+ python:
9
+ patterns: ["*"]
10
+ - package-ecosystem: github-actions
11
+ directory: /
12
+ schedule:
13
+ interval: weekly
14
+ groups:
15
+ actions:
16
+ patterns: ["*"]
@@ -0,0 +1,57 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ lint:
17
+ name: Lint & type check
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v7
21
+ - uses: astral-sh/setup-uv@v7
22
+ with:
23
+ enable-cache: true
24
+ - run: uv sync --locked
25
+ - run: uv run ruff check --output-format=github .
26
+ - run: uv run ruff format --check .
27
+ - run: uv run mypy
28
+
29
+ test:
30
+ name: Tests (Python ${{ matrix.python }})
31
+ runs-on: ubuntu-latest
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ python: ["3.11", "3.12", "3.13"]
36
+ steps:
37
+ - uses: actions/checkout@v7
38
+ - uses: astral-sh/setup-uv@v7
39
+ with:
40
+ enable-cache: true
41
+ python-version: ${{ matrix.python }}
42
+ - run: uv sync --locked
43
+ - run: uv run pytest --cov --cov-report=term --cov-fail-under=85
44
+
45
+ secrets:
46
+ name: Secret scan
47
+ runs-on: ubuntu-latest
48
+ permissions:
49
+ contents: read
50
+ pull-requests: read
51
+ steps:
52
+ - uses: actions/checkout@v7
53
+ with:
54
+ fetch-depth: 0
55
+ - uses: gitleaks/gitleaks-action@v3
56
+ env:
57
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,66 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v7
16
+ - uses: astral-sh/setup-uv@v7
17
+ - name: Tag matches the package version
18
+ run: |
19
+ version=$(uv version --short)
20
+ if [ "v$version" != "$GITHUB_REF_NAME" ]; then
21
+ echo "::error::tag $GITHUB_REF_NAME does not match version $version in pyproject.toml"
22
+ exit 1
23
+ fi
24
+ - run: uv build
25
+ - name: Smoke test the wheel
26
+ run: uvx --from dist/*.whl ticket-precedent --help
27
+ - uses: actions/upload-artifact@v7
28
+ with:
29
+ name: dist
30
+ path: dist/
31
+
32
+ pypi:
33
+ name: Publish to PyPI
34
+ needs: build
35
+ runs-on: ubuntu-latest
36
+ environment:
37
+ name: pypi
38
+ url: https://pypi.org/project/ticket-precedent/
39
+ permissions:
40
+ id-token: write
41
+ steps:
42
+ - uses: actions/download-artifact@v8
43
+ with:
44
+ name: dist
45
+ path: dist/
46
+ - uses: pypa/gh-action-pypi-publish@release/v1
47
+
48
+ github:
49
+ name: GitHub release
50
+ needs: pypi
51
+ runs-on: ubuntu-latest
52
+ permissions:
53
+ contents: write
54
+ steps:
55
+ - uses: actions/checkout@v7
56
+ - uses: actions/download-artifact@v8
57
+ with:
58
+ name: dist
59
+ path: dist/
60
+ - name: Create the release with this version's changelog
61
+ env:
62
+ GH_TOKEN: ${{ github.token }}
63
+ run: |
64
+ version=${GITHUB_REF_NAME#v}
65
+ awk -v v="$version" '/^## /{p = index($0, "[" v "]") > 0; next} p' CHANGELOG.md > notes.md
66
+ gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --notes-file notes.md
@@ -0,0 +1,23 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+
9
+ # Tooling
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .coverage
14
+ coverage.xml
15
+ htmlcov/
16
+
17
+ # Never commit indexes, credentials or private configuration
18
+ *.db
19
+ *.db-shm
20
+ *.db-wal
21
+ .env
22
+ .env.*
23
+ config.yaml
@@ -0,0 +1,33 @@
1
+ # Install once with `uvx pre-commit install`. Ruff and mypy run from the locked project
2
+ # environment, so local hooks and CI always use the same versions.
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: check-yaml
8
+ - id: check-toml
9
+ - id: end-of-file-fixer
10
+ - id: trailing-whitespace
11
+ - id: check-added-large-files
12
+ - repo: https://github.com/gitleaks/gitleaks
13
+ rev: v8.21.2
14
+ hooks:
15
+ - id: gitleaks
16
+ - repo: local
17
+ hooks:
18
+ - id: ruff-check
19
+ name: ruff check
20
+ entry: uv run ruff check --fix
21
+ language: system
22
+ types: [python]
23
+ - id: ruff-format
24
+ name: ruff format
25
+ entry: uv run ruff format
26
+ language: system
27
+ types: [python]
28
+ - id: mypy
29
+ name: mypy
30
+ entry: uv run mypy
31
+ language: system
32
+ types: [python]
33
+ pass_filenames: false
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,40 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.2.0] - Unreleased
8
+
9
+ ### Added
10
+
11
+ - `tp demo` downloads a ready-made index of the 4,922 public Apache ZooKeeper tickets with
12
+ their comments, checks its SHA-256, writes a configuration that keeps it current from
13
+ Apache JIRA without credentials, and runs a first search. Without Ollama the demo falls
14
+ back to keyword search and says so.
15
+ - Published on PyPI: `uvx ticket-precedent demo` runs it without cloning the repository.
16
+ The `ticket-precedent` command is an alias of `tp`.
17
+ - JIRA Cloud connector (`type: jira-cloud`): token-paged `/rest/api/2/search/jql` with
18
+ plain-text bodies, `email` + `api_token` or anonymous access, and the full changelog and
19
+ comment thread fetched when search results cut them short.
20
+ - GitHub Issues connector (`type: github`): one or more repositories, pull requests skipped,
21
+ the whole comment thread on every sync, keys like `acme/widget#123`, GitHub Enterprise
22
+ through `url`, and waiting for the rate limit reset up to `rate_limit_wait` seconds.
23
+
24
+ ## [0.1.0] - 2026-11-15
25
+
26
+ First public version, used from a clone of the repository.
27
+
28
+ ### Added
29
+
30
+ - Hybrid search (SQLite FTS5 BM25 and sqlite-vec embeddings from Ollama, fused with
31
+ Reciprocal Rank Fusion) over JIRA Server / Data Center and MantisBT tickets and their
32
+ comments, with incremental sync.
33
+ - MCP server with `precedents_for`, `similar_tickets`, `effort_reference`, `get_ticket`
34
+ and `list_sources`, and the same operations on the command line.
35
+ - `effort_reference`: logged hours of similar finished tickets, cut off at the moment the
36
+ ticket was created, with the median and P25–P75.
37
+ - Platforms keep the tickets of different products apart.
38
+ - `tp eval`: benchmark on public Apache JIRA projects with tickets closed as duplicates,
39
+ with bootstrap confidence intervals; results for ZooKeeper and Derby.
40
+ - A cross-encoder reranker benchmark, documented as a negative result.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vladislav Barot
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.