Skip to main content

PyObjectInterface

Tests Badge Python Version Badge License Badge

Quickly control any python object through an async web interface.

pip install PyObjectInterface

from PyObjectInterface.WebController import create_WebController
import flask

app = flask.Flask('Demo')
any_python_object = ...
create_WebController(any_python_object, 'any_python_object', app)
app.run()

Go to http://127.0.0.1:5000/webcontroller

Example: Async Robot Control

async_robot_control.png

The above interface was automatically created from:

class DriveMotor:
    def __init__(self, pin):
        self.pin = pin
        self.speed = 0

    def forward(self): ...
    def stop(self): ...

class Robot:
    def __init__(self):
        self.left_motor = DriveMotor(1)
        self.right_motor = DriveMotor(2)

    def forward(self): ...
    def stop(self): ...
    def left(self): ...
    def right(self): ...

Look at PyObjectInterface/examples/example.py for more information.

Advanced Usage and Settings

You can use PyObjectInterface without the WebController.

create_WebController

  • obj: Any python object
  • name: str: Friendly name for object, generally the name of the variable that refers to the object
  • flask_app: return value of flask.Flask()
  • recursion_depth = 5: maximum layers of subobjects to include
  • create_private_interface = True: if True creates a /webcontroller/private page that includes private methods and attributes

Modifying Attributes

By default, POI treats NoneType, bool, int, float, str, list, dict, tuple, and set as primitive types. These show up in the attribute table instead of as recursive objects.

numpy.ndarray, pandas.DataFrame, and pandas.Series are also treated as primitives.

Note: numpy 2.0 arrays currently do not work with python's inspect library, and therefore must be treated as a primitive. For Python >= 3.13 on windows, numpy >= 2.0 must be used.

If you would like to customize this behavior, you can modify PyObjectInterface.basic_attribute_types

For example:

from PyObjectInterface import basic_attribute_types

class My_Class_A: ...
class My_Class_B: ...
class My_Class_C: ...

basic_attribute_types[str(type(My_Class_A()))] = False
basic_attribute_types[str(type(My_Class_B()))] = True

My_Class_A will be treated as a primitive and only show up in the attributes table. My_Class_B will also show up in attributes table, but it still appears in the subobjects section. My_Class_C will only appear in the subobjects section.

Metadata

Release files for PyObjectInterface 0.1.3

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

Source distribution (sdist)

Source distribution for PyObjectInterface 0.1.3
File Size Uploaded Provenance
pyobjectinterface-0.1.3.tar.gz 8.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for PyObjectInterface 0.1.3
File Interpreter ABI Platform
pyobjectinterface-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / pyobjectinterface-0.1.3.tar.gz

Download URL pyobjectinterface-0.1.3.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8e3ec570c1689016c0ba6b36783d5433900956a04c2926ec9a428d513d1e69f5
BLAKE2b-256 checksum
How to use checksums
20e19f552180b36c26f8688a6852ecdcd3825bd92cdab3fa1a50a316c5679df0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pyobjectinterface-0.1.3-py3-none-any.whl

Download URL pyobjectinterface-0.1.3-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
588b78ed349a852fd3efdcabd93e0c62ca6134685725685dcfc5807a1ca62cc9
BLAKE2b-256 checksum
How to use checksums
707b15a5ab04b9f68bf673b9f380a5e8acddb73314ad1b4468bc7f6b05c7b1e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for PyObjectInterface 0.1.3

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.

No provenance found

None of the files in this release were uploaded with 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.

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