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. ASRL resources, including the Model 336 USB virtual serial port, default to 57,600 baud, 7 data bits, odd parity, 1 stop bit, no flow control, and CR/LF message termination.

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

If a controller is configured differently, override the serial baud rate:

lakeshore-zonewriter export --resource ASRL3::INSTR --baud-rate 9600 --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.2.tar.gz (14.9 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.2-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lakeshore_zonewriter-0.1.2.tar.gz
  • Upload date:
  • Size: 14.9 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.2.tar.gz
Algorithm Hash digest
SHA256 a295d4227d6061a6f6fa06fd70f324072fb1727f3a29bec7cf631dd64b7e39ff
MD5 153e021a60490429d05eb7c16559e18b
BLAKE2b-256 2e91361b4960c74ac2ad6ea77beead806ca9e5a4716c644512556817b335c51b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lakeshore_zonewriter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 60c3d49215afc27bd291b2ed025fe3d51000b0682ecb44394da1d36fa9caa293
MD5 f31fa818c2599acf888afa6a321a8d03
BLAKE2b-256 3d3a9ce4a856a51b0c83be5175284770ead8a357d0208b1821f6e1e422a05f55

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