langchain-serenedb 26.9.3__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 (35) hide show
  1. langchain_serenedb-26.9.3/.github/ISSUE_TEMPLATE/bug_report.yml +62 -0
  2. langchain_serenedb-26.9.3/.github/ISSUE_TEMPLATE/feature_request.yml +18 -0
  3. langchain_serenedb-26.9.3/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  4. langchain_serenedb-26.9.3/.github/dependabot.yml +17 -0
  5. langchain_serenedb-26.9.3/.github/workflows/pr-build-trigger.yml +172 -0
  6. langchain_serenedb-26.9.3/.github/workflows/pre-commit.yml +31 -0
  7. langchain_serenedb-26.9.3/.github/workflows/prepare-release.yml +202 -0
  8. langchain_serenedb-26.9.3/.github/workflows/protect-workflows.yml +48 -0
  9. langchain_serenedb-26.9.3/.github/workflows/publish-test-release.yml +126 -0
  10. langchain_serenedb-26.9.3/.github/workflows/publish.yml +53 -0
  11. langchain_serenedb-26.9.3/.github/workflows/tests.yml +63 -0
  12. langchain_serenedb-26.9.3/.gitignore +12 -0
  13. langchain_serenedb-26.9.3/.pre-commit-config.yaml +50 -0
  14. langchain_serenedb-26.9.3/CONTRIBUTING.md +97 -0
  15. langchain_serenedb-26.9.3/LICENSE +21 -0
  16. langchain_serenedb-26.9.3/PKG-INFO +93 -0
  17. langchain_serenedb-26.9.3/README.md +58 -0
  18. langchain_serenedb-26.9.3/langchain_serenedb/__init__.py +49 -0
  19. langchain_serenedb-26.9.3/langchain_serenedb/async_vectorstore.py +1499 -0
  20. langchain_serenedb-26.9.3/langchain_serenedb/engine.py +536 -0
  21. langchain_serenedb-26.9.3/langchain_serenedb/hybrid_search_config.py +100 -0
  22. langchain_serenedb-26.9.3/langchain_serenedb/indexes.py +442 -0
  23. langchain_serenedb-26.9.3/langchain_serenedb/py.typed +0 -0
  24. langchain_serenedb-26.9.3/langchain_serenedb/vectorstores.py +249 -0
  25. langchain_serenedb-26.9.3/pyproject.toml +85 -0
  26. langchain_serenedb-26.9.3/tests/__init__.py +0 -0
  27. langchain_serenedb-26.9.3/tests/docker-compose.yml +62 -0
  28. langchain_serenedb-26.9.3/tests/integration_tests/__init__.py +0 -0
  29. langchain_serenedb-26.9.3/tests/integration_tests/test_standard_suite.py +70 -0
  30. langchain_serenedb-26.9.3/tests/integration_tests/test_vectorstore.py +1537 -0
  31. langchain_serenedb-26.9.3/tests/requirements.txt +24 -0
  32. langchain_serenedb-26.9.3/tests/run.sh +161 -0
  33. langchain_serenedb-26.9.3/tests/run_tests_docker.sh +131 -0
  34. langchain_serenedb-26.9.3/tests/run_tests_local.sh +181 -0
  35. langchain_serenedb-26.9.3/uv.lock +2167 -0
@@ -0,0 +1,62 @@
1
+ name: Bug Report
2
+ description: Report something that isn't working correctly
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: What happened?
9
+ description: A clear description of the bug.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: reproduce
14
+ attributes:
15
+ label: How to reproduce
16
+ description: A minimal Python example (or steps) that reproduces the problem.
17
+ render: python
18
+ placeholder: |
19
+ from langchain_serenedb import SereneDBEngine, SereneDBVectorStore
20
+
21
+ engine = SereneDBEngine.from_connection_string(
22
+ "host=127.0.0.1 port=7890 user=postgres dbname=postgres"
23
+ )
24
+ # ...
25
+ # Observe: ...
26
+ validations:
27
+ required: true
28
+ - type: textarea
29
+ id: expected
30
+ attributes:
31
+ label: Expected behavior
32
+ description: What did you expect to happen?
33
+ validations:
34
+ required: false
35
+ - type: input
36
+ id: package-version
37
+ attributes:
38
+ label: langchain-serenedb version
39
+ placeholder: "e.g. 0.1.0 or commit hash"
40
+ validations:
41
+ required: false
42
+ - type: input
43
+ id: serenedb-version
44
+ attributes:
45
+ label: SereneDB version
46
+ placeholder: "e.g. 26.07.3 or commit hash"
47
+ validations:
48
+ required: false
49
+ - type: input
50
+ id: python-version
51
+ attributes:
52
+ label: Python version
53
+ placeholder: "e.g. 3.12"
54
+ validations:
55
+ required: false
56
+ - type: textarea
57
+ id: extra
58
+ attributes:
59
+ label: Additional context
60
+ description: Logs, tracebacks, OS/platform info, or anything else relevant.
61
+ validations:
62
+ required: false
@@ -0,0 +1,18 @@
1
+ name: Feature Request
2
+ description: Suggest an idea or improvement
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: What would you like?
9
+ description: Describe the feature or improvement.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: motivation
14
+ attributes:
15
+ label: Why?
16
+ description: What problem does this solve or what use case does it enable?
17
+ validations:
18
+ required: false
@@ -0,0 +1,11 @@
1
+ <!--
2
+ PR title will become the squash commit message.
3
+ Use conventional commits: feat:, fix:, refactor:, test:, docs:, chore:
4
+
5
+ This description becomes the commit body -- explain *why*, not *what*.
6
+
7
+ Before merging, please make sure:
8
+ - `pre-commit run --all-files` passes (ruff + mypy)
9
+ - the integration suite passes against a SereneDB instance
10
+ (`tests/run_tests_docker.sh`, or `tests/run_tests_local.sh <serened-binary>`)
11
+ -->
@@ -0,0 +1,17 @@
1
+ version: 2
2
+ updates:
3
+ # Python dependencies declared in pyproject.toml (project + optional "test" extra).
4
+ # Note: Dependabot updates the version constraints here; uv.lock must be refreshed
5
+ # separately (`uv lock`) since it does not yet maintain uv lockfiles.
6
+ - package-ecosystem: "pip"
7
+ directory: "/"
8
+ schedule:
9
+ interval: "weekly"
10
+ open-pull-requests-limit: 5
11
+
12
+ # The actions pinned in .github/workflows (checkout, setup-python, setup-uv, ...).
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
17
+ open-pull-requests-limit: 5
@@ -0,0 +1,172 @@
1
+ name: auto | pr trigger
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, labeled]
6
+ issue_comment:
7
+ types: [edited]
8
+
9
+ concurrency:
10
+ group: pr-build-trigger-${{ github.event.issue.number || github.event.pull_request.number }}
11
+ cancel-in-progress: false
12
+
13
+ jobs:
14
+ handle:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ actions: write
18
+ contents: read
19
+ pull-requests: write
20
+ statuses: write
21
+ steps:
22
+ - name: Post CI trigger comment
23
+ if: >-
24
+ github.event_name == 'pull_request_target' && (
25
+ github.event.action == 'opened' ||
26
+ (github.event.action == 'labeled' && github.event.label.name == 'spawn-build-bot')
27
+ )
28
+ uses: actions/github-script@v8
29
+ with:
30
+ script: |
31
+ const body = [
32
+ '<!-- langchain-serenedb-ci-trigger -->',
33
+ '### CI Triggers',
34
+ '_Check **Trigger Jobs** to run the integration suite against this PR._',
35
+ '',
36
+ '- [ ] **Trigger Jobs**',
37
+ ].join('\n');
38
+
39
+ await github.rest.issues.createComment({
40
+ owner: context.repo.owner,
41
+ repo: context.repo.repo,
42
+ issue_number: context.payload.pull_request.number,
43
+ body,
44
+ });
45
+
46
+ // The label is a one-shot "re-post the comment" signal; remove it after use.
47
+ if (context.payload.action === 'labeled') {
48
+ await github.rest.issues.removeLabel({
49
+ owner: context.repo.owner,
50
+ repo: context.repo.repo,
51
+ issue_number: context.payload.pull_request.number,
52
+ name: 'spawn-build-bot',
53
+ }).catch(() => {});
54
+ }
55
+
56
+ - name: Get PR info
57
+ id: pr-info
58
+ if: >-
59
+ github.event_name == 'issue_comment' &&
60
+ github.event.issue.pull_request &&
61
+ github.event.comment.user.login == 'github-actions[bot]' &&
62
+ contains(github.event.comment.body, '<!-- langchain-serenedb-ci-trigger -->') &&
63
+ contains(github.event.comment.body, '- [x] **Trigger Jobs**')
64
+ uses: actions/github-script@v8
65
+ with:
66
+ script: |
67
+ const { data: pr } = await github.rest.pulls.get({
68
+ owner: context.repo.owner,
69
+ repo: context.repo.repo,
70
+ pull_number: context.payload.issue.number,
71
+ });
72
+ core.setOutput('branch', pr.head.ref);
73
+ core.setOutput('sha', pr.head.sha);
74
+ core.setOutput('base_ref', pr.base.ref);
75
+ core.setOutput('is_fork', (pr.head.repo.full_name !== pr.base.repo.full_name).toString());
76
+
77
+ - name: Trigger integration tests
78
+ if: steps.pr-info.conclusion == 'success'
79
+ env:
80
+ PR_BRANCH: ${{ steps.pr-info.outputs.branch }}
81
+ PR_SHA: ${{ steps.pr-info.outputs.sha }}
82
+ BASE_REF: ${{ steps.pr-info.outputs.base_ref }}
83
+ IS_FORK: ${{ steps.pr-info.outputs.is_fork }}
84
+ uses: actions/github-script@v8
85
+ with:
86
+ script: |
87
+ const comment = context.payload.comment;
88
+ const body = comment.body || '';
89
+ const branch = process.env.PR_BRANCH;
90
+ const sha = process.env.PR_SHA;
91
+ const baseRef = process.env.BASE_REF;
92
+ const isFork = process.env.IS_FORK === 'true';
93
+ // A fork branch does not exist in this repo, so a fork PR must dispatch on the
94
+ // base ref; tests.yml still checks out the PR head SHA passed below.
95
+ const dispatchRef = isFork ? baseRef : branch;
96
+
97
+ const { owner, repo } = context.repo;
98
+ const workflowId = 'tests.yml';
99
+ const statusContext = 'langchain-serenedb | integration tests';
100
+
101
+ await github.rest.repos.createCommitStatus({
102
+ owner, repo, sha, state: 'pending',
103
+ description: 'Integration tests queued',
104
+ context: statusContext,
105
+ });
106
+
107
+ // Snapshot the latest run id before dispatch so we can find the new one.
108
+ const { data: before } = await github.rest.actions.listWorkflowRuns({
109
+ owner, repo, workflow_id: workflowId, branch: dispatchRef, per_page: 1,
110
+ });
111
+ const prevId = before.workflow_runs[0]?.id || 0;
112
+
113
+ await github.rest.actions.createWorkflowDispatch({
114
+ owner, repo,
115
+ workflow_id: workflowId,
116
+ ref: dispatchRef,
117
+ inputs: {
118
+ serenedb_image: 'serenedb/serenedb:latest',
119
+ PR_SHA: sha,
120
+ PR_NUMBER: String(context.payload.issue.number),
121
+ },
122
+ });
123
+
124
+ // Wait for the new run to appear (up to 30s) so we can link it.
125
+ let runUrl = `${context.serverUrl}/${owner}/${repo}/actions/workflows/${workflowId}`;
126
+ for (let i = 0; i < 6; i++) {
127
+ await new Promise(r => setTimeout(r, 5000));
128
+ const { data: after } = await github.rest.actions.listWorkflowRuns({
129
+ owner, repo, workflow_id: workflowId, branch: dispatchRef, per_page: 5,
130
+ });
131
+ const run = after.workflow_runs.find(r => r.id > prevId);
132
+ if (run) { runUrl = run.html_url; break; }
133
+ }
134
+
135
+ await github.rest.repos.createCommitStatus({
136
+ owner, repo, sha, state: 'pending',
137
+ description: 'Integration tests running',
138
+ context: statusContext,
139
+ target_url: runUrl,
140
+ });
141
+
142
+ // Uncheck "Trigger Jobs" and record the run in a hidden history blob so the
143
+ // comment shows the latest run plus a collapsible list of previous ones.
144
+ const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 19) + ' UTC';
145
+ let updatedBody = body.replace('- [x] **Trigger Jobs**', '- [ ] **Trigger Jobs**');
146
+
147
+ const dataRe = /<!-- ci-data:(.*?) -->/;
148
+ const dataMatch = updatedBody.match(dataRe);
149
+ const history = dataMatch ? JSON.parse(dataMatch[1]) : [];
150
+ history.push({ url: runUrl, time: timestamp });
151
+
152
+ const latest = history[history.length - 1];
153
+ let resultsBlock = `\n\n**Latest:** [View Run](${latest.url}) · ${latest.time}`;
154
+ if (history.length > 1) {
155
+ const oldRuns = history.slice(0, -1).reverse().map(r => `| [View Run](${r.url}) | ${r.time} |`);
156
+ resultsBlock += [
157
+ '', '',
158
+ '<details><summary>Previous runs</summary>',
159
+ '', '| Link | Time |', '|------|------|',
160
+ ...oldRuns, '', '</details>',
161
+ ].join('\n');
162
+ }
163
+
164
+ const sectionRe = /\n\n<!-- ci-data:.*? -->[\s\S]*$/;
165
+ const newData = `\n\n<!-- ci-data:${JSON.stringify(history)} -->${resultsBlock}`;
166
+ updatedBody = sectionRe.test(updatedBody)
167
+ ? updatedBody.replace(sectionRe, newData)
168
+ : updatedBody + newData;
169
+
170
+ await github.rest.issues.updateComment({
171
+ owner, repo, comment_id: comment.id, body: updatedBody,
172
+ });
@@ -0,0 +1,31 @@
1
+ name: auto | pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ # Supersede an in-flight run when the same ref gets new commits, so rapid pushes to a PR
9
+ # don't stack up concurrent runs on stale commits.
10
+ concurrency:
11
+ group: pre-commit-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ pre-commit:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ with:
20
+ fetch-depth: 1
21
+ submodules: false
22
+ clean: false
23
+ - uses: actions/setup-python@v6
24
+ # The mypy hook is a *local* hook that runs `uv run --extra test mypy` so it can
25
+ # resolve the project's own dependencies (see .pre-commit-config.yaml). That needs
26
+ # uv on PATH -- the hosted runner has none, so install it before pre-commit runs.
27
+ - uses: astral-sh/setup-uv@v6
28
+ with:
29
+ enable-cache: true
30
+ # No floating v3 tag -- only specific versions published.
31
+ - uses: pre-commit/action@v3.0.1
@@ -0,0 +1,202 @@
1
+ name: manual | prepare release
2
+
3
+ run-name: "prepare release ${{ inputs.version != '' && inputs.version || '(auto)' }}"
4
+
5
+ # Step 1 of 2 of the release process (manual, no push trigger). Resolves a version,
6
+ # builds the wheel + sdist with it injected, tests the built WHEEL, and creates a DRAFT
7
+ # GitHub Release with the artifacts attached. It does NOT create the git tag and does NOT
8
+ # touch PyPI.
9
+ #
10
+ # A maintainer then reviews the draft and publishes it -- publishing creates the git tag
11
+ # and fires publish.yml (step 2), which uploads these exact, already-tested artifacts to
12
+ # PyPI. Because nothing irreversible happens here, a failed run costs nothing: fix the
13
+ # code and re-run (no tag was created, and the leftover draft is replaced).
14
+
15
+ on:
16
+ workflow_dispatch:
17
+ inputs:
18
+ version:
19
+ description: "Release version, e.g. 0.1.0 (leave empty to auto-increment the patch)"
20
+ type: string
21
+ default: ""
22
+ serenedb_image:
23
+ description: "SereneDB image to test the wheel against"
24
+ type: string
25
+ default: "serenedb/serenedb:latest"
26
+
27
+ concurrency:
28
+ group: prepare-release
29
+ cancel-in-progress: false
30
+
31
+ env:
32
+ SERENEDB_IMAGE: ${{ inputs.serenedb_image || 'serenedb/serenedb:latest' }}
33
+
34
+ jobs:
35
+ resolve-version:
36
+ runs-on: ubuntu-latest
37
+ outputs:
38
+ version: ${{ steps.v.outputs.version }}
39
+ steps:
40
+ - name: Resolve release version
41
+ id: v
42
+ env:
43
+ GH_TOKEN: ${{ github.token }}
44
+ GH_REPO: ${{ github.repository }}
45
+ INPUT_VERSION: ${{ inputs.version }}
46
+ run: |
47
+ set -euo pipefail
48
+ if [[ -n "$INPUT_VERSION" ]]; then
49
+ VERSION="${INPUT_VERSION#v}"
50
+ if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
51
+ echo "::error::'$INPUT_VERSION' is not a valid version (expected e.g. 0.1.0)"; exit 1
52
+ fi
53
+ else
54
+ # Auto-increment the patch of the highest vX.Y.Z release (draft or published).
55
+ LATEST=$(gh release list --limit 100 --json tagName \
56
+ --jq '[.[].tagName | ltrimstr("v") | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))]
57
+ | sort_by(split(".") | map(tonumber)) | last // empty')
58
+ if [[ -z "$LATEST" ]]; then
59
+ VERSION="0.1.0"
60
+ else
61
+ IFS=. read -r MAJ MIN PAT <<<"$LATEST"
62
+ VERSION="${MAJ}.${MIN}.$((PAT + 1))"
63
+ fi
64
+ fi
65
+ # Fail fast if this version is already PUBLISHED (a leftover draft is fine --
66
+ # the release job replaces it). Prevents a wasted build + test.
67
+ STATE=$(gh release view "v${VERSION}" --json isDraft --jq '.isDraft' 2>/dev/null || echo missing)
68
+ if [[ "$STATE" == "false" ]]; then
69
+ echo "::error::Release v${VERSION} is already published; bump the version."; exit 1
70
+ fi
71
+ echo "Resolved version: ${VERSION} (existing release: ${STATE})"
72
+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
73
+
74
+ build:
75
+ needs: resolve-version
76
+ runs-on: ubuntu-latest
77
+ env:
78
+ # No tag exists yet (it is created only when the draft release is published), so
79
+ # inject the resolved version rather than deriving it from git.
80
+ SETUPTOOLS_SCM_PRETEND_VERSION: ${{ needs.resolve-version.outputs.version }}
81
+ steps:
82
+ - uses: actions/checkout@v7
83
+ with:
84
+ fetch-depth: 1
85
+ - uses: astral-sh/setup-uv@v6
86
+ with:
87
+ enable-cache: true
88
+ - name: Build wheel + sdist
89
+ run: uv build
90
+ - name: Verify built version
91
+ env:
92
+ EXPECTED: ${{ needs.resolve-version.outputs.version }}
93
+ run: |
94
+ VERSION="$(ls dist/*.whl | sed -E 's|.*/langchain_serenedb-(.+)-py3-none-any\.whl|\1|')"
95
+ echo "Built version: $VERSION (expected $EXPECTED)"
96
+ if [[ "$VERSION" != "$EXPECTED" ]]; then
97
+ echo "::error::Built version '$VERSION' != resolved '$EXPECTED'"; exit 1
98
+ fi
99
+ - name: Validate package metadata
100
+ run: uvx twine check dist/*
101
+ - uses: actions/upload-artifact@v7
102
+ with:
103
+ name: dist
104
+ path: dist/
105
+ if-no-files-found: error
106
+
107
+ test-wheel:
108
+ needs: build
109
+ runs-on: ubuntu-latest
110
+ steps:
111
+ - uses: actions/checkout@v7
112
+ with:
113
+ fetch-depth: 1
114
+ - uses: actions/download-artifact@v7
115
+ with:
116
+ name: dist
117
+ path: dist/
118
+ - uses: astral-sh/setup-uv@v6
119
+ with:
120
+ enable-cache: true
121
+ - name: Start SereneDB
122
+ run: |
123
+ docker run -d --name serened -p 7890:7890 \
124
+ -e POSTGRES_PASSWORD=postgres "$SERENEDB_IMAGE"
125
+ - name: Install the built wheel into a fresh venv
126
+ run: |
127
+ uv venv
128
+ # Test the artifact, not the source tree: remove the package dir so imports
129
+ # resolve to the installed wheel, then install the wheel + the test deps.
130
+ # (uv does not pull a wheel's [test] extra from a file path, so list them.)
131
+ rm -rf langchain_serenedb
132
+ WHEEL="$(ls dist/*.whl)"
133
+ uv pip install --python .venv/bin/python "$WHEEL" \
134
+ pytest pytest-asyncio pytest-timeout pytest-mock langchain-tests
135
+ - name: Run integration suite against the wheel
136
+ env:
137
+ PYTHON: ${{ github.workspace }}/.venv/bin/python
138
+ SERENEDB_HOST: "127.0.0.1"
139
+ SERENEDB_PORT: "7890"
140
+ SERENEDB_PASSWORD: postgres
141
+ SERENEDB_WAIT_TIMEOUT: "90"
142
+ run: tests/run.sh -- tests/integration_tests -q
143
+ - name: SereneDB logs (on failure)
144
+ if: failure()
145
+ run: docker logs serened || true
146
+
147
+ draft-release:
148
+ needs: [resolve-version, test-wheel]
149
+ runs-on: ubuntu-latest
150
+ permissions:
151
+ contents: write # create the draft release and upload the built artifacts
152
+ env:
153
+ GH_TOKEN: ${{ github.token }}
154
+ GH_REPO: ${{ github.repository }}
155
+ VERSION: ${{ needs.resolve-version.outputs.version }}
156
+ steps:
157
+ - uses: actions/download-artifact@v7
158
+ with:
159
+ name: dist
160
+ path: dist/
161
+ - name: Create draft GitHub Release
162
+ run: |
163
+ set -euo pipefail
164
+ TAG="v${VERSION}"
165
+ # Replace a leftover draft from an earlier failed run; refuse a published one.
166
+ STATE=$(gh release view "$TAG" --json isDraft --jq '.isDraft' 2>/dev/null || echo missing)
167
+ if [[ "$STATE" == "true" ]]; then
168
+ echo "Replacing existing draft $TAG"
169
+ gh release delete "$TAG" --yes
170
+ gh api -X DELETE "repos/${GH_REPO}/git/refs/tags/${TAG}" 2>/dev/null || true
171
+ elif [[ "$STATE" == "false" ]]; then
172
+ echo "::error::Release $TAG already published; refusing to overwrite"; exit 1
173
+ fi
174
+ # Gather release notes: GitHub's auto-generated "What's Changed" (merged PRs
175
+ # since the last release) computed up to this commit, with a pip-install header
176
+ # prepended -- the langchain-serenedb analog of the reference's install-body.
177
+ GENERATED=$(gh api -X POST "repos/${GH_REPO}/releases/generate-notes" \
178
+ -f tag_name="$TAG" -f target_commitish="${{ github.sha }}" --jq '.body' 2>/dev/null || true)
179
+ {
180
+ echo "## langchain-serenedb ${VERSION}"
181
+ echo
182
+ echo '```bash'
183
+ echo "pip install langchain-serenedb==${VERSION}"
184
+ echo '```'
185
+ echo
186
+ echo "- [PyPI](https://pypi.org/project/langchain-serenedb/${VERSION}/)"
187
+ echo "- [Documentation](https://docs.serenedb.com)"
188
+ if [[ -n "${GENERATED:-}" ]]; then
189
+ echo
190
+ echo "${GENERATED}"
191
+ fi
192
+ } > release-notes.md
193
+
194
+ # A DRAFT release does not create the git tag yet -- the tag $TAG is created only
195
+ # when a human publishes this draft (which then fires publish.yml). --target pins
196
+ # the eventual tag to this commit.
197
+ gh release create "$TAG" dist/* \
198
+ --draft \
199
+ --target "${{ github.sha }}" \
200
+ --title "$TAG" \
201
+ --notes-file release-notes.md
202
+ echo "Draft $TAG created. Review its notes, then publish it to release to PyPI."
@@ -0,0 +1,48 @@
1
+ name: auto | pr security
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, synchronize]
6
+
7
+ permissions:
8
+ pull-requests: write
9
+
10
+ jobs:
11
+ check:
12
+ if: github.event.pull_request.head.repo.full_name != github.repository
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Label fork PR
16
+ if: github.event.action == 'opened'
17
+ uses: actions/github-script@v8
18
+ with:
19
+ script: |
20
+ await github.rest.issues.addLabels({
21
+ issue_number: context.issue.number,
22
+ owner: context.repo.owner,
23
+ repo: context.repo.repo,
24
+ labels: ['from-fork', 'needs-security-review']
25
+ });
26
+ await github.rest.issues.createComment({
27
+ issue_number: context.issue.number,
28
+ owner: context.repo.owner,
29
+ repo: context.repo.repo,
30
+ body: `👋 Thank you for your contribution!\n\nThis PR is from a fork and requires maintainer approval before CI workflows will run.\n\nA maintainer will review your changes and approve the workflow run if everything looks good.\n\n**Please do not modify any files in \`.github/workflows/\` as those changes will not be accepted from forks.**`
31
+ });
32
+
33
+ - name: Block workflow file changes
34
+ uses: actions/github-script@v8
35
+ with:
36
+ script: |
37
+ const { data: files } = await github.rest.pulls.listFiles({
38
+ owner: context.repo.owner,
39
+ repo: context.repo.repo,
40
+ pull_number: context.issue.number,
41
+ per_page: 100,
42
+ });
43
+ const workflowFiles = files.filter(f =>
44
+ f.filename.startsWith('.github/workflows/') || f.filename.startsWith('.github/actions/')
45
+ );
46
+ if (workflowFiles.length > 0) {
47
+ core.setFailed(`Workflow file changes from forks are not allowed: ${workflowFiles.map(f => f.filename).join(', ')}`);
48
+ }