Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Questions and community discussion
url: https://github.com/AbyssGG/OpenVINO-Nim-API/discussions
about: Ask usage questions here once Discussions is enabled by the maintainer.
- name: Troubleshooting guide
url: https://github.com/AbyssGG/OpenVINO-Nim-API/blob/main/docs/troubleshooting.md
about: Check the loader and runtime diagnostics before opening an issue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## Checklist

- [ ] No editor metadata, runtime binaries, model weights or credentials were added.
- [ ] No editor metadata or build artifacts were added.
- [ ] No runtime binaries, model weights, credentials or absolute local paths were added.
- [ ] New public symbols have ownership, blocking behaviour and exception docs.
- [ ] `docs/c-api-coverage.md` or the managed API overview is updated.
20 changes: 13 additions & 7 deletions .github/workflows/docs-pages.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
#
# Manual API documentation publishing. The repository keeps this workflow
# API documentation publishing. The repository keeps this workflow
# separate from blocking CI so Pages can be enabled by a maintainer when the
# repository settings and deployment environment are ready.

name: docs-pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
Expand All @@ -21,7 +21,7 @@ concurrency:
jobs:
build:
name: build API pages
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
# actions/checkout v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
Expand All @@ -33,20 +33,26 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate API documentation
run: nimble docs
run: |
nim doc --project --index:on --path:src --outdir:htmldocs src/openvino.nim
nimble docs
cp -R build/docs/. htmldocs/

# actions/configure-pages v6.0.0
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d

# actions/upload-pages-artifact v5.0.0
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9
with:
path: build/docs
path: htmldocs

deploy:
name: deploy API pages
needs: build
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ and the OpenVINO runtime baseline evolve independently:

## Unreleased

- Improved onboarding with Git-URL installation, compact inference guidance,
runtime installation links and explicit deployment limitations.
- Added ecosystem announcement and package-index submission drafts.
- Added a Discussions entry point and automatic main-branch API Pages publishing.

- Changed the human-readable project title to `OpenVINO Nim API` while keeping
the public repository name `OpenVINO-Nim-API` and release prefix
`openvino-nim` unchanged.
Expand Down
26 changes: 25 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,34 @@ considered inappropriate in a professional setting.
## Enforcement

Report unacceptable behaviour through the private route in
[SECURITY.md](SECURITY.md) with the subject `Code of Conduct`. The maintainers
[SECURITY.md](SECURITY.md) with the subject `Code of Conduct`. If that route
is unavailable, ask a maintainer for a private contact route without posting
the report or personal information publicly. The maintainers
will review a report, protect the reporter's confidentiality where possible,
and take the action they consider appropriate, including removing content or
restricting participation.

## Scope

This policy applies in project issues, pull requests, Discussions and other
community spaces, and when someone represents the project publicly.
Maintainers are responsible for explaining and enforcing these standards
fairly, including when a report concerns another maintainer.

## Enforcement guidelines

Maintainers consider the impact, context and recurrence of a violation:

1. **Correction:** explain the harm and request a change in behaviour.
2. **Warning:** set explicit boundaries for continued participation.
3. **Temporary restriction:** suspend participation for a stated period after
serious or repeated violations.
4. **Permanent restriction:** exclude people whose severe or persistent
conduct makes participation unsafe for others.

Reports are reviewed confidentially where possible. Restrictions and any
conditions for returning should be communicated privately to the person
involved; reporters' identities and private details must not be published.

This policy is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/),
version 2.1.
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ writing code, and
[OPENVINO_NIM_0.1_DEVELOPMENT_PLAN.md](OPENVINO_NIM_0.1_DEVELOPMENT_PLAN.md)
for the phase-by-phase scope of `0.1.0`.

Please follow our [Code of Conduct](CODE_OF_CONDUCT.md). New to the project?
Documentation corrections, clearer examples and reproducible bug reports are
welcome. Use the issue templates for bugs and feature requests, and
[Discussions](https://github.com/AbyssGG/OpenVINO-Nim-API/discussions) for
questions once the maintainer enables it. Never include private models or secrets.

## Prerequisites

| Component | Requirement | Needed for |
Expand Down Expand Up @@ -150,6 +156,32 @@ publishing to the Nimble package index all require explicit authorisation
from the project owner for that specific action. Nothing in the development
plan or in this document grants that authorisation implicitly.

## Maintainer discoverability checklist

These settings and submissions are manual; merging the repository changes
does not perform them:

- In Settings → Pages, set **Source = GitHub Actions**. Allow the
`github-pages` environment to deploy from `main`, then run `docs-pages`
once (or push to `main`) and verify its deployment.
- After the site is live, set the repository homepage to
`https://abyssgg.github.io/OpenVINO-Nim-API/`.
- Enable **Discussions** under Settings → General → Features so the question
links in the issue chooser and README work.
- Upload an original **1280 × 640** social preview image under Settings →
General → Social preview. Do not imply Intel endorsement.
- Review `docs/promotion/nimble-packages-entry.json`, check that `openvino`
is available in `nim-lang/packages`, and submit the entry to `packages.json`
following that repository's current contribution rules. Keep Git-URL
installation instructions until the entry is accepted.
- Review and submit the Nim forum, Show HN, r/nim and Chinese drafts in
`docs/promotion/`, and the awesome-list entries where appropriate. Check
platform rules, disclose authorship and avoid duplicate/spam submissions.
Update draft statements about registry and documentation availability
before posting.
- Optionally review repository topics such as `nim`, `nim-lang`, `openvino`,
`inference`, `machine-learning`, `bindings` and `edge-ai`.

## License

Contributions are accepted under Apache-2.0, matching
Expand Down
120 changes: 105 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
[![Nim](https://img.shields.io/badge/Nim-%E2%89%A52.0.0-yellow.svg)](https://nim-lang.org/)
[![OpenVINO](https://img.shields.io/badge/OpenVINO-2026.4.x-6b4fbb.svg)](https://docs.openvino.ai/)
[![Status](https://img.shields.io/badge/status-v0.1.0-brightgreen.svg)](https://github.com/AbyssGG/OpenVINO-Nim-API/releases/tag/v0.1.0)
[![Latest release](https://img.shields.io/github/v/release/AbyssGG/OpenVINO-Nim-API)](https://github.com/AbyssGG/OpenVINO-Nim-API/releases/latest)

**English** | [简体中文](README_zh-CN.md)

Nim bindings for the [OpenVINO](https://docs.openvino.ai/) Runtime C API.
**Run OpenVINO inference from Nim: native binaries, an idiomatic managed API,
and direct access to the Runtime C API.**

Nim compiles to native code, so your inference application needs no Python
runtime. This makes Nim + OpenVINO useful for small deployments without a
Python application stack—not a promise of a single-file deployment: OpenVINO
libraries, plugins and your model still ship separately.

OpenVINO Nim API provides two layers. The managed API is idiomatic Nim with
private native handles, Nim exceptions and documented ownership rules. The
Expand Down Expand Up @@ -38,7 +44,7 @@ made for GPU, NPU or macOS. See [compatibility](docs/compatibility.md) for what
was and was not run. Nothing in this README should be read as a claim that a
feature already works unless it says so.

## Feature overview
## Features

| Capability | 0.1.0 status | Notes |
|---|---|---|
Expand All @@ -57,26 +63,57 @@ before designing an application around a future feature.

## Quick start

1. Install OpenVINO Runtime `2026.4.x`. On Windows, run `setupvars.bat` in
1. Install [Nim](https://nim-lang.org/install.html) `2.0.0` or newer and
[OpenVINO Runtime](#installing-the-openvino-runtime) `2026.4.x`.
On Windows, run `setupvars.bat` in
Command Prompt (CMD); on Linux, source `setupvars.sh` in Bash. Keep using
that shell for the remaining commands.
2. Clone this repository and install the local Nim package:
that shell for the remaining commands. macOS is not verified by this project.
2. Install directly from Git (the Nimble registry entry is not published yet):

```shell
nimble install https://github.com/AbyssGG/OpenVINO-Nim-API
```

3. For the bundled model and runnable examples, clone the repository:

```shell
git clone https://github.com/AbyssGG/OpenVINO-Nim-API.git
cd OpenVINO-Nim-API
nimble install
```

3. Run the verified examples against the included four-value ReLU fixture:
4. Run the verified examples against the included four-value ReLU fixture:

```shell
nimble examples
```

The [getting started guide](docs/getting-started.md) has platform-specific
loader checks and troubleshooting. The complete inference snippet is kept
below and is compiled from the same source as `examples/minimal.nim`.
Here is the managed inference flow, using that fixture from the repository root:

```nim
import openvino

proc main() =
let core = newCore()
defer: core.close()
let compiled = core.compileModel("tests/fixtures/relu_1x4_f32.xml", "CPU")
defer: compiled.close()
let request = compiled.createInferRequest()
defer: request.close()
let input = tensorFrom(etF32, initShape(1, 4), [float32(-1.5), 2.0, -0.25, 4.0])
defer: input.close()
request.setInputTensor(0, input); request.infer()
let output = request.outputTensor(0)
defer: output.close()
echo output.toSeq(float32)
main()
```

Expected output: `@[0.0, 2.0, 0.0, 4.0]`. Save it as `quickstart.nim` and run
`nim c -r quickstart.nim` after installing the package.
The [getting started guide](docs/getting-started.md) has loader checks and
troubleshooting. The expanded [minimal example](#minimal-synchronous-inference)
below is checked against `examples/minimal.nim` by the repository's lint task.

## Release artifacts

Expand Down Expand Up @@ -152,10 +189,26 @@ The package binds to the OpenVINO runtime at run time and never ships it.
Install OpenVINO `2026.4.x` separately, then make sure the C API library is
visible to the dynamic loader:

Use the [official installation selector](https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/download.html)
and [installation documentation](https://docs.openvino.ai/2026/get-started/install-openvino.html)
to obtain the `2026.4` runtime for your OS and architecture.

| Platform | Installation and activation |
|---|---|
| Linux x86_64 | Extract the official runtime archive; in Bash run `source /path/to/openvino/setupvars.sh` |
| Windows x86_64 | Extract the official runtime archive; in CMD run `call "C:\path\to\openvino\setupvars.bat"` |
| macOS | Use the official distribution for your architecture, if available for `2026.4`; source its `setupvars.sh` and keep the complete library layout. **Experimental: no macOS inference validation here** |

Python/pip is an optional installation route, not an inference dependency.
For example, `python -m pip install "openvino==2026.4.0"` installs into that
Python environment; configure its library directory as described in
[Getting started](docs/getting-started.md).

| Platform | Library | Loader notes |
|---|---|---|
| Windows | `openvino_c.dll` | Must be on the DLL search path |
| Linux | `libopenvino_c.so`, or `libopenvino_c.so.2640` | Must be on the loader search path. A pip installation ships only the versioned name; both are tried |
| macOS (unverified) | `libopenvino_c.dylib` | Keep dependencies on the loader path; `-d:openvinoLib=/full/path/to/libopenvino_c.dylib` can select the C library explicitly |

Loading `openvino_c` alone is not enough to run inference. `Core` also needs
`plugins.xml`, the device plugins and the model frontends from the same
Expand All @@ -171,8 +224,13 @@ commands and pip-specific loader setup.

## Installing the package

The Nimble package index entry is not published yet. Run this command from
the repository root after cloning the checkout:
The Nimble package index entry is not published yet. Install from its Git URL:

```shell
nimble install https://github.com/AbyssGG/OpenVINO-Nim-API
```

Alternatively, run this command from the repository root after cloning:

```shell
nimble install
Expand Down Expand Up @@ -229,7 +287,9 @@ To adapt it to another model, update the input count, element type, shape,
data preparation and output validation. The bundled fixture has no weights;
an IR model with weights also needs its `.bin` file.

More examples, all using the public API only:
## Examples

All examples use the public managed API and the bundled, weight-free model:

| Example | What it shows |
|---|---|
Expand All @@ -239,6 +299,9 @@ More examples, all using the public API only:
| `examples/tensor_basics.nim` | Shapes, element types, and the difference between the safe data paths and the unsafe one |
| `examples/profiling.nim` | Per-node timings, and what the numbers do and do not mean |

See the [example guide](examples/README.md) for commands and instructions for
obtaining and adapting another model with OpenVINO conversion tools.

## Error diagnosis

Failures surface as distinguishable Nim exceptions rather than status codes:
Expand Down Expand Up @@ -280,6 +343,10 @@ Two rules cover most of what you need to know:
The [documentation hub](docs/README.md) groups the English guides and the
generated API reference.

**[API documentation site](https://abyssgg.github.io/OpenVINO-Nim-API/)**
is published by the Pages workflow once the maintainer enables GitHub Pages.
Until its first deployment, use `nimble docs` locally or the `api-docs` CI artifact.

Start with whichever question you have:

| Question | Document |
Expand All @@ -302,7 +369,17 @@ Project documents: [notice and provenance](NOTICE),
[changelog](CHANGELOG.md),
[prototype audit](docs/resonance-audit.md).

## Project layout
## Architecture

`import openvino` exposes the managed layer: private native handles,
idempotent `close()`, Nim exceptions, validated arguments and safe tensor
copies. `import openvino/raw` explicitly opts into header-faithful C ABI
declarations; raw callers are responsible for native lifetimes and status codes.
The managed root never re-exports the raw API.

See [Architecture](docs/architecture.md) for the design and ownership boundary.

### Project layout

| Path | Purpose |
|---|---|
Expand All @@ -314,7 +391,15 @@ Project documents: [notice and provenance](NOTICE),
| `docs/` | Architecture, compatibility, API coverage and decisions |
| `.github/workflows/` | Static, runtime, documentation and release checks |

## Community and support
## Roadmap

After `0.1.0`, priorities include Nim-safe asynchronous callbacks, dynamic-shape
and preprocessing APIs, and verified coverage beyond CPU on Windows/Linux.
These are plans, not supported features or delivery promises.
See the [roadmap](docs/roadmap.md) and discuss concrete use cases before
depending on them.

## Contributing

Bug reports should include the OpenVINO runtime version, Nim version, target
device and the smallest reproducible example. Start with
Expand All @@ -327,6 +412,11 @@ managed/raw boundary intact, and update tests and documentation with any
public API change. The project is community maintained and is not an Intel
product.

For usage questions and ideas, use
[Discussions](https://github.com/AbyssGG/OpenVINO-Nim-API/discussions)
once enabled by the maintainer. Please follow the
[Code of Conduct](CODE_OF_CONDUCT.md).

## License

Apache-2.0. See [LICENSE](LICENSE), and [NOTICE](NOTICE) for how this package
Expand Down
Loading