Skip to content

Commit

Permalink
Merge branch 'tektronix:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nfelt14 authored Mar 28, 2024
2 parents 5c1bb72 + 49e87e9 commit ea8adcd
Show file tree
Hide file tree
Showing 867 changed files with 2,417 additions and 1,522 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download Artifact
uses: dawidd6/[email protected].2
uses: dawidd6/[email protected].4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/[email protected].1
- uses: hynek/[email protected].2
id: build-pkg
- name: Set up Python
uses: actions/setup-python@v5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
python scripts/check_unreleased_changelog_items.py
git config --global tag.gpgSign true
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@v9.1.1
uses: python-semantic-release/python-semantic-release@v9.3.1
id: release
with:
force: ${{ inputs.release_level }}
Expand All @@ -82,7 +82,7 @@ jobs:
ref: main # Make sure to check out the latest commit on main, not the original commit that triggered the workflow
fetch-depth: 0
- name: Build package
uses: hynek/[email protected].1
uses: hynek/[email protected].2
upload-testpypi:
name: Upload package to TestPyPI
needs: [pypi-build]
Expand All @@ -98,7 +98,7 @@ jobs:
name: Packages
path: dist
- name: Upload package to Test PyPI
uses: pypa/[email protected].11
uses: pypa/[email protected].14
with:
repository-url: https://test.pypi.org/legacy/
upload-pypi:
Expand All @@ -116,7 +116,7 @@ jobs:
name: Packages
path: dist
- name: Upload package to PyPI
uses: pypa/[email protected].11
uses: pypa/[email protected].14
upload-github:
name: Upload package to GitHub Release
needs: [upload-pypi]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python scripts/project_version.py --set-version=$NEW_VERSION
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Build package
uses: hynek/[email protected].1
uses: hynek/[email protected].2
outputs:
built-version: ${{ steps.create-version.outputs.NEW_VERSION }}
test-pypi-upload:
Expand All @@ -50,7 +50,7 @@ jobs:
name: Packages
path: dist
- name: Upload package to Test PyPI
uses: pypa/[email protected].11
uses: pypa/[email protected].14
with:
repository-url: https://test.pypi.org/legacy/
test-pypi-install:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/sbom-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
jobs:
create-and-scan-sbom:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -31,7 +33,13 @@ jobs:
sbom: ${{ github.event.repository.name }}-sbom.spdx.json
fail-build: true
severity-cutoff: low
- name: Upload SBOM scan SARIF report
- name: Upload SBOM scan SARIF report as a workflow artifact
uses: actions/upload-artifact@v4
with:
name: sarif_artifact
path: ${{ steps.scan.outputs.sarif }}
if-no-files-found: error
- name: Upload SBOM scan SARIF report to GitHub UI Security tab
if: ${{ github.event_name != 'pull_request' }}
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install --upgrade tox coverage
- name: Test
run: tox -ve tests
- uses: actions/upload-artifact@v4
Expand All @@ -67,13 +67,14 @@ jobs:
.results_*/**
.coverage*
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./.coverage_tests.xml
name: codecov-${{ matrix.os_name }}
fail_ci_if_error: true
verbose: true
# Check that all jobs passed
check-tests-passed:
if: ${{ !cancelled() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18 # The node version needs to stay in sync with .readthedocs.yml
node-version: 20 # The node version needs to stay in sync with .readthedocs.yml
- run: npm install -g @mermaid-js/mermaid-cli
- run: sudo apt install --no-install-recommends --assume-yes graphviz
- name: Set up Python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
update-python-and-pre-commit-deps:
name: Update python linters and pre-commit dependencies
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.head_ref, '/pip/') }}
if: ${{ github.actor == 'dependabot[bot]' && contains(github.head_ref, '/pip/') }}
permissions:
contents: write
steps:
Expand All @@ -22,7 +22,7 @@ jobs:
python-version: x # any version
check-latest: true
- name: Install workflow dependencies
run: pip install poetry yamlfix toml-sort requests pre-commit-update
run: pip install poetry yamlfix toml-sort requests pre-commit-update pre-commit
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.TEK_OPENSOURCE_GPG_SIGNING_KEY_PRIVATE }}
Expand All @@ -31,6 +31,10 @@ jobs:
git_commit_gpgsign: true
- name: Run updater script
run: python scripts/update_development_dependencies.py --no-install
- name: Run pre-commit
env:
SKIP: pylint,pyright,pyright-verifytypes,pyroma
run: python -m pre_commit run --all
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'ci: Update python linters and pre-commit dependencies.'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
dist*/
downloads/
eggs/
.eggs/
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
- id: check-github-actions
- id: check-github-workflows
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.16.0
rev: v3.20.0
hooks:
- id: commitizen
stages: [commit-msg]
Expand Down Expand Up @@ -125,7 +125,7 @@ repos:
always_run: true
args: [., --min=10]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build:
os: ubuntu-22.04
tools:
python: '3.11' # This needs to stay in sync with pyproject.toml and any CI scripts
nodejs: '18' # This needs to stay in sync with any CI scripts
nodejs: '20' # This needs to stay in sync with any CI scripts
jobs:
post_install: [npm install -g @mermaid-js/mermaid-cli]
# Configuration
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ ______________________________________________________________________

Things to be included in the next release go here.

### Changed

- Updated the `get_model_series()` function to only warn the user if the model is not found in the `SupportedModels` enumeration. This also eliminates false warnings during unit tests.

### Fixed

- Updated the measurement source selection command for the MDO3K, MDO4K, MSO4K and DPO4K models to work properly.

______________________________________________________________________

## v1.2.1 (2024-02-27)
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This file only contains a selection of the most common options. For a full list see the
documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html
"""

import os
import shutil

Expand Down
10 changes: 4 additions & 6 deletions docs/contributing/add_new_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,17 @@ This guide will walk through the steps needed to add a new device driver.
`tm_devices/drivers/__init__.py`
07. Update the `__all__` variable inside `tm_devices/drivers/__init__.py` to
include the new device driver
08. Update the appropriate Type Alias in `device_manager.py` (search for "Type
Aliases")
09. If the device supports VISA USBTMC communication, update the
08. If the device supports VISA USBTMC communication, update the
`USB_MODEL_ID_LOOKUP` lookup exposed in `tm_devices/helpers/__init__.py`
10. Update the Supported Devices section in `README.rst` to include the new model
11. Update unit tests (and simulated device files)
09. Update the Supported Devices section in `README.rst` to include the new model
10. Update unit tests (and simulated device files)
1. Add a new simulated device driver in the correct folder within
`tests/sim_devices`
2. Update `tests/sim_devices/devices.yaml` with a new resource for the new
driver (Make sure the device name is correct in the `devices.yaml` and in
the corresponding simulated device file)
3. Update `tests/test_all_device_drivers.py` with the new simulated resource
12. Run the `tests/verify_physical_device_support.py` script targeting a
11. Run the `tests/verify_physical_device_support.py` script targeting a
physical device that will use the newly created driver to verify it is
working properly.

Expand Down
1 change: 1 addition & 0 deletions examples/miscellaneous/adding_devices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example of adding devices via Python code."""

from tm_devices import DeviceManager
from tm_devices.helpers import (
DMConfigOptions,
Expand Down
1 change: 1 addition & 0 deletions examples/miscellaneous/adding_devices_with_env_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
These environment variables are settable outside Python code, usually they are set in the shell used
to execute the Python script.
"""

import os

from tm_devices import DeviceManager
Expand Down
1 change: 1 addition & 0 deletions examples/miscellaneous/alias_usage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example of alias usage."""

from tm_devices import DeviceManager

with DeviceManager(verbose=True) as dm:
Expand Down
5 changes: 3 additions & 2 deletions examples/miscellaneous/custom_device_driver_support.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example of external device support via a custom driver."""

from tm_devices import DeviceManager
from tm_devices.drivers import MSO5
from tm_devices.drivers.pi.scopes.scope import Scope
Expand All @@ -23,9 +24,9 @@ def custom_method(self, value: str) -> None:

with DeviceManager(external_device_drivers=CUSTOM_DEVICE_DRIVERS) as device_manager:
# Add a scope that is currently supported by the package
mso5: MSO5 = device_manager.add_scope("192.168.0.1") # pyright: ignore[reportAssignmentType]
mso5: MSO5 = device_manager.add_scope("192.168.0.1")
# Add the custom scope
custom_scope: CustomScope = device_manager.add_scope("192.168.0.2") # pyright: ignore[reportAssignmentType]
custom_scope: CustomScope = device_manager.add_scope("192.168.0.2")

# Custom drivers inherit all methods
custom_scope.expect_esr(0) # check for no errors
Expand Down
5 changes: 3 additions & 2 deletions examples/miscellaneous/disable_command_verification.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""An example showing how to disable the verification portion of the ``.set_and_check()`` method."""

from tm_devices import DeviceManager
from tm_devices.drivers import MSO5, SMU2601B

with DeviceManager(verbose=True) as dm:
# Add some devices
scope: MSO5 = dm.add_scope("192.168.0.1") # pyright: ignore[reportAssignmentType]
smu: SMU2601B = dm.add_smu("192.168.0.2") # pyright: ignore[reportAssignmentType]
scope: MSO5 = dm.add_scope("192.168.0.1")
smu: SMU2601B = dm.add_smu("192.168.0.2")

#
# Set some values and use verification to verify they were set properly.
Expand Down
1 change: 1 addition & 0 deletions examples/miscellaneous/pyvisa_resource_access.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Directly access the PyVISA resource object."""

from tm_devices import DeviceManager

with DeviceManager() as device_manager:
Expand Down
1 change: 1 addition & 0 deletions examples/miscellaneous/register_dm_atexit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example showing how to register the DeviceManager to close on program exit."""

import atexit

from tm_devices import DeviceManager
Expand Down
1 change: 1 addition & 0 deletions examples/miscellaneous/visa_connection_selectivity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example script to choose visa from different visa resources."""

from tm_devices import DeviceManager
from tm_devices.helpers import PYVISA_PY_BACKEND, SYSTEM_DEFAULT_VISA_BACKEND

Expand Down
1 change: 1 addition & 0 deletions examples/scopes/tekscope/basic_curve_query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example showing a basic curve query."""

from tm_devices import DeviceManager

EXAMPLE_CSV_FILE = "example_curve_query.csv"
Expand Down
3 changes: 2 additions & 1 deletion examples/scopes/tekscope/basic_save_recall.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""An example of saving and recalling a waveform and session file."""

from tm_devices import DeviceManager
from tm_devices.drivers import MSO6B

with DeviceManager(verbose=True) as dm:
# Get a scope
scope: MSO6B = dm.add_scope("192.168.1.177") # pyright: ignore[reportAssignmentType]
scope: MSO6B = dm.add_scope("192.168.1.177")

# Send some commands
scope.add_new_math("MATH1", "CH1") # add MATH1 to CH1
Expand Down
3 changes: 2 additions & 1 deletion examples/scopes/tekscope/generate_internal_afg_signal.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""An example showing how to generate a signal using the scope's internal AFG."""

from tm_devices import DeviceManager
from tm_devices.drivers import MSO5

with DeviceManager(verbose=True) as dm:
# Create a connection to the scope and indicate that it is a MSO5 scope for type hinting
scope: MSO5 = dm.add_scope("192.168.1.102") # pyright: ignore[reportAssignmentType]
scope: MSO5 = dm.add_scope("192.168.1.102")

# Generate the signal
scope.commands.afg.frequency.write(10e6) # set frequency
Expand Down
3 changes: 2 additions & 1 deletion examples/scopes/tekscope/get_acquisition_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example script for connecting and configuring scope for acquisition."""

from tm_devices import DeviceManager
from tm_devices.drivers import MSO6B
from tm_devices.helpers import PYVISA_PY_BACKEND
Expand All @@ -12,7 +13,7 @@
device_manager.visa_library = PYVISA_PY_BACKEND

# Creating Scope driver object by providing ip address.
scope: MSO6B = device_manager.add_scope("127.0.0.1") # pyright: ignore[reportAssignmentType]
scope: MSO6B = device_manager.add_scope("127.0.0.1")

# Turn on channel 1
scope.commands.display.waveview1.ch[1].state.write("ON")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An example of adding dpojet measurements and plots."""

from tm_devices import DeviceManager
from tm_devices.drivers import MSO70KDX
from tm_devices.helpers import PYVISA_PY_BACKEND
Expand All @@ -12,7 +13,7 @@
device_manager.visa_library = PYVISA_PY_BACKEND

# Creating one 7K/70K/SX Scope driver object by providing ip address.
scope: MSO70KDX = device_manager.add_scope("127.0.0.1") # pyright: ignore[reportAssignmentType]
scope: MSO70KDX = device_manager.add_scope("127.0.0.1")

# Starting DPOJET
scope.commands.dpojet.activate.write()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Main code starts here with instantiation of the device manager and the SMU instrument connection.
devmgr = DeviceManager(verbose=True)
smu2400: SMU2450 = devmgr.add_smu("192.168.0.1", alias="my2450") # pyright: ignore[reportAssignmentType]
smu2400: SMU2450 = devmgr.add_smu("192.168.0.1", alias="my2450")
smu2400.enable_verification = False

# Capture the path to the script file and load it to working memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tm_devices.drivers import SMU2450

with DeviceManager(verbose=False) as device_manager:
inst: SMU2450 = device_manager.add_smu("192.168.1.4", alias="my2450") # pyright: ignore[reportAssignmentType]
inst: SMU2450 = device_manager.add_smu("192.168.1.4", alias="my2450")

# Reset the instrument, which also clears the buffer.
inst.commands.reset()
Expand Down
Loading

0 comments on commit ea8adcd

Please sign in to comment.