Skip to main content

CLI for reading and writing Lake Shore 336 controller zone tables

Project description

lakeshore-zonewriter

Tests PyPI Python License uv

lakeshore-zonewriter reads and writes Lake Shore 336 controller zone tables using PyVISA. Zone files are TOML so they can be reviewed and edited by hand.

The CLI uses the controller commands documented for the Model 336:

  • Query: ZONE? <output>,<zone>
  • Write: ZONE <output>,<zone>,<upper bound>,<P>,<I>,<D>,<manual output>,<range>,<input>,<rate>

The tool writes zone table data only. It does not change the controller output mode.

Controller connections use a fixed 50 ms interval between requests and a 10 second PyVISA timeout.

Install lakeshore-zonewriter as a CLI Tool using uv

uv tool install lakeshore-zonewriter

After installation, run the installed console script directly. For one-off use without installing, use uvx lakeshore-zonewriter.

Check the installed CLI:

lakeshore-zonewriter --help

List VISA Resources

lakeshore-zonewriter list-resources

Export Zones

Export prompts for Output 1 or 2 if --output is omitted.

lakeshore-zonewriter export --file zones.toml

If --resource is omitted, the CLI opens an interactive terminal dropdown of detected PyVISA resources. In non-interactive shells it falls back to a numbered selection prompt. For scripts, pass both values explicitly:

lakeshore-zonewriter export --resource ASRL3::INSTR --output 1 --file zones.toml

Edit the TOML File

See examples/zones-output1.toml for a sample file.

Each file must contain exactly 10 zone rows. The top-level output field is the write target. The write command does not accept --output, so it cannot override the file. The zones value must use the compact row format shown in the example; [[zones]] table-style entries are not supported.

Valid heater_range values are off, low, medium, and high. Valid control_input values are default, A, B, C, D, D2, D3, D4, and D5 (D2-D5 only for Model 336 with the 3062 option card).

Validate, Diff, and Write

Validate without connecting to hardware:

lakeshore-zonewriter validate --file zones.toml

Compare the controller to the file's output:

lakeshore-zonewriter diff --file zones.toml

Preview writes without changing the controller:

lakeshore-zonewriter write --file zones.toml --dry-run

Write zones from the file:

lakeshore-zonewriter write --file zones.toml

Before writing, the CLI exports a timestamped backup of the current controller zones for the file's output, prints the diff, and asks for confirmation. Use --yes for non-interactive runs.

Test

From a source checkout, install the project environment and run tests:

uv sync
uv run python -m unittest discover -s tests

Release

Use pyproject.toml as the source of truth for the package version. Keep CHANGELOG.md updated by moving notable entries from Unreleased into the new version section.

Release checklist:

  1. Choose the next semantic version.

  2. Update CHANGELOG.md, including the release date.

  3. Bump version in pyproject.toml.

  4. Run tests:

    uv run python -m unittest discover -s tests
    
  5. Build the package:

    uv build
    
  6. Commit the release and create a tag that matches the package version:

    git commit -am "Release X.Y.Z"
    git tag vX.Y.Z
    
  7. Push the commit and tag:

    git push origin main
    git push origin vX.Y.Z
    

Pushing a v* tag runs the release workflow, which tests, builds, publishes to PyPI through trusted publishing, and creates a GitHub Release using the matching CHANGELOG.md section with the built distributions attached.

PyPI publishing requires a trusted publisher for this repository, workflow release.yml, and environment pypi.

License

Apache-2.0. See LICENSE.

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

lakeshore_zonewriter-0.1.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

lakeshore_zonewriter-0.1.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file lakeshore_zonewriter-0.1.1.tar.gz.

File metadata

  • Download URL: lakeshore_zonewriter-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lakeshore_zonewriter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 67fa582cec98cf6b6e86366439308bd6449819ab139fbd58787d0498d7bf7ce0
MD5 159cb17ff71ae7fad26fbc91e565b8d9
BLAKE2b-256 d3de6b47cc91eea2cb151c4cf76b6fadea144614746f774121d63d86523f3d9b

See more details on using hashes here.

File details

Details for the file lakeshore_zonewriter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lakeshore_zonewriter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lakeshore_zonewriter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a834dca5339d2b379b7e9c10834358dd8e43a5e43b7f6a1b26da94b57a25220
MD5 898ad399dfbece73df4912fa59d40dd8
BLAKE2b-256 2705a99252a3e150d1bcfcde512eb7835bb745ca714de6164f486f1552cab282

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