Open-source project
basler/pypylon avatar
basler/pypylon

pypylon: the official Python binding for Basler pylon cameras

The official Python language binding for the Basler pylon C++ APIs

714 stars217 forksPythonBSD-3-Clause

At a glance

What is it?
pypylon wraps the Basler pylon C++ APIs so Python applications can control cameras and run pylon Data Processing recipes. It is a thin, officially maintained binding with a deliberate dependency on the pylon runtime, and its 26.6 release deprecates the old feature assignment style.
Who is it for?
Adopt pypylon if your acquisition stack is already Basler hardware and you want the parameter API, the InstantCamera context manager and pylon Data Processing recipes from Python. Do not adopt it as a generic camera library for non-Basler devices; the binding is tied to pylon.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What pypylon solves for Basler camera users

Machine vision code written against the pylon C++ APIs is fast and complete, but it is C++. pypylon is the official Python language binding for those APIs, so a Python process can enumerate Basler cameras, open one, set parameters and pull images without a C++ build step in the user's project. The README states the scope plainly: it enables Python applications to control and acquire images from Basler machine vision products, and the pylon Data Processing API allows image processing tasks as well.

The audience is narrow and specific. This is for engineers whose acquisition hardware is Basler and who want the camera exposed inside a Python program, for example next to NumPy or a vision pipeline. It is not a universal camera abstraction. The binding exposes pylon, so the feature set you get is the feature set pylon gives you, and the device support follows Basler's product line. If your cameras come from several vendors, this is the wrong layer to standardise on.

The mechanism: a SWIG binding over pylon, with a parameter API on top

The build configuration in pyproject.toml lists swig==4.3 in build-system requires, which is the mechanism: pypylon is generated from the pylon C++ headers with SWIG and shipped as a compiled extension. That explains the shape of the API. Objects such as InstantCamera and the grab result types are C++ classes surfaced in Python, and the release notes describe the addition of the full pylon parameter API, classes derived from Pylon::CParameter, which adds convenience methods on parameters.

The acquisition flow in the README is a context-manager loop. InstantCamera is constructed with pylon.FirstFound, opened and destroyed by the with statement, grabbing is bounded by StartGrabbingMax(100), and each RetrieveResult is released at the end of its own with block. The README notes that some camera models use a GenICam Generic Data Container (GenDC) format and that for single grabbed images a data component is emulated automatically, which is why the sample reaches the pixels through GetFirstImageDataComponent() and then Array.

Data Processing is a second layer rather than a second library. A Recipe object loads a .precipe file produced with the pylon Workbench, outputs are registered through RegisterAllOutputsObserver, and results arrive in a GenericOutputObserver. The README warns that the collector must be created before the recipe so it outlives it, which is a lifetime rule, not a stylistic preference.

Installing pypylon and grabbing your first frame

The README's Getting Started list has three steps. Install pylon from baslerweb.com, install pypylon with pip3 install pypylon, and then look at samples/pylon/grab/grab.py. The pylon installation is strongly recommended but not mandatory, and the README directs the reader to the known issues section for the details of what changes when it is absent. For the binary installation the same recommendation appears under prerequisites.

bash
pip3 install pypylon

After that command the pypylon package is importable. The README's own snippet is the shortest complete acquisition program, and it is worth reading closely because it encodes the current style.

python
from pypylon import pylon

with pylon.InstantCamera(pylon.FirstFound) as camera:
    print("Using device:", camera.DeviceInfo.ModelName)
    camera.Width.TrySetToMaximum()
    camera.StartGrabbingMax(100)

Note the parameter call TrySetToMaximum, which is one of the convenience methods the release notes describe. The full sample continues with a while camera.IsGrabbing() loop and RetrieveResult(5000, pylon.TimeoutHandling_ThrowException), then reads image_data_component.Array and prints the first pixel. Expect the model name on stdout and one line per grabbed frame; a timeout raises rather than returning silently.

For Data Processing, the prerequisites add CodeMeter Runtime when you want to use pylon vTools and the pylon Data Processing API extension on your platform. The recipe path is a file, so the working directory matters:

python
from pypylon import pylon
from pypylon import pylondataprocessing

result_collector = pylondataprocessing.GenericOutputObserver()
with pylondataprocessing.Recipe() as recipe:
    recipe.Load("barcode.precipe")
    recipe.RegisterAllOutputsObserver(result_collector, pylon.RegistrationMode_Append)
    recipe.Start()

The README points to samples/pylondataprocessing/barcode/barcode.py for the rest of that loop, and notes that the tests under tests/pylondataprocessing can serve as a source of information about the API syntax.

The 26.6 deprecation and what it costs to migrate

The README carries an explicit warning that pypylon 26.6 introduces breaking changes, and it says most existing code is expected to remain functional while directing readers to changelog.txt for the full list of affected areas. The concrete change described is assignment style. Writing cam.Gain = 42 is deprecated with pypylon 3.0.0 because it prevents full typing support, and the recommended form is cam.Gain.Value = 42.

This is a real migration cost for any codebase of size, and the repository supplies the tool for finding the sites: run with warnings enabled.

bash
PYTHONWARNINGS=default python script.py

That command is the whole migration aid the README offers. There is no automatic rewrite step documented, so the work is proportional to how many direct feature assignments your code contains. The payoff claimed is typing support, which matters if you rely on an editor or a type checker to catch mistakes in parameter names. Teams that pin an older pypylon and never move will not feel this, but they also will not get the parameter API methods such as ExposureTime.SetToMaximum() or PixelFormat.TrySetValue("Mono8").

Where pypylon is the wrong tool

The clearest limitation is the dependency. The README says installing pylon is strongly recommended but not mandatory and defers to the known issues section, which means the no-pylon path has caveats the Getting Started list does not spell out. If your deployment target cannot carry the pylon runtime, or your platform is not among those pylon supports, the binding's usefulness shrinks.

Platform coverage is a second boundary, and the README is unusually direct about it: the pylon Software Suite may support different operating system versions and features than pypylon, and readers are told to check the release notes of their pylon installation. The example given is pylon Software Suite 26.06 supporting Windows 10/11 64 bit, Linux x86_64 and Linux aarch64 with glibc version >= 2.31 or newer, and macOS Sonoma. A device that pylon supports on a platform pypylon does not build for is not a pypylon device.

Third, this is not the tool for a one-off webcam task. There is no generic USB or V4L2 backend here; the abstraction is pylon. And Data Processing pulls in CodeMeter Runtime for pylon vTools and the Data Processing API extension, which is an extra licensing component on the machine, not a pip dependency.

pypylon against OpenCV's VideoCapture

The natural comparison is OpenCV, because people search for pypylon opencv and because many Python vision pipelines already import cv2. The difference is in what each one owns. cv2.VideoCapture is a generic front end: it opens a device index or a file and hands back frames, and for industrial cameras it typically reaches them through a vendor or platform backend. pypylon is the vendor's own binding, so it exposes pylon parameters directly, including the CParameter-derived methods, and it can run pylon Data Processing recipes that were authored in the pylon Workbench.

That difference cuts both ways. With pypylon you get parameter access that a generic capture object does not model: setting Width to its maximum, choosing Mono8 through TrySetValue, reading exposure through GetValueOrDefault. You also get the GenDC handling the README describes. What you give up is portability. A pipeline written on cv2.VideoCapture can be pointed at a file or a different camera class; a pipeline written on InstantCamera is bound to pylon and to Basler devices. The pragmatic pattern is to use pypylon for acquisition and convert the array into whatever the rest of the stack expects, rather than expecting pypylon to be the whole pipeline.

Maintenance, releases and licence

pypylon is not archived, and the last push was on 2026-09-07. The release cadence visible in the repository is monthly: 26.6 on 2026-07-02, 26.7 on 2026-07-23 and 26.8 on 2026-09-07. That cadence is the upgrade cost. Because it tracks the pylon Software Suite, a pypylon upgrade can arrive alongside a pylon upgrade, and the 26.6 entry shows the project is willing to deprecate API surface in a minor-numbered release while telling readers to consult changelog.txt for the affected areas.

The build configuration shows the supported Python floor indirectly: cibuildwheel skips cp38-*, and the Windows and macOS builds target cp39, with MIN_PY_VER_FOR_LIMITED_API set to "3.9". Wheels are built for AMD64 on Windows and for x86_64 and arm64 on macOS, and the macOS arm64 override expects PYLON_FRAMEWORK_ARM64 to point at an arm64 pylon.framework or falls back to /Library/Frameworks.

pypylon is BSD-3-Clause. That covers this binding, not the pylon Software Suite you install alongside it, and not CodeMeter Runtime, which the README lists as a prerequisite for pylon vTools and the Data Processing API extension. Those are separate products with their own terms, so read them rather than assuming the binding's licence settles the deployment question.

Editorial conclusion

Adopt pypylon if your acquisition stack is already Basler hardware and you want the parameter API, the InstantCamera context manager and pylon Data Processing recipes from Python. Do not adopt it as a generic camera library for non-Basler devices; the binding is tied to pylon. Verify first that the pylon Software Suite version you install supports your operating system and that your code uses the new cam.Gain.Value assignment style, since 26.6 deprecates direct assignment and the README points to the changelog for the full list of affected areas.

Frequently asked questions

Is Pylon software free?

The repository does not state pricing for the pylon Software Suite, and pypylon itself is BSD-3-Clause. The README only says to install pylon from baslerweb.com and lists CodeMeter Runtime as a prerequisite for pylon vTools and the Data Processing API extension. Check Basler's own product pages for the terms that apply to pylon.

What is Pylon software?

In this repository pylon refers to the Basler pylon Software Suite, the C++ APIs that pypylon binds to. The README recommends installing it before pypylon and notes that its operating system support may differ from pypylon's.

What is a pylon viewer?

The repository mentions the pylon Viewer Workbench as the graphical editor used to create image processing designs, and the pylon Workbench as the tool for building designs with a graphical editor. A recipe file created there is loaded by pylondataprocessing.Recipe.Load, as in the README's barcode.precipe example.

how to install pypylon

The README's Getting Started list says to install pylon from baslerweb.com, then run pip3 install pypylon, then look at samples/pylon/grab/grab.py. Installing pylon is strongly recommended but not mandatory, and the README points to its known issues section for the consequences.

how to use pypylon

The README's snippet creates a pylon.InstantCamera with pylon.FirstFound inside a with statement, sets camera.Width.TrySetToMaximum(), starts grabbing with StartGrabbingMax(100) and retrieves results in a while camera.IsGrabbing() loop. Image data is reached through grab_result.GetFirstImageDataComponent().Array.

Official sources

  1. basler/pypylon on GitHub
  2. License: BSD-3-Clause
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/basler-pypylon.svg)](https://hysenlabs.com/projects/basler-pypylon)