CARVIEW |
Select Language
HTTP/2 200
date: Sat, 19 Jul 2025 22:12:23 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"467bde8b9958a8705b74b5e63579f7f1"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=3uC%2B2quxO7nGu%2BzAvlA3XiQzxBK4Fnd0Kn2MzDKTFfzOOrfZdGd5G%2B8r8eQdpRnlVWkIQQaBE8ePjqzJ1LrD0jAmbTYzaNfno9IhOgGyiyrJaXzlC6XWvqRcOjPupuK64ZIVv3XY3Q019Kajgke%2FEo1xa%2Bjrg3goXTmyiVw7Ku87%2Buw47VRzcXBtMyIv7Xxrj5tfdavV2XV1WXnzqJ6coNi840uPa6wc7HYgcj%2FQJ87cTmGuDVJRp0%2F8bH84%2BzF03Z6L6GR0maOFtZ0ev637Pw%3D%3D--6CmGp1qHIaYBpth%2F--M%2BQI6SARNhCub2OySBQz6g%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1179951497.1752963142; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 22:12:22 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 22:12:22 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C982:AA839:87A5E8:ACE3D2:687C1846
Home · pothosware/PothosPython Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Josh Blum edited this page Sep 8, 2017
·
14 revisions
The Pothos Python toolkit is a component of the Pothos data-flow framework. This toolkit brings Python language support to the Pothos ecosystem, with support for:
- Calling into Python from the Pothos Proxy API
- Calling into the Pothos Proxy API from Python
- Pythonic wrappers for making Blocks in Python
- Python development environment (version 2.7 and up)
- Numpy to support array math in custom Blocks
The Python API for creating Blocks is almost identical to the C++ API.
- For more details about a particular API feature, visit the Blocks coding guide.
- For Python examples of the Block API, see this project's Test blocks module.
- The test blocks demonstrate stream buffers, signals, slots, labels, and messages.
The following example shows how to make a simple project (3 files) that builds and installs a block written in Python. The block will be accessible through the Pothos block registry and available in the graphical design tool.
A simple adder block (MyAdder.py):
import Pothos """/* |PothosDoc My Adder Add two input streams, produce an output stream. |category /Math |param dtype[Data Type] The input and output data type. |default "float32" |widget DTypeChooser(float=1,cfloat=1,int=1,cint=1,dim=1) |preview disable |factory /my_package/adder(dtype) */""" class Adder(Pothos.Block): def __init__(self, dtype): Pothos.Block.__init__(self) self.setupInput(0, dtype) self.setupInput(1, dtype) self.setupOutput(0, dtype) def work(self): #how many elements to process? n = self.workInfo().minElements #grab the input and output ports inPort0 = self.input(0) inPort1 = self.input(1) outPort = self.output(0) #grab the input and output buffers in0 = inPort0.buffer() in1 = inPort1.buffer() out = outPort.buffer() #perform arithmetic out[:n] = in0[:n] + in1[:n] #produce and consume elements inPort0.consume(n) inPort1.consume(n) outPort.produce(n)
Make this directory into a module (__init__.py):
from . MyAdder import Adder
The build script for the block (CMakeLists.txt):
######################################################################## # Project setup ######################################################################## cmake_minimum_required(VERSION 2.8.9) project(MyBlocks) enable_language(CXX) find_package(Pothos CONFIG REQUIRED) include(PothosPythonUtil) ######################################################################## ## Build and install ######################################################################## POTHOS_PYTHON_UTIL( TARGET MyAdderBlock SOURCES __init__.py MyAdder.py FACTORIES "/my_package/adder:Adder" DESTINATION MyPackage ENABLE_DOCS )
- Finally, follow the regular build and install instructions from the Coding Guide to make this new block available to the framework: https://github.com/pothosware/PothosCore/wiki/BlocksCodingGuide#building-and-installing
- Project overview
- Getting started
- FAQ
- Video screencasts
- Demo applications
- Features summary
- Versioned releases
- Miscellaneous links
- Help and support
- Pothos users' group
- Twitter @pothosware
- IRC chat #pothos
- Slack workspace
- Contract services
- Developer blog
- Contributing
- Donate
- Build guide
- GUI Tutorial
- SDR Tutorial
- Filter Tutorial
- Doxygen docs
- PothosUtil Guide
- Blocks coding guide
- Scheduler explained
- Remote control guide
- Extending serialization
Clone this wiki locally
You can’t perform that action at this time.