Skip to main content

CLI for reading and writing Lake Shore 336 controller zone tables

Project description

lakeshore-zonewriter

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.0.tar.gz (14.0 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.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lakeshore_zonewriter-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 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.0.tar.gz
Algorithm Hash digest
SHA256 b3b265545951f1fdf3d05bfadb46552512d4b2b6de54c97cdc1337f587a38fb0
MD5 49f7ecff32bd8242ace45f587c558e55
BLAKE2b-256 8d6fba76acec769b84f72ac364688fb8805e90e2cee2623ee028eb8fb8e1d345

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lakeshore_zonewriter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02c573f669e455c1fa8a47b650788f8471acfa9caac0828187c96069c5d57434
MD5 c856cd9901eda616316306411065a70d
BLAKE2b-256 0a0afa6c6169fb526b2306ab8c2e1adb69efe73d0248fb5177b49a4d3e398242

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