This commit is contained in:
272
templates/readme/partials/installation.md.jinja
Normal file
272
templates/readme/partials/installation.md.jinja
Normal file
@@ -0,0 +1,272 @@
|
||||
### Package Installation
|
||||
|
||||
{% for pm in package_manager %}
|
||||
{% if pm == "pip" %}
|
||||
Install via pip:
|
||||
|
||||
```bash
|
||||
pip install {{ package_name }}
|
||||
```
|
||||
|
||||
For async support and additional features:
|
||||
|
||||
```bash
|
||||
pip install {{ package_name }}[async]
|
||||
```
|
||||
|
||||
{% elif pm == "npm" %}
|
||||
```bash
|
||||
npm install {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "pnpm" %}
|
||||
```bash
|
||||
pnpm add {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "yarn" %}
|
||||
```bash
|
||||
yarn add {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "go get" %}
|
||||
```bash
|
||||
go get {{ package_name }}
|
||||
```
|
||||
|
||||
For more details on FFI setup and native library linking, see the [Go API Reference](https://docs.kreuzberg.dev/reference/api-go/).
|
||||
|
||||
{% elif pm == "maven" %}
|
||||
{% set maven_parts = package_name | split(":") %}
|
||||
Add to your `pom.xml`:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>{{ maven_parts[0] }}</groupId>
|
||||
<artifactId>{{ maven_parts[1] }}</artifactId>
|
||||
<version>{{ version }}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
{% elif pm == "gradle" %}
|
||||
Kotlin DSL (`build.gradle.kts`):
|
||||
|
||||
```kotlin
|
||||
implementation("{{ package_name }}:{{ version }}")
|
||||
```
|
||||
|
||||
Groovy DSL (`build.gradle`):
|
||||
|
||||
```groovy
|
||||
implementation '{{ package_name }}:{{ version }}'
|
||||
```
|
||||
|
||||
{% elif pm == "rubygems" %}
|
||||
Install via gem:
|
||||
|
||||
```bash
|
||||
gem install {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "bundler" %}
|
||||
Or add to your Gemfile:
|
||||
|
||||
```ruby
|
||||
gem '{{ package_name }}'
|
||||
```
|
||||
|
||||
{% elif pm == "composer" %}
|
||||
Install via Composer:
|
||||
|
||||
```bash
|
||||
composer require {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "mix" %}
|
||||
Add to your `mix.exs` dependencies:
|
||||
|
||||
```elixir
|
||||
def deps do
|
||||
[
|
||||
{:{{ package_name }}, "~> {{ version }}"}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
mix deps.get
|
||||
```
|
||||
|
||||
{% elif pm == "nuget" %}
|
||||
Install via NuGet:
|
||||
|
||||
```bash
|
||||
dotnet add package {{ package_name }}
|
||||
```
|
||||
|
||||
Or via NuGet Package Manager:
|
||||
|
||||
```
|
||||
Install-Package {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "pub" %}
|
||||
Install via pub:
|
||||
|
||||
```bash
|
||||
dart pub add {{ package_name }}
|
||||
```
|
||||
|
||||
For Flutter projects:
|
||||
|
||||
```bash
|
||||
flutter pub add {{ package_name }}
|
||||
```
|
||||
|
||||
{% elif pm == "spm" %}
|
||||
Add to your `Package.swift` dependencies:
|
||||
|
||||
```swift
|
||||
.package(url: "https://github.com/kreuzberg-dev/kreuzberg.git", from: "{{ version }}"),
|
||||
```
|
||||
|
||||
Then add the product to the relevant target:
|
||||
|
||||
```swift
|
||||
.target(
|
||||
name: "YourTarget",
|
||||
dependencies: [
|
||||
.product(name: "{{ package_name }}", package: "kreuzberg"),
|
||||
]
|
||||
),
|
||||
```
|
||||
|
||||
{% elif pm == "hex" %}
|
||||
Install via Hex:
|
||||
|
||||
```elixir
|
||||
def deps do
|
||||
[
|
||||
{:{{ package_name }}, "~> {{ version }}"}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
{% elif pm == "zig" %}
|
||||
Fetch the package and pin it in `build.zig.zon`:
|
||||
|
||||
```bash
|
||||
zig fetch --save https://github.com/kreuzberg-dev/kreuzberg/archive/refs/tags/v{{ version }}.tar.gz
|
||||
```
|
||||
|
||||
Then wire it into `build.zig`:
|
||||
|
||||
```zig
|
||||
const kreuzberg_dep = b.dependency("{{ package_name }}", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
exe.root_module.addImport("{{ package_name }}", kreuzberg_dep.module("{{ package_name }}"));
|
||||
```
|
||||
|
||||
{% elif pm == "install.packages" %}
|
||||
Install from the kreuzberg R-universe:
|
||||
|
||||
```r
|
||||
install.packages("{{ package_name }}",
|
||||
repos = c("https://kreuzberg-dev.r-universe.dev", getOption("repos")))
|
||||
```
|
||||
|
||||
{% elif pm == "cargo" %}
|
||||
Build the shared library from the workspace:
|
||||
|
||||
```bash
|
||||
cargo build --release -p {{ package_name }}
|
||||
```
|
||||
|
||||
The built artifacts are emitted under `target/release/` (`lib{{ package_name | replace("-", "_") }}.{so,dylib,a}`) along with the C header at `crates/{{ package_name }}/include/kreuzberg.h`.
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
### System Requirements
|
||||
{% if language == "python" %}
|
||||
- **Python 3.10+** required
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "typescript" %}
|
||||
- **Node.js 22+** required (NAPI-RS native bindings)
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
|
||||
### Platform Support
|
||||
|
||||
Pre-built binaries available for:
|
||||
- macOS (arm64, x64)
|
||||
- Linux (x64)
|
||||
- Windows (x64)
|
||||
|
||||
{% elif language == "go" %}
|
||||
- **Go 1.19+** required
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "java" %}
|
||||
- **Java 25+** required (Foreign Function & Memory API; build run with `--enable-preview` and `--enable-native-access=ALL-UNNAMED`)
|
||||
- Native libraries bundled in the JAR for macOS (arm64, x64), Linux (x64, arm64), and Windows (x64)
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "kotlin" %}
|
||||
- **JDK 25+** required
|
||||
- Native libraries bundled via the Java facade JAR
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "ruby" %}
|
||||
- **Ruby 3.2.0 or higher** required (including Ruby 4.x)
|
||||
- Ruby 4.0+ is fully supported with no code changes required
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "php" %}
|
||||
- **PHP 8.2+** required
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "csharp" %}
|
||||
- **.NET 10.0+** required
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "elixir" %}
|
||||
- **Elixir 1.14+** and **Erlang/OTP 26+** required
|
||||
- Pre-compiled NIFs bundled via `rustler_precompiled` for macOS (arm64, x64), Linux (x64, arm64), and Windows (x64)
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "wasm" %}
|
||||
- Modern browser with WebAssembly support, or Deno 1.0+, or Cloudflare Workers
|
||||
- Optional: [Tesseract WASM](https://github.com/naptha/tesseract.js) for OCR functionality
|
||||
{% elif language == "r" %}
|
||||
- **R 4.1+** required (extendr bindings)
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "ffi" %}
|
||||
- A C/C++ toolchain (clang, gcc, or MSVC) and a Rust toolchain (`rustup`) for building from source
|
||||
- A `pkg-config` or CMake-aware build system that can locate `libkreuzberg_ffi` and `kreuzberg.h`
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "dart" %}
|
||||
- **Dart SDK 3.0+** for pure-Dart consumers
|
||||
- Flutter projects supported on macOS, iOS, Android, Linux, and Windows; Flutter Web is not supported
|
||||
- Native runtime delivered via `flutter_rust_bridge` with bundled binaries for the supported platforms
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "swift" %}
|
||||
- **Swift 6.0+** (`swift-tools-version: 6.0`) on macOS 13+ or iOS 16+
|
||||
- Native runtime delivered through the C FFI surface from `kreuzberg-ffi`; published artifacts ship as a binary target
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% elif language == "zig" %}
|
||||
- **Zig 0.16.0+** required (`minimum_zig_version` declared in `build.zig.zon`)
|
||||
- Links the C FFI surface from `kreuzberg-ffi`; the build resolves the library via `linkSystemLibrary` against the consumer-provided search path
|
||||
- Optional: [ONNX Runtime](https://github.com/microsoft/onnxruntime/releases) version 1.22.x for embeddings support
|
||||
- Optional: [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) for OCR functionality
|
||||
{% else %}
|
||||
- See [Installation Guide](https://docs.kreuzberg.dev/getting-started/installation/) for requirements
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user