vecadvisor 0.1.0a1__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 (78) hide show
  1. vecadvisor-0.1.0a1/.gitattributes +9 -0
  2. vecadvisor-0.1.0a1/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  3. vecadvisor-0.1.0a1/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. vecadvisor-0.1.0a1/.github/pull_request_template.md +14 -0
  5. vecadvisor-0.1.0a1/.github/workflows/ci.yml +62 -0
  6. vecadvisor-0.1.0a1/.github/workflows/publish.yml +40 -0
  7. vecadvisor-0.1.0a1/.gitignore +17 -0
  8. vecadvisor-0.1.0a1/CONTRIBUTING.md +40 -0
  9. vecadvisor-0.1.0a1/LICENSE +176 -0
  10. vecadvisor-0.1.0a1/PKG-INFO +460 -0
  11. vecadvisor-0.1.0a1/README.md +424 -0
  12. vecadvisor-0.1.0a1/SECURITY.md +21 -0
  13. vecadvisor-0.1.0a1/docker/docker-compose.yml +15 -0
  14. vecadvisor-0.1.0a1/docs/assets/synthetic-crossover.svg +268 -0
  15. vecadvisor-0.1.0a1/docs/benchmarks/README.md +15 -0
  16. vecadvisor-0.1.0a1/docs/benchmarks/real-pgvector-plan.md +67 -0
  17. vecadvisor-0.1.0a1/docs/benchmarks/synthetic-calibration.json +32 -0
  18. vecadvisor-0.1.0a1/docs/benchmarks/synthetic-proof.json +219 -0
  19. vecadvisor-0.1.0a1/docs/benchmarks/synthetic-sweep.json +1865 -0
  20. vecadvisor-0.1.0a1/docs/release.md +63 -0
  21. vecadvisor-0.1.0a1/examples/README.md +50 -0
  22. vecadvisor-0.1.0a1/examples/demo.sql +39 -0
  23. vecadvisor-0.1.0a1/examples/query-vector.json +1 -0
  24. vecadvisor-0.1.0a1/examples/query-vectors.json +7 -0
  25. vecadvisor-0.1.0a1/pyproject.toml +75 -0
  26. vecadvisor-0.1.0a1/src/vecadvisor/__init__.py +5 -0
  27. vecadvisor-0.1.0a1/src/vecadvisor/bench/__init__.py +1 -0
  28. vecadvisor-0.1.0a1/src/vecadvisor/bench/calibrate.py +292 -0
  29. vecadvisor-0.1.0a1/src/vecadvisor/bench/crossover.py +440 -0
  30. vecadvisor-0.1.0a1/src/vecadvisor/bench/datasets.py +246 -0
  31. vecadvisor-0.1.0a1/src/vecadvisor/bench/db_runner.py +409 -0
  32. vecadvisor-0.1.0a1/src/vecadvisor/bench/groundtruth.py +220 -0
  33. vecadvisor-0.1.0a1/src/vecadvisor/bench/plots.py +1034 -0
  34. vecadvisor-0.1.0a1/src/vecadvisor/bench/proof.py +248 -0
  35. vecadvisor-0.1.0a1/src/vecadvisor/bench/runner.py +456 -0
  36. vecadvisor-0.1.0a1/src/vecadvisor/bench/sweep.py +724 -0
  37. vecadvisor-0.1.0a1/src/vecadvisor/bench/validate.py +413 -0
  38. vecadvisor-0.1.0a1/src/vecadvisor/calibration.py +196 -0
  39. vecadvisor-0.1.0a1/src/vecadvisor/cli.py +2606 -0
  40. vecadvisor-0.1.0a1/src/vecadvisor/costmodel.py +153 -0
  41. vecadvisor-0.1.0a1/src/vecadvisor/diagnostics.py +406 -0
  42. vecadvisor-0.1.0a1/src/vecadvisor/introspect.py +389 -0
  43. vecadvisor-0.1.0a1/src/vecadvisor/local_cache.py +178 -0
  44. vecadvisor-0.1.0a1/src/vecadvisor/local_probe.py +598 -0
  45. vecadvisor-0.1.0a1/src/vecadvisor/models.py +246 -0
  46. vecadvisor-0.1.0a1/src/vecadvisor/pgversion.py +102 -0
  47. vecadvisor-0.1.0a1/src/vecadvisor/plan.py +240 -0
  48. vecadvisor-0.1.0a1/src/vecadvisor/planner_observer.py +125 -0
  49. vecadvisor-0.1.0a1/src/vecadvisor/py.typed +1 -0
  50. vecadvisor-0.1.0a1/src/vecadvisor/query_spec.py +231 -0
  51. vecadvisor-0.1.0a1/src/vecadvisor/recommend.py +818 -0
  52. vecadvisor-0.1.0a1/src/vecadvisor/selectivity.py +205 -0
  53. vecadvisor-0.1.0a1/src/vecadvisor/statistics_advisor.py +113 -0
  54. vecadvisor-0.1.0a1/src/vecadvisor/stats_health.py +130 -0
  55. vecadvisor-0.1.0a1/tests/test_benchmark_runner.py +118 -0
  56. vecadvisor-0.1.0a1/tests/test_calibration.py +139 -0
  57. vecadvisor-0.1.0a1/tests/test_cli_integration.py +1446 -0
  58. vecadvisor-0.1.0a1/tests/test_costmodel.py +106 -0
  59. vecadvisor-0.1.0a1/tests/test_crossover.py +143 -0
  60. vecadvisor-0.1.0a1/tests/test_db_runner.py +192 -0
  61. vecadvisor-0.1.0a1/tests/test_diagnostics.py +173 -0
  62. vecadvisor-0.1.0a1/tests/test_groundtruth.py +50 -0
  63. vecadvisor-0.1.0a1/tests/test_introspect_integration.py +145 -0
  64. vecadvisor-0.1.0a1/tests/test_local_cache.py +94 -0
  65. vecadvisor-0.1.0a1/tests/test_local_probe.py +159 -0
  66. vecadvisor-0.1.0a1/tests/test_pgversion.py +40 -0
  67. vecadvisor-0.1.0a1/tests/test_plan_integration.py +162 -0
  68. vecadvisor-0.1.0a1/tests/test_planner_observer.py +124 -0
  69. vecadvisor-0.1.0a1/tests/test_plots.py +217 -0
  70. vecadvisor-0.1.0a1/tests/test_proof.py +176 -0
  71. vecadvisor-0.1.0a1/tests/test_query_spec.py +90 -0
  72. vecadvisor-0.1.0a1/tests/test_recommend.py +362 -0
  73. vecadvisor-0.1.0a1/tests/test_selectivity.py +77 -0
  74. vecadvisor-0.1.0a1/tests/test_statistics_advisor.py +111 -0
  75. vecadvisor-0.1.0a1/tests/test_stats_health.py +64 -0
  76. vecadvisor-0.1.0a1/tests/test_sweep.py +157 -0
  77. vecadvisor-0.1.0a1/tests/test_synthetic_dataset.py +109 -0
  78. vecadvisor-0.1.0a1/tests/test_validation.py +131 -0
@@ -0,0 +1,9 @@
1
+ * text=auto eol=lf
2
+
3
+ *.png binary
4
+ *.jpg binary
5
+ *.jpeg binary
6
+ *.gif binary
7
+ *.webp binary
8
+ *.ico binary
9
+ *.pdf binary
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a reproducible VecAdvisor problem
4
+ labels: bug
5
+ ---
6
+
7
+ ## What happened?
8
+
9
+ Describe the behavior you saw and what you expected.
10
+
11
+ ## Reproduction
12
+
13
+ ```bash
14
+ vecadvisor ...
15
+ ```
16
+
17
+ ## Environment
18
+
19
+ - VecAdvisor version:
20
+ - Python version:
21
+ - PostgreSQL version:
22
+ - pgvector version:
23
+ - Operating system:
24
+
25
+ ## Additional context
26
+
27
+ Include relevant output, redacting private DSNs, table names, and vectors.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest a cost-model, CLI, benchmark, or integration improvement
4
+ labels: enhancement
5
+ ---
6
+
7
+ ## Problem
8
+
9
+ What workload, query shape, or operational pain should VecAdvisor handle?
10
+
11
+ ## Proposed behavior
12
+
13
+ Describe the expected command, output, or model behavior.
14
+
15
+ ## Evidence
16
+
17
+ Share public docs, benchmark commands, or anonymized measurements if available.
@@ -0,0 +1,14 @@
1
+ ## Summary
2
+
3
+ Describe the change and the workload or bug it addresses.
4
+
5
+ ## Verification
6
+
7
+ - [ ] `python -m ruff check .`
8
+ - [ ] `python -m mypy src/vecadvisor`
9
+ - [ ] `python -m pytest`
10
+ - [ ] `python -m build`
11
+
12
+ ## Notes
13
+
14
+ Call out benchmark artifacts, compatibility risks, or follow-up work.
@@ -0,0 +1,62 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ test:
11
+ name: Python ${{ matrix.python-version }}
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.11", "3.12"]
18
+
19
+ services:
20
+ postgres:
21
+ image: pgvector/pgvector:pg17
22
+ env:
23
+ POSTGRES_USER: postgres
24
+ POSTGRES_PASSWORD: postgres
25
+ POSTGRES_DB: vecadvisor
26
+ ports:
27
+ - 5432:5432
28
+ options: >-
29
+ --health-cmd "pg_isready -U postgres -d vecadvisor"
30
+ --health-interval 5s
31
+ --health-timeout 5s
32
+ --health-retries 12
33
+
34
+ env:
35
+ VECADVISOR_TEST_DSN: postgresql://postgres:postgres@localhost:5432/vecadvisor
36
+
37
+ steps:
38
+ - name: Check out repository
39
+ uses: actions/checkout@v7
40
+
41
+ - name: Set up Python
42
+ uses: actions/setup-python@v6
43
+ with:
44
+ python-version: ${{ matrix.python-version }}
45
+ cache: pip
46
+
47
+ - name: Install package and development dependencies
48
+ run: |
49
+ python -m pip install --upgrade pip
50
+ python -m pip install -e ".[dev]"
51
+
52
+ - name: Lint
53
+ run: python -m ruff check .
54
+
55
+ - name: Type check
56
+ run: python -m mypy src/vecadvisor
57
+
58
+ - name: Test
59
+ run: python -m pytest
60
+
61
+ - name: Build package
62
+ run: python -m build
@@ -0,0 +1,40 @@
1
+ name: Publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ confirm:
7
+ description: Type "publish" after PyPI Trusted Publishing is configured.
8
+ required: true
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ pypi:
15
+ name: Publish to PyPI
16
+ if: github.event.inputs.confirm == 'publish'
17
+ runs-on: ubuntu-latest
18
+ environment:
19
+ name: pypi
20
+ url: https://pypi.org/p/vecadvisor
21
+ permissions:
22
+ id-token: write
23
+
24
+ steps:
25
+ - name: Check out repository
26
+ uses: actions/checkout@v7
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v6
30
+ with:
31
+ python-version: "3.12"
32
+
33
+ - name: Build package
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ python -m pip install build
37
+ python -m build
38
+
39
+ - name: Publish package
40
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,17 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .coverage
11
+ htmlcov/
12
+ .env
13
+ *.log
14
+ benchmarks/*.csv
15
+ benchmarks/*.json
16
+ profiles/*.json
17
+ .vecadvisor-cache/
@@ -0,0 +1,40 @@
1
+ # Contributing
2
+
3
+ Thanks for helping make VecAdvisor better.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ python -m pip install -e ".[dev]"
9
+ ```
10
+
11
+ Run checks before opening a pull request:
12
+
13
+ ```bash
14
+ python -m ruff check .
15
+ python -m mypy src/vecadvisor
16
+ python -m pytest
17
+ python -m build
18
+ ```
19
+
20
+ PostgreSQL integration tests use:
21
+
22
+ ```text
23
+ postgresql://postgres:postgres@localhost:5432/vecadvisor
24
+ ```
25
+
26
+ They skip automatically when a reachable pgvector-enabled database is not
27
+ available.
28
+
29
+ ## Pull Requests
30
+
31
+ - Keep changes focused and explain the workload or failure mode they address.
32
+ - Add or update tests for behavior changes.
33
+ - Avoid benchmark claims without a reproducible command and artifact.
34
+ - Do not copy source from AGPL or source-available vector extensions.
35
+
36
+ ## Design Direction
37
+
38
+ VecAdvisor is a predictive advisor, not a brute-force benchmark harness. New
39
+ strategy work should expose statistics, local-selectivity signals, cost
40
+ formula inputs, and calibration hooks rather than only timing every option.
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work.
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form,
39
+ that is based on (or derived from) the Work and for which the editorial
40
+ revisions, annotations, elaborations, or other modifications represent, as a
41
+ whole, an original work of authorship. For the purposes of this License,
42
+ Derivative Works shall not include works that remain separable from, or
43
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
44
+ Works thereof.
45
+
46
+ "Contribution" shall mean any work of authorship, including the original
47
+ version of the Work and any modifications or additions to that Work or
48
+ Derivative Works thereof, that is intentionally submitted to Licensor for
49
+ inclusion in the Work by the copyright owner or by an individual or Legal
50
+ Entity authorized to submit on behalf of the copyright owner. For the
51
+ purposes of this definition, "submitted" means any form of electronic,
52
+ verbal, or written communication sent to the Licensor or its representatives,
53
+ including but not limited to communication on electronic mailing lists,
54
+ source code control systems, and issue tracking systems that are managed by,
55
+ or on behalf of, the Licensor for the purpose of discussing and improving the
56
+ Work, but excluding communication that is conspicuously marked or otherwise
57
+ designated in writing by the copyright owner as "Not a Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
60
+ behalf of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
64
+ License, each Contributor hereby grants to You a perpetual, worldwide,
65
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
66
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
67
+ sublicense, and distribute the Work and such Derivative Works in Source or
68
+ Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of this
71
+ License, each Contributor hereby grants to You a perpetual, worldwide,
72
+ non-exclusive, no-charge, royalty-free, irrevocable patent license to make,
73
+ have made, use, offer to sell, sell, import, and otherwise transfer the Work,
74
+ where such license applies only to those patent claims licensable by such
75
+ Contributor that are necessarily infringed by their Contribution alone or by
76
+ combination of their Contribution with the Work to which such Contribution
77
+ was submitted. If You institute patent litigation against any entity
78
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the Work
79
+ or a Contribution incorporated within the Work constitutes direct or
80
+ contributory patent infringement, then any patent licenses granted to You
81
+ under this License for that Work shall terminate as of the date such
82
+ litigation is filed.
83
+
84
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
85
+ Derivative Works thereof in any medium, with or without modifications, and in
86
+ Source or Object form, provided that You meet the following conditions:
87
+
88
+ (a) You must give any other recipients of the Work or Derivative Works a
89
+ copy of this License; and
90
+
91
+ (b) You must cause any modified files to carry prominent notices stating that
92
+ You changed the files; and
93
+
94
+ (c) You must retain, in the Source form of any Derivative Works that You
95
+ distribute, all copyright, patent, trademark, and attribution notices from
96
+ the Source form of the Work, excluding those notices that do not pertain to
97
+ any part of the Derivative Works; and
98
+
99
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
100
+ then any Derivative Works that You distribute must include a readable copy of
101
+ the attribution notices contained within such NOTICE file, excluding those
102
+ notices that do not pertain to any part of the Derivative Works, in at least
103
+ one of the following places: within a NOTICE text file distributed as part of
104
+ the Derivative Works; within the Source form or documentation, if provided
105
+ along with the Derivative Works; or within a display generated by the
106
+ Derivative Works, if and wherever such third-party notices normally appear.
107
+ The contents of the NOTICE file are for informational purposes only and do
108
+ not modify the License. You may add Your own attribution notices within
109
+ Derivative Works that You distribute, alongside or as an addendum to the
110
+ NOTICE text from the Work, provided that such additional attribution notices
111
+ cannot be construed as modifying the License.
112
+
113
+ You may add Your own copyright statement to Your modifications and may
114
+ provide additional or different license terms and conditions for use,
115
+ reproduction, or distribution of Your modifications, or for any such
116
+ Derivative Works as a whole, provided Your use, reproduction, and
117
+ distribution of the Work otherwise complies with the conditions stated in
118
+ this License.
119
+
120
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
121
+ Contribution intentionally submitted for inclusion in the Work by You to the
122
+ Licensor shall be under the terms and conditions of this License, without any
123
+ additional terms or conditions. Notwithstanding the above, nothing herein
124
+ shall supersede or modify the terms of any separate license agreement you may
125
+ have executed with Licensor regarding such Contributions.
126
+
127
+ 6. Trademarks. This License does not grant permission to use the trade names,
128
+ trademarks, service marks, or product names of the Licensor, except as
129
+ required for reasonable and customary use in describing the origin of the
130
+ Work and reproducing the content of the NOTICE file.
131
+
132
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
133
+ writing, Licensor provides the Work (and each Contributor provides its
134
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
135
+ KIND, either express or implied, including, without limitation, any warranties
136
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
137
+ PARTICULAR PURPOSE. You are solely responsible for determining the
138
+ appropriateness of using or redistributing the Work and assume any risks
139
+ associated with Your exercise of permissions under this License.
140
+
141
+ 8. Limitation of Liability. In no event and under no legal theory, whether
142
+ in tort (including negligence), contract, or otherwise, unless required by
143
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
144
+ in writing, shall any Contributor be liable to You for damages, including any
145
+ direct, indirect, special, incidental, or consequential damages of any
146
+ character arising as a result of this License or out of the use or inability
147
+ to use the Work (including but not limited to damages for loss of goodwill,
148
+ work stoppage, computer failure or malfunction, or any and all other
149
+ commercial damages or losses), even if such Contributor has been advised of
150
+ the possibility of such damages.
151
+
152
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work
153
+ or Derivative Works thereof, You may choose to offer, and charge a fee for,
154
+ acceptance of support, warranty, indemnity, or other liability obligations
155
+ and/or rights consistent with this License. However, in accepting such
156
+ obligations, You may act only on Your own behalf and on Your sole
157
+ responsibility, not on behalf of any other Contributor, and only if You agree
158
+ to indemnify, defend, and hold each Contributor harmless for any liability
159
+ incurred by, or claims asserted against, such Contributor by reason of your
160
+ accepting any such warranty or additional liability.
161
+
162
+ END OF TERMS AND CONDITIONS
163
+
164
+ Copyright 2026 Varun Sharma
165
+
166
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
167
+ use this file except in compliance with the License. You may obtain a copy of
168
+ the License at
169
+
170
+ http://www.apache.org/licenses/LICENSE-2.0
171
+
172
+ Unless required by applicable law or agreed to in writing, software
173
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
174
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
175
+ License for the specific language governing permissions and limitations
176
+ under the License.