Skip to content

Commit

Permalink
Update config docs and release workflow (#111)
Browse files Browse the repository at this point in the history
* ci: Bump commitizen pre-commit version.

* ci: Add new job to the official release workflow that will add a summary with the release level input to make reviewing a deployment easier.

* ci: Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11.

* docs: Add a code example of passing in config options in a dataclass via a keyword argument when initializing the `DeviceManager`.

* docs: Add email address to security policy.
  • Loading branch information
nfelt14 authored Dec 4, 2023
1 parent a18cc9f commit 9deab77
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ on:
concurrency:
group: pypi
jobs:
print-inputs:
runs-on: ubuntu-latest
steps:
- name: Create summary of workflow inputs
run: |
echo "### inputs" >> $GITHUB_STEP_SUMMARY
echo "- release_level: ${{ inputs.release_level }}" >> $GITHUB_STEP_SUMMARY
# This job requires a Personal Access Token (Classic) with
# the public_repo permission. It also needs a private/public
# ssh key pair that can be used for signing. The public key must
# be attached to the account as an SSH signing key.
pypi-version:
name: Update package version
needs: [print-inputs]
if: github.repository == 'tektronix/tm_devices' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: package-release-gate
Expand Down Expand Up @@ -82,7 +90,7 @@ jobs:
name: Packages
path: dist
- name: Upload package to Test PyPI
uses: pypa/[email protected].10
uses: pypa/[email protected].11
with:
repository-url: https://test.pypi.org/legacy/
upload-pypi:
Expand All @@ -100,7 +108,7 @@ jobs:
name: Packages
path: dist
- name: Upload package to PyPI
uses: pypa/[email protected].10
uses: pypa/[email protected].11
upload-github:
name: Upload package to GitHub Release
needs: [upload-pypi]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
name: Packages
path: dist
- name: Upload package to Test PyPI
uses: pypa/[email protected].10
uses: pypa/[email protected].11
with:
repository-url: https://test.pypi.org/legacy/
test-pypi-install:
Expand Down
2 changes: 1 addition & 1 deletion .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: 3.12.0
rev: v3.13.0
hooks:
- id: commitizen
stages: [commit-msg]
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

## Reporting a Vulnerability

Please reach out directly to the maintainers to report a
Please reach out directly to the maintainers at [email protected] to report a
potential vulnerability. **Do not file a public issue.**
21 changes: 19 additions & 2 deletions examples/miscellaneous/adding_devices.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
"""An example of adding devices via Python code."""
from tm_devices import DeviceManager
from tm_devices.helpers import PYVISA_PY_BACKEND, SerialConfig, SYSTEM_DEFAULT_VISA_BACKEND
from tm_devices.helpers import (
DMConfigOptions,
PYVISA_PY_BACKEND,
SerialConfig,
SYSTEM_DEFAULT_VISA_BACKEND,
)

with DeviceManager(verbose=True) as device_manager:
# Specific config options can optionally be passed in when creating
# the DeviceManager via a dataclass, they are used to update any existing
# configuration options from a config file.
CONFIG_OPTIONS = DMConfigOptions(
setup_cleanup=True, # update the value for this option, all other options will remain untouched
)


# Create the DeviceManager, turning on verbosity and passing in some specific configuration values.
with DeviceManager(
verbose=True, # optional argument
config_options=CONFIG_OPTIONS, # optional argument
) as device_manager:
# Explicitly specify to use the system VISA backend, this is the default,
# **this code is not required** to use the system default.
device_manager.visa_library = SYSTEM_DEFAULT_VISA_BACKEND
Expand Down

0 comments on commit 9deab77

Please sign in to comment.