ctxrank 0.1.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 (67) hide show
  1. ctxrank-0.1.0/.gitattributes +5 -0
  2. ctxrank-0.1.0/.github/workflows/ci.yml +42 -0
  3. ctxrank-0.1.0/.github/workflows/release.yml +108 -0
  4. ctxrank-0.1.0/.gitignore +7 -0
  5. ctxrank-0.1.0/Cargo.lock +993 -0
  6. ctxrank-0.1.0/Cargo.toml +72 -0
  7. ctxrank-0.1.0/LICENSE +202 -0
  8. ctxrank-0.1.0/NOTICE +14 -0
  9. ctxrank-0.1.0/PKG-INFO +221 -0
  10. ctxrank-0.1.0/README.md +203 -0
  11. ctxrank-0.1.0/assets/bench-dark.svg +502 -0
  12. ctxrank-0.1.0/assets/bench-light.svg +502 -0
  13. ctxrank-0.1.0/assets/demo.tape +23 -0
  14. ctxrank-0.1.0/assets/tokens-dark.svg +643 -0
  15. ctxrank-0.1.0/assets/tokens-light.svg +643 -0
  16. ctxrank-0.1.0/bench/aider_map.py +26 -0
  17. ctxrank-0.1.0/bench/aider_run.sh +28 -0
  18. ctxrank-0.1.0/bench/plot.py +136 -0
  19. ctxrank-0.1.0/bench/results/cpython-map2048.tokens +1 -0
  20. ctxrank-0.1.0/bench/results/cpython-map2048.txt +283 -0
  21. ctxrank-0.1.0/bench/results/cpython-map8192.tokens +1 -0
  22. ctxrank-0.1.0/bench/results/cpython-verbose.txt +2 -0
  23. ctxrank-0.1.0/bench/results/cpython.commit +1 -0
  24. ctxrank-0.1.0/bench/results/linux-aider.failed +1 -0
  25. ctxrank-0.1.0/bench/results/linux-map2048.tokens +1 -0
  26. ctxrank-0.1.0/bench/results/linux-map2048.txt +282 -0
  27. ctxrank-0.1.0/bench/results/linux-map8192.tokens +1 -0
  28. ctxrank-0.1.0/bench/results/linux-verbose.txt +2 -0
  29. ctxrank-0.1.0/bench/results/linux.commit +1 -0
  30. ctxrank-0.1.0/bench/results/rust-aider.err +25 -0
  31. ctxrank-0.1.0/bench/results/rust-aider.failed +1 -0
  32. ctxrank-0.1.0/bench/results/rust-map2048.tokens +1 -0
  33. ctxrank-0.1.0/bench/results/rust-map2048.txt +271 -0
  34. ctxrank-0.1.0/bench/results/rust-map8192.tokens +1 -0
  35. ctxrank-0.1.0/bench/results/rust-verbose.txt +2 -0
  36. ctxrank-0.1.0/bench/results/rust.commit +1 -0
  37. ctxrank-0.1.0/bench/run.sh +48 -0
  38. ctxrank-0.1.0/py/Cargo.toml +15 -0
  39. ctxrank-0.1.0/py/src/lib.rs +56 -0
  40. ctxrank-0.1.0/pyproject.toml +30 -0
  41. ctxrank-0.1.0/python/ctxrank/__init__.py +23 -0
  42. ctxrank-0.1.0/python/ctxrank/__main__.py +3 -0
  43. ctxrank-0.1.0/python/ctxrank/py.typed +0 -0
  44. ctxrank-0.1.0/queries/bash.scm +2 -0
  45. ctxrank-0.1.0/queries/c-extra.scm +14 -0
  46. ctxrank-0.1.0/queries/haskell.scm +9 -0
  47. ctxrank-0.1.0/queries/kotlin.scm +7 -0
  48. ctxrank-0.1.0/queries/scala.scm +67 -0
  49. ctxrank-0.1.0/queries/zig.scm +4 -0
  50. ctxrank-0.1.0/rustfmt.toml +2 -0
  51. ctxrank-0.1.0/src/cli.rs +280 -0
  52. ctxrank-0.1.0/src/index.rs +226 -0
  53. ctxrank-0.1.0/src/lang.rs +120 -0
  54. ctxrank-0.1.0/src/lib.rs +12 -0
  55. ctxrank-0.1.0/src/main.rs +3 -0
  56. ctxrank-0.1.0/src/map.rs +530 -0
  57. ctxrank-0.1.0/src/mcp.rs +259 -0
  58. ctxrank-0.1.0/src/rank.rs +392 -0
  59. ctxrank-0.1.0/src/stats.rs +66 -0
  60. ctxrank-0.1.0/src/tags.rs +275 -0
  61. ctxrank-0.1.0/tests/basics.rs +84 -0
  62. ctxrank-0.1.0/tests/fixture/.gitignore +1 -0
  63. ctxrank-0.1.0/tests/fixture/app/main.py +13 -0
  64. ctxrank-0.1.0/tests/fixture/ignored/x.py +1 -0
  65. ctxrank-0.1.0/tests/fixture/lib/geometry.rs +14 -0
  66. ctxrank-0.1.0/tests/fixture/lib/list.c +22 -0
  67. ctxrank-0.1.0/tests/fixture/lib/store.py +16 -0
@@ -0,0 +1,5 @@
1
+ * text=auto eol=lf
2
+ *.svg text eol=lf
3
+ *.gif binary
4
+ *.png binary
5
+ tests/fixture/** linguist-vendored
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest, windows-latest]
14
+ runs-on: ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: dtolnay/rust-toolchain@stable
18
+ with:
19
+ components: clippy, rustfmt
20
+ - uses: Swatinem/rust-cache@v2
21
+ - run: cargo fmt --check
22
+ if: matrix.os == 'ubuntu-latest'
23
+ - run: cargo clippy --all-targets -- -D warnings
24
+ - run: cargo test
25
+ - name: Smoke test on this repo
26
+ run: cargo run --release -- -v map --tokens 512
27
+
28
+ python:
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ - uses: actions/setup-python@v5
33
+ with:
34
+ python-version: "3.12"
35
+ - uses: PyO3/maturin-action@v1
36
+ with:
37
+ command: build
38
+ args: --release --out dist
39
+ - run: |
40
+ pip install dist/*.whl
41
+ ctxrank --version
42
+ python -c "import ctxrank; print(ctxrank.repo_map('.', tokens=256))"
@@ -0,0 +1,108 @@
1
+ name: Release
2
+
3
+ # Push a tag like v0.1.0. Binaries go to a draft GitHub release; wheels and the crate are
4
+ # published only when the matching manual jobs below are enabled.
5
+ on:
6
+ push:
7
+ tags: ["v*"]
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: write
12
+
13
+ jobs:
14
+ binaries:
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ include:
19
+ - { os: ubuntu-latest, target: x86_64-unknown-linux-musl }
20
+ - { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-musl }
21
+ - { os: macos-15-intel, target: x86_64-apple-darwin }
22
+ - { os: macos-latest, target: aarch64-apple-darwin }
23
+ - { os: windows-latest, target: x86_64-pc-windows-msvc }
24
+ - { os: windows-11-arm, target: aarch64-pc-windows-msvc }
25
+ runs-on: ${{ matrix.os }}
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: dtolnay/rust-toolchain@stable
29
+ with:
30
+ targets: ${{ matrix.target }}
31
+ - name: musl tools
32
+ if: contains(matrix.target, 'musl')
33
+ run: sudo apt-get update && sudo apt-get install -y musl-tools
34
+ - run: cargo build --profile dist --locked --target ${{ matrix.target }}
35
+ - name: Package
36
+ shell: bash
37
+ run: |
38
+ name=ctxrank-${GITHUB_REF_NAME}-${{ matrix.target }}
39
+ mkdir "$name"
40
+ cp README.md LICENSE NOTICE "$name"/
41
+ if [[ "${{ matrix.target }}" == *windows* ]]; then
42
+ cp target/${{ matrix.target }}/dist/ctxrank.exe "$name"/
43
+ 7z a "$name.zip" "$name"
44
+ else
45
+ cp target/${{ matrix.target }}/dist/ctxrank "$name"/
46
+ tar czf "$name.tar.gz" "$name"
47
+ fi
48
+ - uses: softprops/action-gh-release@v2
49
+ with:
50
+ draft: true
51
+ files: ctxrank-*.*
52
+
53
+ wheels:
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ include:
58
+ - { os: ubuntu-latest, target: x86_64, manylinux: auto }
59
+ - { os: ubuntu-latest, target: aarch64, manylinux: "2_28" }
60
+ - { os: ubuntu-latest, target: x86_64, manylinux: musllinux_1_2 }
61
+ - { os: macos-15-intel, target: x86_64 }
62
+ - { os: macos-latest, target: aarch64 }
63
+ - { os: windows-latest, target: x64 }
64
+ runs-on: ${{ matrix.os }}
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+ - uses: actions/setup-python@v5
68
+ with:
69
+ python-version: "3.12"
70
+ - uses: PyO3/maturin-action@v1
71
+ with:
72
+ target: ${{ matrix.target }}
73
+ manylinux: ${{ matrix.manylinux || 'auto' }}
74
+ args: --release --out dist
75
+ - uses: actions/upload-artifact@v4
76
+ with:
77
+ name: wheels-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'native' }}
78
+ path: dist
79
+
80
+ sdist:
81
+ runs-on: ubuntu-latest
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ - uses: PyO3/maturin-action@v1
85
+ with:
86
+ command: sdist
87
+ args: --out dist
88
+ - uses: actions/upload-artifact@v4
89
+ with:
90
+ name: sdist
91
+ path: dist
92
+
93
+ pypi:
94
+ # Uses PyPI trusted publishing: add this repo and workflow as a publisher on pypi.org first.
95
+ needs: [wheels, sdist]
96
+ if: startsWith(github.ref, 'refs/tags/v')
97
+ runs-on: ubuntu-latest
98
+ environment: pypi
99
+ permissions:
100
+ id-token: write
101
+ steps:
102
+ - uses: actions/download-artifact@v4
103
+ with:
104
+ path: dist
105
+ merge-multiple: true
106
+ - uses: pypa/gh-action-pypi-publish@release/v1
107
+ with:
108
+ packages-dir: dist
@@ -0,0 +1,7 @@
1
+ /target
2
+ *.pyc
3
+ __pycache__/
4
+ /dist
5
+ /bench/corpora
6
+ /DECISIONS.md
7
+ /launch