Skip to main content
Incomplete provenance

1 of 6 release files were uploaded without provenance metadata. View details.

Visers Nano Python API

visers computes L2-normalized visual embeddings on the CPU. It calls the same Rust decoder, resizer and Nano model as the nano_image CLI. The wheel contains the model weights and returns NumPy arrays directly. Existing applications can also import the API as visers_nano.

Install

Install the published package in a Python 3.10 or newer environment.

python -m pip install visers

To install from a checkout, run python -m pip install . in the repository root. A source build needs Rust 1.88 or newer, a C compiler and CMake. NASM enables SIMD in the bundled JPEG decoder on x86. Pip installs NumPy and uses maturin to build the native extension.

Encode images

This example runs from the repository root. A file and its encoded bytes produce the same row.

from pathlib import Path

import numpy as np
import visers as nano

image = Path("assets/banner.webp")
upload = image.read_bytes()

vector = nano.encode_single(image)
rows = nano.encode([image, upload], jobs=2)

assert vector.shape == (nano.DIMENSIONS,)
assert rows.shape == (2, nano.dimensions())
assert rows.dtype == np.float32
np.testing.assert_array_equal(rows[0], rows[1])
print(nano.similarity(vector, rows[1]))
Call Result
encode_single(image, *, mode="fast") One contiguous float32 array of shape (D,)
encode(images, *, mode="fast", jobs=None) A C-contiguous float32 matrix of shape (N, D), in input order
DIMENSIONS, dimensions() Embedding width of the installed build, 256 by default
similarity(a, b) Cosine similarity of two finite nonzero vectors
distance(a, b) Euclidean distance between two finite vectors

An image can be a str or os.PathLike[str] path, or the contents of a JPEG, PNG, WebP, GIF, BMP or PNM file as bytes, bytearray or memoryview. The file signature selects the decoder. Immutable bytes are borrowed during inference. Mutable buffers and memory views are copied when accepted.

encode takes one image or an iterable of images. One image yields shape (1, D), and an empty iterable yields (0, D). The iterable is gathered before processing. For a large collection, submit batches that fit in memory.

The two comparison functions take one-dimensional array-like inputs of equal, nonzero length. They convert values to float32 and accumulate in float64. For example, compare two rows using nano.distance(rows[0], rows[1]).

Preprocessing and workers

  • mode="fast" uses decoder-side scaling for large JPEGs and opaque still WebPs. This is the default for Python, the Rust convenience functions and the CLI.
  • mode="full" decodes the full raster, applies EXIF orientation and reproduces Forge's Pillow 13 BOX resize of the whole frame to 128×128. Choose the same mode when building an index and embedding queries.
  • jobs=None uses available CPU parallelism, limited by the number of inputs. A positive integer caps workers per call. Use jobs=1 to process a batch sequentially. The extension releases the GIL during decoding and inference.
  • The process loads the baked model on first use. A calling thread reuses its decoder and inference workspace across calls. Workers write their results directly into rows of the output matrix.

Errors

Invalid input types raise TypeError. Malformed or unsupported images and invalid modes raise ValueError. Filesystem failures raise OSError subclasses such as FileNotFoundError. Inputs are type-checked before dispatch. For read or decode failures, the exception identifies the lowest failing input index, starting at zero, and includes the path when applicable. A successful call returns all rows.

Build a different embedding width

The default wheel embeds the 256D head. To build a 64D wheel from the repository root, install maturin in your build environment and select the head at compile time. Use dim-128 for 128D. Each build exports its width through DIMENSIONS.

python -m pip install "maturin>=1.12,<2"
maturin build --release --locked --features dim-64 --out dist/64

Metadata

Release files for visers 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Incomplete provenance

1 of 6 files were uploaded without provenance metadata.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for visers 1.1.0
File Size Uploaded Provenance Actions
visers-1.1.0.tar.gz 2.5 MB Without provenance Details for visers-1.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for visers 1.1.0
File Actions
visers-1.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for visers-1.1.0-cp310-abi3-win_amd64.whl
visers-1.1.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for visers-1.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
visers-1.1.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for visers-1.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
visers-1.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for visers-1.1.0-cp310-abi3-macosx_11_0_arm64.whl
visers-1.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for visers-1.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 12.5 MB

Release files / visers-1.1.0.tar.gz

Incomplete provenance

This file belongs to a release with incomplete provenance: while other files in this release have provenance metadata, this file does not.

We recommend further investigation before installing this file. View details.

Download URL visers-1.1.0.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
45e1944800e540480b24921aeb25c602b256f6f973eec9f9c438f6ee8d898202
BLAKE2b-256 checksum
How to use checksums
8fde83bdd6b021bcce02cfb42bc0080c31369a8c79775166a8c3e2b7189e57fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release files / visers-1.1.0-cp310-abi3-win_amd64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL visers-1.1.0-cp310-abi3-win_amd64.whl
Size 1.9 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1a5a3138437dffde49b1cacb9383215434b3ff831de6863bc7b627f3ac7262b6
BLAKE2b-256 checksum
How to use checksums
f493c1794b86d7bd95be6b96c5bf0cc0c58dca1087557730b28ffa43aa4e7ea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / visers-1.1.0-cp310-abi3-manylinux_2_28_x86_64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL visers-1.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
6886a75561d348226de15f1b45cfa03a811057e95e0ef37260bdbaaea3ed1e6b
BLAKE2b-256 checksum
How to use checksums
1de98de9c5f266f73423da3f7638748455ec37c6bfae84349d83f4625951280e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / visers-1.1.0-cp310-abi3-manylinux_2_28_aarch64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL visers-1.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 2.0 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
2d555617042fcb618a2542c71b418bc3f8ccc01a03db0e7ac1a1a11b380be4f1
BLAKE2b-256 checksum
How to use checksums
fd0c9bd81ff4fb00bcb682d754f44827168defbb916212d46c95c2bc6d67503b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / visers-1.1.0-cp310-abi3-macosx_11_0_arm64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL visers-1.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
403fd4cdb81e4bb76f21415ff386b7c71a6917f7163412a551d7ed8bc2d352bc
BLAKE2b-256 checksum
How to use checksums
4dcd82451458b62be89bb402b9537493eb530b5942c8aea8f633578fea76c932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / visers-1.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL visers-1.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.1 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c5bea6193a5b5e370b5458020593e95fb53cdb1c2c0d4b73e9914df3c544d4b8
BLAKE2b-256 checksum
How to use checksums
c030c1be471de1ee890924f65205ac65b5b67fb0a3c555dd324e963e00b20982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for visers 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Incomplete provenance

1 of 6 release files were uploaded without provenance metadata.

Files with provenance 5 / 6
Files without provenance 1 / 6
Select from 6 files

Attestations for visers-1.1.0.tar.gz

This file was uploaded without provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page