Skip to content

Commit 87bf611

Browse files
committed
Import existing codebase.
1 parent 278d74e commit 87bf611

File tree

120 files changed

+40370
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+40370
-0
lines changed

.env.lib_debug

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export RUST_LOG=warn,cocoindex_engine=trace,tower_http=trace
2+
export RUST_BACKTRACE=1
3+
4+
export COCOINDEX_SERVER_CORS_ORIGIN=http://localhost:3000

.github/scripts/update_version.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash -e
2+
3+
# Extract version from tag (e.g. refs/tags/v1.2.3 -> 1.2.3)
4+
if [[ ! "$GITHUB_REF" =~ ^refs/tags/v ]]; then
5+
echo "No version tag found"
6+
exit 0
7+
fi
8+
VERSION="${GITHUB_REF#refs/tags/v}"
9+
10+
echo "Building release version: $VERSION"
11+
12+
# Detect OS and set sed inline flag accordingly.
13+
if [[ "$(uname)" == "Darwin" ]]; then
14+
# macOS/BSD sed requires an empty string as backup extension
15+
SED_INLINE=(-i '')
16+
else
17+
# GNU sed on Linux can use -i without a backup extension
18+
SED_INLINE=(-i)
19+
fi
20+
21+
# Update Cargo.toml
22+
sed "${SED_INLINE[@]}" "s/^version = .*/version = \"$VERSION\"/" Cargo.toml

.github/workflows/CI.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file is autogenerated by maturin v1.8.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: CI
7+
8+
on:
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- src/**
13+
- python/**
14+
- "*.toml"
15+
push:
16+
branches: [main]
17+
paths:
18+
- src/**
19+
- python/**
20+
- "*.toml"
21+
workflow_dispatch:
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
build:
28+
runs-on: ${{ matrix.platform.runner }}
29+
strategy:
30+
matrix:
31+
platform:
32+
- { os: linux, runner: ubuntu-22.04, target: aarch64 }
33+
- { os: macos, runner: macos-14, target: aarch64 }
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
37+
with:
38+
python-version: 3.x
39+
- name: Build wheels
40+
uses: PyO3/maturin-action@v1
41+
with:
42+
target: ${{ matrix.platform.target }}
43+
args: --release --out dist --find-interpreter
44+
sccache: 'true'
45+
manylinux: auto

.github/workflows/docs.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: docs
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- docs/**
8+
push:
9+
branches: [main]
10+
paths:
11+
- docs/**
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
test-deploy:
19+
if: github.event_name != 'push'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
sparse-checkout: docs
26+
path: src-staging
27+
- name: Move docs
28+
run: |
29+
shopt -s dotglob
30+
mv src-staging/docs/* .
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 18
34+
cache: yarn
35+
- name: Install dependencies
36+
run: yarn install --frozen-lockfile
37+
- name: Test build website
38+
run: yarn build
39+
40+
deploy:
41+
if: github.event_name != 'pull_request'
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
sparse-checkout: docs
48+
path: src-staging
49+
- name: Move docs
50+
run: |
51+
shopt -s dotglob
52+
mv src-staging/docs/* .
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: 18
56+
cache: yarn
57+
- uses: webfactory/ssh-agent@v0.5.0
58+
with:
59+
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
60+
- name: Deploy to GitHub Pages
61+
env:
62+
USE_SSH: true
63+
run: |
64+
git config --global user.email "cocoindex.io@gmail.com"
65+
git config --global user.name "CocoIndex"
66+
yarn install --frozen-lockfile
67+
yarn deploy

.github/workflows/release.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# This file is autogenerated by maturin v1.8.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: release
7+
8+
on:
9+
push:
10+
tags:
11+
- 'v*'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
create-versioned-toml:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- run: ./.github/scripts/update_version.sh
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: Cargo.toml
26+
path: Cargo.toml
27+
28+
build:
29+
runs-on: ${{ matrix.platform.runner }}
30+
needs: [create-versioned-toml]
31+
strategy:
32+
matrix:
33+
platform:
34+
- { os: linux, runner: ubuntu-22.04, target: x86_64 }
35+
- { os: linux, runner: ubuntu-22.04, target: aarch64 }
36+
- { os: linux, runner: ubuntu-22.04, target: armv7 }
37+
- { os: musllinux, runner: ubuntu-22.04, target: x86_64 }
38+
- { os: musllinux, runner: ubuntu-22.04, target: aarch64 }
39+
- { os: musllinux, runner: ubuntu-22.04, target: armv7 }
40+
- { os: windows, runner: windows-latest, target: x64 }
41+
- { os: macos, runner: macos-13, target: x86_64 }
42+
- { os: macos, runner: macos-14, target: aarch64 }
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: actions/download-artifact@v4
46+
with:
47+
name: Cargo.toml
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: 3.x
51+
- name: Build wheels
52+
uses: PyO3/maturin-action@v1
53+
with:
54+
target: ${{ matrix.platform.target }}
55+
args: --release --out dist --find-interpreter
56+
sccache: 'true'
57+
manylinux: auto
58+
- name: Upload wheels
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: wheels-${{ matrix.platform.os }}-${{ matrix.platform.target }}
62+
path: dist
63+
64+
sdist:
65+
runs-on: ubuntu-latest
66+
needs: [create-versioned-toml]
67+
steps:
68+
- uses: actions/checkout@v4
69+
- uses: actions/download-artifact@v4
70+
with:
71+
name: Cargo.toml
72+
- name: Build sdist
73+
uses: PyO3/maturin-action@v1
74+
with:
75+
command: sdist
76+
args: --out dist
77+
- name: Upload sdist
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: wheels-sdist
81+
path: dist
82+
83+
release:
84+
name: Release
85+
runs-on: ubuntu-latest
86+
needs: [create-versioned-toml, build, sdist]
87+
permissions:
88+
# Use to sign the release artifacts
89+
id-token: write
90+
# Used to upload release artifacts
91+
contents: write
92+
# Used to generate artifact attestation
93+
attestations: write
94+
environment: release
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: actions/download-artifact@v4
98+
with:
99+
name: Cargo.toml
100+
- uses: actions/download-artifact@v4
101+
with:
102+
pattern: wheels-*
103+
- name: Generate artifact attestation
104+
uses: actions/attest-build-provenance@v1
105+
with:
106+
subject-path: 'wheels-*/*'
107+
- name: Publish to PyPI
108+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
109+
uses: PyO3/maturin-action@v1
110+
with:
111+
command: upload
112+
args: --non-interactive --skip-existing wheels-*/*

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/target
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
.pytest_cache/
6+
*.py[cod]
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.venv/
13+
dist/
14+
15+
.DS_Store
16+
17+
# Lock files for dependencies should be ignored for library
18+
/Cargo.lock
19+
20+
*.egg-info/

Cargo.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[package]
2+
name = "cocoindex"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
[lib]
8+
name = "cocoindex_engine"
9+
crate-type = ["cdylib"]
10+
11+
[dependencies]
12+
pyo3 = { version = "0.23.4" }
13+
anyhow = { version = "1.0.95", features = ["std"] }
14+
async-trait = "0.1.85"
15+
axum = "0.7.9"
16+
axum-extra = { version = "0.9.6", features = ["query"] }
17+
base64 = "0.22.1"
18+
chrono = "0.4.39"
19+
config = "0.14.1"
20+
const_format = "0.2.34"
21+
env_logger = "0.11.6"
22+
futures = "0.3.31"
23+
log = "0.4.25"
24+
regex = "1.11.1"
25+
serde = { version = "1.0.217", features = ["derive"] }
26+
serde_json = "1.0.137"
27+
sqlx = { version = "0.8.3", features = ["chrono", "postgres", "runtime-tokio"] }
28+
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
29+
tower = "0.5.2"
30+
tower-http = { version = "0.6.2", features = ["cors", "trace"] }
31+
indexmap = { version = "2.7.1", features = ["serde"] }
32+
blake2 = "0.10.6"
33+
pgvector = { version = "0.4.0", features = ["sqlx"] }
34+
blocking = "1.6.1"
35+
indenter = "0.3.3"
36+
itertools = "0.14.0"
37+
derivative = "2.2.0"

0 commit comments

Comments
 (0)