duckdb-vectors 261014__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.
- duckdb_vectors-261014/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- duckdb_vectors-261014/.github/ISSUE_TEMPLATE/config.yml +1 -0
- duckdb_vectors-261014/.github/ISSUE_TEMPLATE/task.md +36 -0
- duckdb_vectors-261014/.github/PULL_REQUEST_TEMPLATE.md +31 -0
- duckdb_vectors-261014/.github/workflows/ci.yml +29 -0
- duckdb_vectors-261014/.github/workflows/publish.yml +21 -0
- duckdb_vectors-261014/.gitignore +27 -0
- duckdb_vectors-261014/.hadolint.yaml +18 -0
- duckdb_vectors-261014/.markdownlint.json +19 -0
- duckdb_vectors-261014/CHANGES.md +62 -0
- duckdb_vectors-261014/CONTRIBUTING.md +46 -0
- duckdb_vectors-261014/LICENSE +21 -0
- duckdb_vectors-261014/Makefile +126 -0
- duckdb_vectors-261014/PKG-INFO +309 -0
- duckdb_vectors-261014/README.md +271 -0
- duckdb_vectors-261014/documentation/aws-bedrock-agentcore-guide.md +134 -0
- duckdb_vectors-261014/documentation/aws-bedrock-agentcore-workbook.md +97 -0
- duckdb_vectors-261014/documentation/aws-lambda-guide.md +124 -0
- duckdb_vectors-261014/documentation/aws-lambda-workbook.md +85 -0
- duckdb_vectors-261014/documentation/developer-workbook.md +204 -0
- duckdb_vectors-261014/documentation/docker-agent-guide.md +153 -0
- duckdb_vectors-261014/documentation/docker-agent-workbook.md +112 -0
- duckdb_vectors-261014/documentation/duckdb-vectors-guide.md +139 -0
- duckdb_vectors-261014/documentation/duckdb-vectors-primitive.md +166 -0
- duckdb_vectors-261014/documentation/duckdb-workbook.md +198 -0
- duckdb_vectors-261014/documentation/setup-llm-wiki-to-rag-procedure.md +103 -0
- duckdb_vectors-261014/documentation/setup-rag-procedure.md +124 -0
- duckdb_vectors-261014/documentation/setup-skills-search-procedure.md +113 -0
- duckdb_vectors-261014/examples/Dockerfile +22 -0
- duckdb_vectors-261014/examples/agentcore-rag-agent/agent.py +57 -0
- duckdb_vectors-261014/examples/agentcore-rag-agent/requirements.txt +2 -0
- duckdb_vectors-261014/examples/docker-agent/Dockerfile +37 -0
- duckdb_vectors-261014/examples/docker-agent/agent.py +122 -0
- duckdb_vectors-261014/examples/docker-agent/requirements.txt +1 -0
- duckdb_vectors-261014/examples/docker-rag-agent/Dockerfile +49 -0
- duckdb_vectors-261014/examples/docker-rag-agent/agent.py +116 -0
- duckdb_vectors-261014/examples/docker-rag-agent/requirements.txt +2 -0
- duckdb_vectors-261014/examples/docs/architecture.md +9 -0
- duckdb_vectors-261014/examples/docs/getting-started.md +13 -0
- duckdb_vectors-261014/examples/lambda-rag-agent/Dockerfile +24 -0
- duckdb_vectors-261014/examples/lambda-rag-agent/build_index.py +23 -0
- duckdb_vectors-261014/examples/lambda-rag-agent/handler.py +50 -0
- duckdb_vectors-261014/examples/runtime_readonly.py +24 -0
- duckdb_vectors-261014/examples/skill_registry.py +42 -0
- duckdb_vectors-261014/fixtures/cloudformation/ping-agentcore.yaml +46 -0
- duckdb_vectors-261014/fixtures/cloudformation/ping-lambda.yaml +59 -0
- duckdb_vectors-261014/fixtures/shell/ping-agentcore.sh +69 -0
- duckdb_vectors-261014/fixtures/shell/ping-docker.sh +16 -0
- duckdb_vectors-261014/fixtures/shell/ping-lambda.sh +61 -0
- duckdb_vectors-261014/pyproject.toml +81 -0
- duckdb_vectors-261014/scripts/ping_host_index.py +28 -0
- duckdb_vectors-261014/scripts/ping_support.py +62 -0
- duckdb_vectors-261014/scripts/ping_validate.py +44 -0
- duckdb_vectors-261014/src/duckdb_vectors/__init__.py +30 -0
- duckdb_vectors-261014/src/duckdb_vectors/chunkers/__init__.py +1 -0
- duckdb_vectors-261014/src/duckdb_vectors/chunkers/base.py +19 -0
- duckdb_vectors-261014/src/duckdb_vectors/chunkers/markdown.py +117 -0
- duckdb_vectors-261014/src/duckdb_vectors/cli.py +111 -0
- duckdb_vectors-261014/src/duckdb_vectors/config.py +59 -0
- duckdb_vectors-261014/src/duckdb_vectors/embedders/__init__.py +1 -0
- duckdb_vectors-261014/src/duckdb_vectors/embedders/base.py +27 -0
- duckdb_vectors-261014/src/duckdb_vectors/embedders/bedrock.py +107 -0
- duckdb_vectors-261014/src/duckdb_vectors/embedders/hashing.py +49 -0
- duckdb_vectors-261014/src/duckdb_vectors/embedders/local.py +63 -0
- duckdb_vectors-261014/src/duckdb_vectors/embedders/registry.py +67 -0
- duckdb_vectors-261014/src/duckdb_vectors/etag.py +19 -0
- duckdb_vectors-261014/src/duckdb_vectors/indexer.py +148 -0
- duckdb_vectors-261014/src/duckdb_vectors/models.py +34 -0
- duckdb_vectors-261014/src/duckdb_vectors/py.typed +0 -0
- duckdb_vectors-261014/src/duckdb_vectors/store.py +438 -0
- duckdb_vectors-261014/tests/__init__.py +0 -0
- duckdb_vectors-261014/tests/test_backends.py +85 -0
- duckdb_vectors-261014/tests/test_chunkers.py +56 -0
- duckdb_vectors-261014/tests/test_cli.py +44 -0
- duckdb_vectors-261014/tests/test_config.py +37 -0
- duckdb_vectors-261014/tests/test_container_smoke.py +31 -0
- duckdb_vectors-261014/tests/test_embedders.py +39 -0
- duckdb_vectors-261014/tests/test_etag.py +23 -0
- duckdb_vectors-261014/tests/test_indexer.py +66 -0
- duckdb_vectors-261014/tests/test_ranking_sql.py +162 -0
- duckdb_vectors-261014/tests/test_store.py +112 -0
- duckdb_vectors-261014/uv.lock +1246 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report something that does not work as expected
|
|
4
|
+
title: ""
|
|
5
|
+
labels: "bug"
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### What happened?
|
|
10
|
+
|
|
11
|
+
<!-- What you expected, and what actually happened. -->
|
|
12
|
+
|
|
13
|
+
### How to reproduce
|
|
14
|
+
|
|
15
|
+
<!-- A minimal snippet or steps. The smaller, the faster we can help. -->
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Environment
|
|
21
|
+
|
|
22
|
+
- duckdb-vectors version:
|
|
23
|
+
- Python version:
|
|
24
|
+
- Backend (`hashing` / `local` / `bedrock:...`) and read-only mode:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
blank_issues_enabled: true
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Task
|
|
3
|
+
about: Propose a feature, improvement, or fix as a four-section ticket
|
|
4
|
+
title: ""
|
|
5
|
+
labels: ""
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
This project uses a four-section ticket (the TrunkFlow fat ticket): the issue
|
|
11
|
+
embeds the design and a Definition of Done, so the work is understood before it
|
|
12
|
+
starts. Fill in all four sections. Keep each one tight.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
### What is this?
|
|
16
|
+
|
|
17
|
+
<!-- The feature, capability, or bug, stated precisely. Name the components
|
|
18
|
+
impacted and the boundaries. -->
|
|
19
|
+
|
|
20
|
+
### Why does it matter?
|
|
21
|
+
|
|
22
|
+
<!-- The problem this solves and who benefits. What it unlocks or unblocks. -->
|
|
23
|
+
|
|
24
|
+
### How to implement it?
|
|
25
|
+
|
|
26
|
+
<!-- The design decisions, not step-by-step code. For each decision: the
|
|
27
|
+
options considered and the preferred option with its rationale. -->
|
|
28
|
+
|
|
29
|
+
### Definition of done
|
|
30
|
+
|
|
31
|
+
<!-- A checkable, ordered task list. Include docs, tests, implementation, and
|
|
32
|
+
verification. -->
|
|
33
|
+
|
|
34
|
+
- [ ]
|
|
35
|
+
- [ ]
|
|
36
|
+
- [ ] Lint (`ruff check`, `ruff format --check`) and tests (`pytest`) pass.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Thanks for the contribution. The design rationale lives in the linked issue
|
|
3
|
+
(the four-section ticket); this template confirms what changed and that it is
|
|
4
|
+
ready to merge. Keep each pull request focused on one change.
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
<!-- What this changes, in a sentence or two. -->
|
|
10
|
+
|
|
11
|
+
## Linked issue
|
|
12
|
+
|
|
13
|
+
<!-- e.g. Closes #12. If there is no issue, briefly state the motivation here. -->
|
|
14
|
+
|
|
15
|
+
Closes #
|
|
16
|
+
|
|
17
|
+
## Changes
|
|
18
|
+
|
|
19
|
+
<!-- The notable changes, as a short list. -->
|
|
20
|
+
|
|
21
|
+
-
|
|
22
|
+
|
|
23
|
+
## Checklist
|
|
24
|
+
|
|
25
|
+
- [ ] One focused change.
|
|
26
|
+
- [ ] Tests added or updated for the behavior.
|
|
27
|
+
- [ ] `uv run ruff format .` and `uv run ruff check .` pass.
|
|
28
|
+
- [ ] `uv run pytest -q` passes.
|
|
29
|
+
- [ ] Docs updated (README or docstrings) if behavior changed.
|
|
30
|
+
- [ ] Fits the project principles (retrieval-only, boring/composable,
|
|
31
|
+
framework-agnostic, read-fast).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.12", "3.13"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v5
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
run: uv python install ${{ matrix.python-version }}
|
|
20
|
+
- name: Create venv and install
|
|
21
|
+
run: |
|
|
22
|
+
uv venv --python ${{ matrix.python-version }}
|
|
23
|
+
uv pip install -e ".[dev]"
|
|
24
|
+
- name: Lint
|
|
25
|
+
run: uv run ruff check .
|
|
26
|
+
- name: Format check
|
|
27
|
+
run: uv run ruff format --check .
|
|
28
|
+
- name: Test
|
|
29
|
+
run: uv run pytest -q
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: pypi
|
|
11
|
+
permissions:
|
|
12
|
+
# Required for PyPI Trusted Publishing (OIDC).
|
|
13
|
+
id-token: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v5
|
|
18
|
+
- name: Build wheel and sdist
|
|
19
|
+
run: uv build
|
|
20
|
+
- name: Publish to PyPI
|
|
21
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.venv/
|
|
9
|
+
venv/
|
|
10
|
+
|
|
11
|
+
# Tooling caches
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
|
|
16
|
+
# DuckDB artifacts
|
|
17
|
+
*.duckdb
|
|
18
|
+
*.duckdb.wal
|
|
19
|
+
|
|
20
|
+
# Transient build output (ping-agentcore.out/, etc.) — the *.out convention
|
|
21
|
+
*.out/
|
|
22
|
+
# AgentCore CLI state, if ever written outside a build dir
|
|
23
|
+
.bedrock_agentcore/
|
|
24
|
+
.bedrock_agentcore.yaml
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# hadolint configuration for the example Dockerfiles.
|
|
2
|
+
# These are teaching examples where clarity is favored over production pinning.
|
|
3
|
+
ignored:
|
|
4
|
+
# DL3013: pin pip versions. The examples install `duckdb-vectors` by name to
|
|
5
|
+
# show the simplest form; the package is not yet on PyPI, so a pinned version
|
|
6
|
+
# here would be misleading. Pin in your own production image.
|
|
7
|
+
- DL3013
|
|
8
|
+
# DL3059: consecutive RUN instructions. The examples keep the install step and
|
|
9
|
+
# the index-build step as separate, readable RUN lines on purpose.
|
|
10
|
+
- DL3059
|
|
11
|
+
# DL3008: pin apt versions. The RAG example installs a build toolchain
|
|
12
|
+
# (build-essential, cmake) to compile llama-cpp-python; pinning apt versions
|
|
13
|
+
# in a throwaway test image is unnecessary ceremony.
|
|
14
|
+
- DL3008
|
|
15
|
+
# SC2086: word-splitting on the wheel glob. The examples install the single
|
|
16
|
+
# locally built wheel via `$(echo dist/*.whl)[extra]`; the glob is intentional
|
|
17
|
+
# and the paths have no spaces, so the word-splitting warning does not apply.
|
|
18
|
+
- SC2086
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"MD009": false,
|
|
3
|
+
"MD013": false,
|
|
4
|
+
"MD014": false,
|
|
5
|
+
"MD022": false,
|
|
6
|
+
"MD024": false,
|
|
7
|
+
"MD025": false,
|
|
8
|
+
"MD026": false,
|
|
9
|
+
"MD028": false,
|
|
10
|
+
"MD029": false,
|
|
11
|
+
"MD032": false,
|
|
12
|
+
"MD033": false,
|
|
13
|
+
"MD034": false,
|
|
14
|
+
"MD036": false,
|
|
15
|
+
"MD038": false,
|
|
16
|
+
"MD040": false,
|
|
17
|
+
"MD047": false,
|
|
18
|
+
"MD060": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Changes
|
|
2
|
+
|
|
3
|
+
## Pending
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
### Removed
|
|
12
|
+
|
|
13
|
+
## v261014
|
|
14
|
+
|
|
15
|
+
First public release of duckdb-vectors: an embeddable, S3-Vectors-flavored
|
|
16
|
+
semantic-search building block over a local DuckDB file, with hybrid vector
|
|
17
|
+
plus exact-token BM25 retrieval, pluggable embedding and chunking, a CLI, and
|
|
18
|
+
end-to-end container lifecycles. Versioning is now derived from git tags.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- VectorStore over a single DuckDB file: S3-flavored put/query plus
|
|
23
|
+
chunk-first add/query, per-chunk ETag, dual read-write/read-only lifecycle (#1)
|
|
24
|
+
- hybrid retrieval: brute-force cosine distance fused with exact-token BM25
|
|
25
|
+
via reciprocal rank fusion, hybrid by default (#1)
|
|
26
|
+
- pluggable embedders (local fastembed default, bedrock Titan, deterministic
|
|
27
|
+
hashing test fixture) and a swappable markdown chunker (#1)
|
|
28
|
+
- CLI to index a folder, report, and search (#1)
|
|
29
|
+
- metadata-aware search via injectable ranking SQL with built-in defaults (#2)
|
|
30
|
+
- comprehensive documentation set, contributor onboarding, and an indexed
|
|
31
|
+
developer workbook (#3, #4, #6)
|
|
32
|
+
- lean Makefile covering setup, lint, test, build, and ping targets (#5)
|
|
33
|
+
- end-to-end ping lifecycles for Docker, Lambda, and AgentCore driven from
|
|
34
|
+
make targets and shell snippets (#7)
|
|
35
|
+
- mypy type checking wired into the lint stage (#8)
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- derive the package version from git tags via hatch-vcs instead of a
|
|
40
|
+
hardcoded string
|
|
41
|
+
- build the BM25 index without stemming or stopwords for exact-token and
|
|
42
|
+
acronym matching
|
|
43
|
+
- lead the docs and examples with the local backend, reframing hashing as a
|
|
44
|
+
test-only fixture (#4)
|
|
45
|
+
- lint Markdown and Dockerfiles alongside Python; make hadolint setup
|
|
46
|
+
platform-neutral (#5)
|
|
47
|
+
- make setup non-interactive and venv-isolated (#5)
|
|
48
|
+
- assemble the AgentCore agent in a *.out build dir to keep the committed
|
|
49
|
+
example pristine (#7)
|
|
50
|
+
- polish PyPI packaging metadata (#1)
|
|
51
|
+
|
|
52
|
+
### Removed
|
|
53
|
+
|
|
54
|
+
- drop the hardcoded `__version__` constant from the package in favour of
|
|
55
|
+
tag-derived versioning
|
|
56
|
+
- drop the personal AWS profile name from the ping snippets (#7)
|
|
57
|
+
|
|
58
|
+
### Metrics
|
|
59
|
+
|
|
60
|
+
- tests: 39 passed, 1 skipped
|
|
61
|
+
- python: 2379 lines (34 files)
|
|
62
|
+
- markdown: 3940 lines (34 files)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributing to duckdb-vectors
|
|
2
|
+
|
|
3
|
+
Thanks for considering a contribution. `duckdb-vectors` grows through small,
|
|
4
|
+
focused improvements, and new contributors are genuinely welcome — whether you
|
|
5
|
+
fix a typo, add an embedding backend, or sharpen the docs.
|
|
6
|
+
|
|
7
|
+
This page helps you decide whether a change fits before you dive in. The full
|
|
8
|
+
developer reference — prerequisites, setup, the Makefile workflow, testing, and
|
|
9
|
+
the detailed conventions — lives in the
|
|
10
|
+
[developer workbook](documentation/developer-workbook.md).
|
|
11
|
+
|
|
12
|
+
## Does your change fit?
|
|
13
|
+
|
|
14
|
+
`duckdb-vectors` is intentionally small, and the best contributions keep it
|
|
15
|
+
that way: one clear thing, done well, with a test and a line of docs. A change
|
|
16
|
+
fits when it respects the project's shape:
|
|
17
|
+
|
|
18
|
+
- __Do one thing well.__ This is a retrieval building block — store, index,
|
|
19
|
+
search. Generation, prompting, and LLM orchestration belong in the harness,
|
|
20
|
+
not here.
|
|
21
|
+
- __Boring, composable technology.__ Prefer the standard library and DuckDB's
|
|
22
|
+
own features over new dependencies; heavy ones belong behind an optional
|
|
23
|
+
extra.
|
|
24
|
+
- __Framework-agnostic.__ No hard dependency on a specific agent framework.
|
|
25
|
+
- __Read-mostly and fast.__ The serving path opens read-only and answers in
|
|
26
|
+
tens of milliseconds.
|
|
27
|
+
|
|
28
|
+
## Good first contributions
|
|
29
|
+
|
|
30
|
+
You do not need to understand the whole codebase to help:
|
|
31
|
+
|
|
32
|
+
- __Add an embedding backend__ — the registry is the main extension point.
|
|
33
|
+
- __Add a chunker__ — for a document format not covered well yet.
|
|
34
|
+
- __Improve the docs__ — clarify a page or add a worked example.
|
|
35
|
+
- __Share a ranking recipe__ — a neat injectable `vector_sql` / `text_sql`.
|
|
36
|
+
- __Report a rough edge__ — a clear issue with a minimal reproduction.
|
|
37
|
+
|
|
38
|
+
The [developer workbook](documentation/developer-workbook.md) explains how to do
|
|
39
|
+
each of these, how to set up your environment (`make setup`), and how to run the
|
|
40
|
+
checks (`make lint`, `make test`) before you open a pull request. If you are
|
|
41
|
+
unsure where to start, open an issue describing what you want to do.
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
By contributing, you agree that your contributions are licensed under the
|
|
46
|
+
[MIT License](LICENSE) that covers this project.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bernard Paques
|
|
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.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
help:
|
|
2
|
+
@echo "Common commands:"
|
|
3
|
+
@echo "$$ make setup - Check prerequisites, create the venv, install tooling"
|
|
4
|
+
@echo "$$ make lint - Run Ruff, Markdown, and Dockerfile lint checks"
|
|
5
|
+
@echo "$$ make test - Run the pytest suite"
|
|
6
|
+
@echo "$$ make format - Format Python code with Ruff"
|
|
7
|
+
@echo "$$ make build - Build the wheel and sdist with uv"
|
|
8
|
+
@echo "$$ make clean - Remove build artifacts and caches"
|
|
9
|
+
@echo "$$ make ping-docker - End-to-end ping: offline RAG container"
|
|
10
|
+
@echo "$$ make ping-lambda - End-to-end ping: deploy and invoke on AWS Lambda"
|
|
11
|
+
@echo "$$ make ping-agentcore - End-to-end ping: deploy and invoke on Bedrock AgentCore"
|
|
12
|
+
@echo "$$ make push - Rebase onto main and push commits to git remote"
|
|
13
|
+
@echo " ... and you have access to git, uv, ruff and pytest directly as well."
|
|
14
|
+
|
|
15
|
+
# combine lines of each target
|
|
16
|
+
.ONESHELL:
|
|
17
|
+
# ensure child processes get variables set in this Makefile
|
|
18
|
+
.EXPORT_ALL_VARIABLES:
|
|
19
|
+
|
|
20
|
+
# default embedding backend for the CLI and examples
|
|
21
|
+
# "local" uses fastembed (minimum viable setup); "bedrock:titan" embeds in the
|
|
22
|
+
# cloud; "hashing" is a deterministic, dependency-free fixture for tests only
|
|
23
|
+
DUCKDB_VECTORS_BACKEND ?= local
|
|
24
|
+
# default DuckDB database path
|
|
25
|
+
DUCKDB_VECTORS_DB_PATH ?= vectors.duckdb
|
|
26
|
+
# default Python path for imports
|
|
27
|
+
PYTHONPATH ?= .
|
|
28
|
+
# source locations for static analysis
|
|
29
|
+
PYTHON_PATHS := src/ tests/ examples/
|
|
30
|
+
# markdown files for static analysis
|
|
31
|
+
MARKDOWN_FILES := README.md CONTRIBUTING.md $(shell find documentation -name '*.md')
|
|
32
|
+
# Dockerfiles for static analysis
|
|
33
|
+
DOCKERFILES := $(shell find . -name 'Dockerfile' -not -path './.venv/*')
|
|
34
|
+
|
|
35
|
+
setup: check-prerequisites setup-python setup-markdownlint setup-hadolint
|
|
36
|
+
|
|
37
|
+
check-prerequisites:
|
|
38
|
+
@echo "Checking prerequisites (see CONTRIBUTING.md)..."
|
|
39
|
+
@command -v python3 >/dev/null || { echo "ERROR: python3 not found — install Python 3.12+"; exit 1; }
|
|
40
|
+
@command -v uv >/dev/null || { echo "ERROR: uv not found — see https://docs.astral.sh/uv/"; exit 1; }
|
|
41
|
+
@command -v docker >/dev/null || echo "WARNING: docker not found — needed only for the example container agents"
|
|
42
|
+
@command -v npm >/dev/null || echo "WARNING: npm not found — needed for setup-markdownlint"
|
|
43
|
+
@command -v hadolint >/dev/null || echo "WARNING: hadolint not found — needed for lint-dockerfile; see https://github.com/hadolint/hadolint#install"
|
|
44
|
+
|
|
45
|
+
setup-python:
|
|
46
|
+
@echo "Creating virtual environment with uv..."
|
|
47
|
+
uv venv --clear
|
|
48
|
+
@echo "Installing the package with all extras..."
|
|
49
|
+
uv pip install --python .venv/bin/python -e ".[local,bedrock,cli,dev]"
|
|
50
|
+
|
|
51
|
+
setup-markdownlint:
|
|
52
|
+
@command -v markdownlint >/dev/null && markdownlint --version || { \
|
|
53
|
+
echo "Installing markdownlint-cli via npm..."; \
|
|
54
|
+
npm install markdownlint-cli -g || { \
|
|
55
|
+
echo "npm global install failed (often a permissions issue)."; \
|
|
56
|
+
echo "Install markdownlint-cli yourself, e.g. 'npm install -g"; \
|
|
57
|
+
echo "markdownlint-cli' with a user-writable npm prefix. Needed"; \
|
|
58
|
+
echo "only for 'make lint-markdown'."; \
|
|
59
|
+
}; \
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setup-hadolint:
|
|
63
|
+
@command -v hadolint >/dev/null && hadolint --version || { \
|
|
64
|
+
echo "hadolint not found. It has no pip/npm package; install it for"; \
|
|
65
|
+
echo "your platform from https://github.com/hadolint/hadolint#install"; \
|
|
66
|
+
echo "(binary release, Docker image 'hadolint/hadolint', or a native"; \
|
|
67
|
+
echo "package). Needed only for 'make lint-dockerfile'."; \
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
lint: lint-python lint-markdown lint-dockerfile
|
|
71
|
+
|
|
72
|
+
lint-python:
|
|
73
|
+
@echo "Running Ruff linter..."
|
|
74
|
+
.venv/bin/ruff check ${PYTHON_PATHS}
|
|
75
|
+
@echo "Running Ruff format check..."
|
|
76
|
+
.venv/bin/ruff format --check ${PYTHON_PATHS}
|
|
77
|
+
@echo "Running mypy type check..."
|
|
78
|
+
.venv/bin/mypy
|
|
79
|
+
|
|
80
|
+
lint-markdown:
|
|
81
|
+
@echo "Validating Markdown files..."
|
|
82
|
+
markdownlint ${MARKDOWN_FILES}
|
|
83
|
+
|
|
84
|
+
lint-dockerfile:
|
|
85
|
+
@echo "Validating Dockerfiles..."
|
|
86
|
+
hadolint ${DOCKERFILES}
|
|
87
|
+
|
|
88
|
+
format:
|
|
89
|
+
@echo "Formatting Python code with Ruff..."
|
|
90
|
+
.venv/bin/ruff format ${PYTHON_PATHS}
|
|
91
|
+
|
|
92
|
+
test:
|
|
93
|
+
@echo "Running tests..."
|
|
94
|
+
.venv/bin/pytest -q
|
|
95
|
+
|
|
96
|
+
build:
|
|
97
|
+
@echo "Building wheel and sdist..."
|
|
98
|
+
uv build
|
|
99
|
+
|
|
100
|
+
clean:
|
|
101
|
+
@echo "Removing build artifacts and caches..."
|
|
102
|
+
rm -rf dist build *.egg-info src/*.egg-info *.out
|
|
103
|
+
rm -rf .ruff_cache .pytest_cache
|
|
104
|
+
find . -type d -name __pycache__ -prune -exec rm -rf {} +
|
|
105
|
+
|
|
106
|
+
# End-to-end ping tests. Each runs a shell snippet from fixtures/shell/ that
|
|
107
|
+
# builds a search agent from documentation/, runs the fixed query, and pipes
|
|
108
|
+
# the result to the shared Python validator. The AWS pings create real,
|
|
109
|
+
# billable resources and leave them running; use AWS_PROFILE to select the
|
|
110
|
+
# account. The venv is put on PATH so the snippets' `python` is the project's.
|
|
111
|
+
PING_ENV := PATH="$(PWD)/.venv/bin:$$PATH"
|
|
112
|
+
|
|
113
|
+
ping-docker:
|
|
114
|
+
$(PING_ENV) bash fixtures/shell/ping-docker.sh
|
|
115
|
+
|
|
116
|
+
ping-lambda:
|
|
117
|
+
$(PING_ENV) bash fixtures/shell/ping-lambda.sh
|
|
118
|
+
|
|
119
|
+
ping-agentcore:
|
|
120
|
+
$(PING_ENV) bash fixtures/shell/ping-agentcore.sh
|
|
121
|
+
|
|
122
|
+
rebase:
|
|
123
|
+
git pull --rebase origin main
|
|
124
|
+
|
|
125
|
+
push: rebase
|
|
126
|
+
git push
|