Skip to main content

Tool for control of test and measurement instruments in Python

Project description

InsPy

Links

Table of Contents

Installation

Command line

pip install cc-inspy

To check your install in command line run:

inspy --version

And as always you can get help:

inspy --help

To interface an instrument using USB on Windows, install Keysight IO Libraries Suite.

If you are running InsPy on Linux and want to connect your device via USB, then you also have to do the following:

sudo tee /etc/udev/rules.d/99-inspy.rules > /dev/null <<'EOF'
SUBSYSTEM=="usb", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="xxxx", MODE="0660", GROUP="plugdev"
EOF
sudo usermod -aG plugdev "$USER"
sudo udevadm control --reload-rules && sudo udevadm trigger

This is to make it so that inspy (and pyVISA) can see your USB device.

Wheel

  1. Download the wheel from the InsPy Releases page.
  2. pip install cc-inspy-*-py3-none-any.whl

pyproject.toml

Add 'inspy' to the list of dependencies, for example:

[project]
dependencies = [
    "cc-inspy"
]

requirements.txt

Add the following to your requirements.txt:

cc-inspy==1.0.0

(replace the version number with the desired version - versions can be identified via the tags)

Uv package manager

  1. Add InsPy as a project dependency uv add cc-inspy.
  2. Run uv sync to install all dependencies.

Development

See below for information on how to setup a local development environment, contribute to the project, run tests, and build documentation.

Setup

Ensure you have uv and Git installed.

To get setup using InsPy:

  1. Clone this repository: git clone https://github.com/cambridgeconsultants/inspy.git
  2. Navigate back to the inspy repo and install:
cd inspy
uv sync
  1. Reload your IDE (VSCode: Ctrl+Shift+P and enter Developer: Reload Window) (this may be required when you make changes to your editable)

  2. Check editable installed by entering the following terminal command - the inspy version should be returned:

uv run inspy --version

And you should see it auto complete will the modules in the package. If not, check the correct venv is selected (Ctrl+Shift+P Python: Select Interpreter)

Contributing

To add instruments and develop on this project, please follow the instructions in CONTRIBUTING.md in the repository root.

Testing and test development

We use pytest for writing and running tests. Tests should live in a separate file for each instrument, and separately from the development code.

Test files and test functions must start with the prefix test_, for example test_oscilloscope_<model_no>.py, containing test_get_voltage.

Example:

# test_oscilloscope_<model_no>.py
def test_get_voltage():
    """Dummy test."""
    assert True

You can run these tests using the commands:

  • uv run pytest to run all test files in the project (bear in mind many tests need real instruments to be connected so they may fail) - not recommended.
  • uv run pytest test_file_name.py to run all tests in a specific file. This can be run on multiple files in one line too.
  • uv run pytest test_file_name.py::test_func for a specific test in that file.

Releases

When there's a commit to main signifying a release, a versioned tag will be added e.g., v2.0. The built package is then stored in the GitHub releases using the versioned release tag.

Building the docs

sphinx-build -b html ./docs ./docs/_build/html -W

You can then open _build/html/index.html in your browser. In windows you can run:

start docs/_build/html/index.html

Getting Started

Now you have installed InsPy, check out the quick start guide

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


🔝 Back to top

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

cc_inspy-1.0.0.tar.gz (166.3 kB view details)

Uploaded Source

Built Distribution

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

cc_inspy-1.0.0-py3-none-any.whl (73.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cc_inspy-1.0.0.tar.gz
  • Upload date:
  • Size: 166.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_inspy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8c9c627bc239c777a7027b83b7cf2a057568ab4c78582d8c7f98d64e60a03c44
MD5 47ffa3d68b1d92405fa1a560d6a94a55
BLAKE2b-256 f3ef84ebf4c09b7ca62ec1426fa68e9c060afe1665f761f265d1ba79839466e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_inspy-1.0.0.tar.gz:

Publisher: base.yml on cambridgeconsultants/InsPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: cc_inspy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 73.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_inspy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6868d7a5b940f3a278ebab12b27062acbc42d1555b8e7eef634444d5104ae2a5
MD5 955aaabe53f6df8fa3d97e9727750252
BLAKE2b-256 a4e214a178bf5b940d7575673dd09b921415dee4442d3785bc23b50c21701a18

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_inspy-1.0.0-py3-none-any.whl:

Publisher: base.yml on cambridgeconsultants/InsPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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