Skip to main content

Python wrapper for the uhubctl project.

Project description

Project generated with PyScaffold PyPI-Server Coveralls

PyHubCtl

Python wrapper for the uhubctl project.

Quick Start

Installation

pyhubctl requires uhubctl to be installed and on PATH for your system. Follow the guide provided by uhubctl here: https://github.com/mvp/uhubctl#compiling

Attempts to run this library without proper installation of uhubctl will result in errors being thrown.

Install from PyPI:

pip install pyhubctl

Install from source:

git clone https://github.com/DuraTech-Industries/pyhubctl.git
cd pyhubctl
pip install .

Quick Start

pyhubctl has two main classes for use: PyHubCtl and Configuration. They’re both pretty self-explanatory, but PyHubCtl is what you use to run uhubctl, and Configuration is what you use to configure how uhubctl runs.

Configuration contains attributes that correspond directly to the arguments uhubctl expects. Pass an instance of this class to the run method of PyHubCtl. This run method will return what uhubctl outputs, or raise an error if something went wrong.

As an example, here is how you might toggle all of the ports on a USB-hub:

from pyhubctl import Configuration, PyHubCtl

phc = PyHubCtl()
phc.run(Configuration(location="1-4"))

Or a specific set of ports:

from pyhubctl import Configuration, PyHubCtl

phc = PyHubCtl()
phc.run(Configuration(location="1-4", ports="3,4"))

Making Changes & Contributing

This project uses pre-commit, please make sure to install it before making any changes:

pip install pre-commit
cd pyhubctl
pre-commit install

It is a good idea to update the hooks to the latest version:

pre-commit autoupdate

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

pyhubctl-1.0.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

pyhubctl-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pyhubctl-1.0.0.tar.gz.

File metadata

  • Download URL: pyhubctl-1.0.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for pyhubctl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 476fe1e3de021d02c9b916550c163043842c55a43122cd43cdf635a9bd62f69b
MD5 05983cf0feb46d8de3629f05cce0927d
BLAKE2b-256 80e40247939ed306bf40c2844fd3c3ae16d5a15e4f99e5b8893a0d564251fc2e

See more details on using hashes here.

File details

Details for the file pyhubctl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyhubctl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for pyhubctl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bbc7c14c7319b487112b4fe9b3c2c9aaba6863377d878901ca694093558a434
MD5 61712bf61388374edc5e5ee8ed67e205
BLAKE2b-256 44faa4743fdc2505f70e761cb035c2292917dc17c893b5bb2ace457da911eeb8

See more details on using hashes here.

Supported by

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