Skip to content
Merged
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
124 changes: 124 additions & 0 deletions .github/workflows/python-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Python Binary

on:
release:
types: [published]

permissions:
contents: read

jobs:
binary-build:
name: Build ${{ matrix.asset_name }}
runs-on: ${{ matrix.runner }}

permissions:
contents: write

strategy:
fail-fast: true
matrix:
include:
- runner: ubuntu-26.04
python_arch: x64
asset_name: onvif-linux-amd64
executable_name: onvif

- runner: ubuntu-26.04
python_arch: x86
asset_name: onvif-linux-i386
executable_name: onvif

- runner: ubuntu-26.04-arm
python_arch: arm64
asset_name: onvif-linux-arm64
executable_name: onvif

- runner: windows-latest
python_arch: x64
asset_name: onvif-windows-win64
executable_name: onvif.exe

- runner: windows-latest
python_arch: x86
asset_name: onvif-windows-win32
executable_name: onvif.exe

- runner: windows-11-arm
python_arch: arm64
asset_name: onvif-windows-arm64
executable_name: onvif.exe

- runner: macos-15-intel
python_arch: x64
asset_name: onvif-macos-amd64
executable_name: onvif

- runner: macos-latest
python_arch: arm64
asset_name: onvif-macos-arm64
executable_name: onvif

steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"
architecture: ${{ matrix.python_arch }}

- name: Verify Python architecture ${{ matrix.python_arch }} | ${{ matrix.runner }}
env:
EXPECTED_ARCH: ${{ matrix.python_arch }}
run: |
python -c "import os, platform, struct, sys; actual = struct.calcsize('P') * 8; expected = {'x86': 32, 'x64': 64, 'arm64': 64}[os.environ['EXPECTED_ARCH']]; print(f'Python: {platform.python_version()}'); print(f'Architecture: {platform.machine()} ({actual}-bit)'); sys.exit(0 if actual == expected else f'Expected {expected}-bit Python, got {actual}-bit')"

- name: Install project and PyInstaller ${{ matrix.python_arch }} | ${{ matrix.runner }}
run: |
python -m pip install --upgrade pip
python -m pip install . pyinstaller pillow

- name: Build executable (${{ matrix.asset_name }})
run: >
pyinstaller
--clean
--noconfirm
--onedir
--collect-all onvif
--icon docs/assets/onvif.png
--name onvif
onvif/cli/__main__.py

- name: Include license and notice (${{ matrix.asset_name }})
shell: bash
run: |
cp LICENSE dist/onvif/LICENSE
if [ -f NOTICE ]; then
cp NOTICE dist/onvif/NOTICE
fi

- name: Test executable (${{ matrix.asset_name }})
env:
EXECUTABLE_NAME: ${{ matrix.executable_name }}
run: |
python -c "import os, subprocess; from pathlib import Path; p = (Path('dist/onvif') / os.environ['EXECUTABLE_NAME']).resolve(); print(f'Testing: {p}'); result = subprocess.run([str(p), '--help'], capture_output=True, text=True, timeout=60); print(result.stdout); print(result.stderr); raise SystemExit(result.returncode)"

- name: Package distribution (${{ matrix.asset_name }})
env:
ASSET_NAME: ${{ matrix.asset_name }}
run: |
python -c "import os, shutil; from pathlib import Path; src = Path('dist/onvif'); dst = Path('dist') / os.environ['ASSET_NAME']; shutil.make_archive(str(dst), 'zip', root_dir=src.parent, base_dir=src.name); print(f'Created {dst}.zip')"

- name: Verify archive (${{ matrix.asset_name }})
env:
ASSET_NAME: ${{ matrix.asset_name }}
run: |
python -c "import os, sys, zipfile; from pathlib import Path; p = Path('dist') / (os.environ['ASSET_NAME'] + '.zip'); valid = p.is_file() and p.stat().st_size > 0 and zipfile.is_zipfile(p); print(f'Archive: {p} ({p.stat().st_size if p.exists() else 0} bytes)'); sys.exit(0 if valid else f'Invalid archive: {p}')"

- name: Upload to GitHub Release (${{ matrix.asset_name }})
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" "dist/${{ matrix.asset_name }}.zip" --clobber
shell: bash
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ This library simplifies that process by wrapping SOAP communication into a clean
<tr>
<th align="start">
<img
src="https://github.com/Templarian/MaterialDesign/blob/master/svg/account-hard-hat.svg"
src="https://raw.githubusercontent.com/Templarian/MaterialDesign/refs/heads/master/svg/account-hard-hat.svg"
width="24"
height="24"
valign="middle"
/>&nbsp;Individual Developers
</th>
<th align="start">
<img
src="https://github.com/Templarian/MaterialDesign/blob/master/svg/video-wireless.svg"
src="https://raw.githubusercontent.com/Templarian/MaterialDesign/refs/heads/master/svg/video-wireless.svg"
width="24"
height="24"
valign="middle"
Expand All @@ -48,15 +48,15 @@ This library simplifies that process by wrapping SOAP communication into a clean
<tr>
<th align="start">
<img
src="https://github.com/Templarian/MaterialDesign/blob/master/svg/cctv.svg"
src="https://raw.githubusercontent.com/Templarian/MaterialDesign/refs/heads/master/svg/cctv.svg"
width="24"
height="24"
valign="middle"
/>&nbsp;Security Integrators
</th>
<th align="start">
<img
src="https://github.com/Templarian/MaterialDesign/blob/master/svg/chip.svg"
src="https://raw.githubusercontent.com/Templarian/MaterialDesign/refs/heads/master/svg/chip.svg"
width="24"
height="24"
valign="middle"
Expand Down Expand Up @@ -103,11 +103,28 @@ cd onvif-python
pip install .
```

Once the installation is successful, you can also immediately access the [ONVIF CLI](https://onvif-python.pages.dev/core/onvif_cli/) via the terminal using:
Once the installation is successful, you can also immediately access the [ONVIF CLI](https://onvif-python.pages.dev/main/onvif_cli/) via the terminal using:
```shell
onvif --help
```

## Prebuilt Binaries (No Python Required)

To use the [ONVIF CLI](https://onvif-python.pages.dev/main/onvif_cli/) without installing Python or additional dependencies, download a prebuilt binary for your platform from the [GitHub Releases](https://github.com/nirsimetri/onvif-python/releases) page.

Each release includes downloadable binary assets for supported platforms and architectures. Choose the appropriate binary from the table below:

| Platform | Architecture | Download |
|---|---|---|
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/linux.svg" width="20" height="20" valign="middle"/> &nbsp;Linux | AMD64 (64-bit) | [onvif-linux-amd64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-linux-amd64.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/linux.svg" width="20" height="20" valign="middle"/> &nbsp;Linux | i386 (32-bit) | [onvif-linux-i386.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-linux-i386.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/linux.svg" width="20" height="20" valign="middle"/> &nbsp;Linux | ARM64 (aarch64) | [onvif-linux-arm64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-linux-arm64.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/windows.svg" width="20" height="20" valign="middle"/> &nbsp;Windows | x64 (64-bit) | [onvif-windows-win64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-windows-win64.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/windows.svg" width="20" height="20" valign="middle"/> &nbsp;Windows | x86 (32-bit) | [onvif-windows-win32.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-windows-win32.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/windows.svg" width="20" height="20" valign="middle"/> &nbsp;Windows | ARM64 | [onvif-windows-arm64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-windows-arm64.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/apple.svg" width="20" height="20" valign="middle"/> &nbsp;macOS | Intel (AMD64) | [onvif-macos-amd64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-macos-amd64.zip) |
| <img src="https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/master/svgs/brands/apple.svg" width="20" height="20" valign="middle"/> &nbsp;macOS | Apple Silicon (ARM64) | [onvif-macos-arm64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-macos-arm64.zip) |

## Documentation

For complete guide, including usage examples and API references, please visit the [Documentation Site](https://onvif-python.pages.dev/).
Expand Down
Binary file added docs/assets/onvif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/llms.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ONVIF Python

> A modern, developer-friendly Python library for discovering, connecting to, and managing ONVIF-compliant IP cameras, NVRs, and other ONVIF-compliant devices. It provides a Pythonic interface to ONVIF SOAP services, built-in WSDL definitions, WS-Discovery, device management, media streaming, PTZ, events, analytics, and a feature-rich command-line interface.
> A modern, developer-friendly Python Library + CLI for discovering, connecting to, and managing ONVIF-compliant IP cameras, NVRs, and other ONVIF-compliant devices. It provides a Pythonic interface to ONVIF SOAP services, built-in WSDL definitions, WS-Discovery, device management, media streaming, PTZ, events, analytics, and a feature-rich command-line interface.

ONVIF Python is an independent open-source implementation of the ONVIF specifications, maintained by Nirsimetri Technologies. It is designed for individual developers, companies building video management systems (VMS) and video intelligence platforms, security integrators, and IoT developers.

Expand Down
137 changes: 137 additions & 0 deletions docs/misc/binaries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
hide:
- path
comments: true
---

# Prebuilt Binaries (No Python Required)

Run the [ONVIF CLI](../main/onvif_cli.md) without installing Python or additional dependencies. Download a prebuilt binary for your platform from the [GitHub Releases](https://github.com/nirsimetri/onvif-python/releases) page.

Each release provides ZIP archives for supported operating systems and architectures. Choose the appropriate binary from the table below.

| Platform | Architecture | Download |
|---|---|---|
| :fontawesome-brands-linux: &nbsp;Linux | AMD64 (64-bit) | [onvif-linux-amd64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-linux-amd64.zip) |
| :fontawesome-brands-linux: &nbsp;Linux | i386 (32-bit) | [onvif-linux-i386.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-linux-i386.zip) |
| :fontawesome-brands-linux: &nbsp;Linux | ARM64 (aarch64) | [onvif-linux-arm64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-linux-arm64.zip) |
| :fontawesome-brands-windows: &nbsp;Windows | x64 (64-bit) | [onvif-windows-win64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-windows-win64.zip) |
| :fontawesome-brands-windows: &nbsp;Windows | x86 (32-bit) | [onvif-windows-win32.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-windows-win32.zip) |
| :fontawesome-brands-windows: &nbsp;Windows | ARM64 | [onvif-windows-arm64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-windows-arm64.zip) |
| :fontawesome-brands-apple: &nbsp;macOS | Intel (AMD64) | [onvif-macos-amd64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-macos-amd64.zip) |
| :fontawesome-brands-apple: &nbsp;macOS | Apple Silicon (ARM64) | [onvif-macos-arm64.zip](https://github.com/nirsimetri/onvif-python/releases/latest/download/onvif-macos-arm64.zip) |

## Installation

### :fontawesome-brands-linux: Linux

1. Download the ZIP archive matching your Linux architecture.
2. Extract the archive into a permanent location.
3. Create a symbolic link in `~/.local/bin` so the executable can be invoked from any directory.

For example, for Linux AMD64, assuming the archive is in `~/Downloads`:

```console
mkdir -p ~/.local/opt ~/.local/bin
unzip ~/Downloads/onvif-linux-amd64.zip -d ~/.local/opt
chmod +x ~/.local/opt/onvif/onvif
ln -sf ~/.local/opt/onvif/onvif ~/.local/bin/onvif
```

Ensure `~/.local/bin` is included in your `PATH`. If necessary, add the following to `~/.bashrc` or `~/.zshrc`:

```console
export PATH="$HOME/.local/bin:$PATH"
```

Reload your shell configuration or open a new terminal, then verify:

```console
onvif --help
```

Replace `onvif-linux-amd64.zip` with the archive matching your system.

### :fontawesome-brands-windows: Windows

1. Download the ZIP archive matching your Windows architecture.
2. Extract the archive. It contains an `onvif` directory with the executable and its bundled dependencies.
3. Move the extracted `onvif` directory to a permanent location, such as `%LOCALAPPDATA%\Programs\ONVIF`.
4. Add that directory to your user `PATH` environment variable.

To configure `PATH`, open **Edit environment variables for your account**, select `Path`, click **New**, and enter:

```text
%LOCALAPPDATA%\Programs\ONVIF
```

Open a new terminal and verify the installation:

```console
onvif --help
```

You can now invoke `onvif` from any working directory in PowerShell or Command Prompt.

### :fontawesome-brands-apple: macOS

1. Download the ZIP archive matching your Mac's processor: Intel or Apple Silicon.
2. Extract the archive into a permanent location.
3. Create a symbolic link in `~/.local/bin`.

For example, for Apple Silicon:

```console
mkdir -p ~/.local/opt ~/.local/bin
unzip ~/Downloads/onvif-macos-arm64.zip -d ~/.local/opt
chmod +x ~/.local/opt/onvif/onvif
ln -sf ~/.local/opt/onvif/onvif ~/.local/bin/onvif
```

Ensure `~/.local/bin` is included in your `PATH`. If necessary, add this line to `~/.zshrc`:

```console
export PATH="$HOME/.local/bin:$PATH"
```

Open a new terminal and verify:

```console
onvif --help
```

For Intel Macs, use `onvif-macos-amd64.zip` instead.

## Understanding the Distribution

The prebuilt binaries use PyInstaller's `--onedir` mode. Each archive contains the executable, bundled runtime dependencies, and project license documents.

The extracted directory has the following structure:

```text
onvif/
├── onvif # Linux and macOS
├── onvif.exe # Windows only
├── LICENSE
├── NOTICE
└── _internal/
└── ... # Bundled runtime and dependencies
```

The `_internal` directory contains the Python runtime components, third-party dependencies, and bundled resources required by the executable.

**Keep the executable and `_internal` directory together.** Do not delete, rename, or move `_internal` independently. The application may fail to start or operate correctly if its bundled files are missing.

The `LICENSE` and `NOTICE` files provide licensing and attribution information for the distribution.

## Verify the Installation

After completing the platform-specific setup, run:

```console
onvif --help
```

To see the available commands and options, consult the [ONVIF CLI documentation](../main/onvif_cli.md).

These prebuilt binaries do not require a separate Python installation or a separate installation of the ONVIF Python package.
4 changes: 2 additions & 2 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<meta property="og:title" content="ONVIF Python / Python Library for ONVIF Devices" />
<meta
property="og:description"
content="A modern Python library for ONVIF-compliant IP cameras and devices."
content="A Python Library + CLI for ONVIF-compliant IP cameras and devices."
/>
<meta property="og:site_name" content="ONVIF Python" />
<meta property="og:type" content="website" />
Expand All @@ -94,7 +94,7 @@
/>
<meta
name="twitter:description"
content="A modern Python library for ONVIF-compliant IP cameras and devices."
content="A Python Library + CLI for ONVIF-compliant IP cameras and devices."
/>
<meta
name="twitter:image"
Expand Down
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site_name: ONVIF Python
site_description: >-
A modern Python library for ONVIF-compliant IP cameras and devices, providing a clean,
A Python Library + CLI for ONVIF-compliant IP cameras and devices, providing a clean,
typed API for discovery, device management, media, PTZ, and events.
site_url: !ENV [SITE_URL, 'https://onvif-python.pages.dev/']
repo_url: https://github.com/nirsimetri/onvif-python
Expand Down Expand Up @@ -81,6 +81,8 @@ nav:
- Conventions: conventions.md
- Quickstart: quick_start.md
- Approach: approach.md
- Misc:
- Prebuilt Binaries: misc/binaries.md
- Usage:
- Client: main/onvif_client.md
- CLI: main/onvif_cli.md
Expand Down
Loading
Loading