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.4.tar.gz (2.3 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.4-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ntprop-0.1.4.tar.gz
  • Upload date:
  • Size: 2.3 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.4.tar.gz
Algorithm Hash digest
SHA256 21f4ab7837de0e8f3620f56b9b552aea92984974715548805764eb1adc7f87c9
MD5 ab5b4fe7748d3069302d012a08e6d62c
BLAKE2b-256 05fe62715e7bdd28f1c84b3584284a23d0adcae623dba36ac07c6701437f4998

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ntprop-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f98ed3c7d875e4dbd9f63036dbbbacf97f7f1e0074ff9929616fbabd17b619f6
MD5 a7eec1b07457fb59c7cf93cc6cd9211e
BLAKE2b-256 b9f881b41a70a3c8ac41b8fc216cb77ba59cdce2176dd38fb50bf2e0f0a46d34

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