CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-pynetworktables

tessl install tessl/pypi-pynetworktables@2021.0.0

A pure Python implementation of NetworkTables, used for robot communications in the FIRST Robotics Competition.

Agent Success

Agent success rate when using this tile

75%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.01x

Baseline

Agent success rate without this tile

74%

task.mdevals/scenario-6/

Entry Type Control and Flags

Build a small helper that keeps table entries aligned with supported data types while allowing explicit type overrides and flag configuration for persistence.

Capabilities

Validate supported values

  • Setting a value for a key that is one of the supported data types (bool, number, string, raw bytes, or homogeneous arrays of those) stores it and makes it readable later. @test
  • Passing an unsupported type (e.g., None or a mixed-type list) raises a ValueError without writing to the entry. @test

Override entry type on demand

  • When an entry already exists with a different type, applying an override with allow_retype=True replaces the stored value and updates the entry to the new type. @test
  • With allow_retype=False, attempting to write a different type leaves the previous value untouched and returns that prior value. @test

Manage persistence flags

  • Marking a key as persistent sets the persistent flag, and clearing it removes that flag while leaving the value intact. @test

Implementation

@generates

API

class EntryTypeController:
    def __init__(self, table_path: str): ...

    def set_typed(self, key: str, value):
        """
        Store a value if it matches a supported data type.
        Raises a ValueError for unsupported types.
        """

    def apply_override(self, key: str, value, allow_retype: bool = False):
        """
        Write a value, retyping the entry only when allow_retype is True.
        Returns the value currently stored after the operation.
        """

    def mark_persistent(self, key: str, persistent: bool = True):
        """
        Set or clear persistence on the entry without changing its data.
        """

    def get_value(self, key: str, default=None):
        """
        Read the current value for a key, returning default if the entry is missing.
        """

    def get_flags(self, key: str) -> int:
        """
        Return the current flag bitmask for a key.
        """

Dependencies { .dependencies }

pynetworktables { .dependency }

Robot-oriented networked key-value store with typed entries, force-set overrides, and entry flag controls.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pynetworktables@2021.0.x
tile.json