Skip to main content

A way to create transparent NetworkTables variables

Project description

NTProp

A simple mechanism for using Network Tables entries as semi-transparent member variables

Installation

Using your Python package manager of choice, just install the ntprop package from PyPI.

pip install ntprop

Usage

To start using these, you just need to import NTPropertyHost from ntprop and have your class inherit from it. From there, any member varaible that is of the types NumberProperty, BooleanProperty, or StringProperty (also from ntprop) will act like a simple, strictly-typed member variable that transparently updates and is updated by the relevant NT entry.

Example

from ntprop import NTPropertyHost, NumberProperty

class Foo(NTPropertyHost):
    # for purposes of type-checking here, we could just call this a float, since there's no difference in 
    # usage at runtime. This is only valid if the owning class is an NTPropertyHost.
    bar: NumberProperty

    def __init__(self):
        self.bar = NumberProperty("ntbar", default=1, readonly=False) #defaults are 0.0 and False, respectively

    def do_something(self):
        # += may work?
        self.bar = self.bar + 1 
        print(self.bar)

It's also possible to use an NTProperty without it being a member of ah NTPropertyHost. To do that, you just need to use the get and set methods of the type. NOTE: These methods are not available in NTPropertyHosts since that type already does the necessary calls to get and set behind the scenes and resolves them prior to returning a value.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ntprop-0.1.3.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ntprop-0.1.3-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file ntprop-0.1.3.tar.gz.

File metadata

  • Download URL: ntprop-0.1.3.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.14.4 Darwin/23.4.0

File hashes

Hashes for ntprop-0.1.3.tar.gz
Algorithm Hash digest
SHA256 50c21f3da54613b1c1d402b34948a819265e9e24dc6ba6c7fdc01c7181a9cc26
MD5 f928e924a1caa254f0d12d4b77026344
BLAKE2b-256 5a66b9cebde4e8306492416633d9b4ef7d4b662dc9e79df9000ca8d2b18410f1

See more details on using hashes here.

File details

Details for the file ntprop-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ntprop-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.14.4 Darwin/23.4.0

File hashes

Hashes for ntprop-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62181355f0daee3251adff8e8609425b129414c74182ba0ddc2e56f131e414dd
MD5 721e043ede5fa827a118c789949582f3
BLAKE2b-256 f1d1abe543ac204a62d075b646ce8aac77b5012894fbe320ce746b7fcaff4a61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page