VarianAPIs / PyESAPI

Python interface to Eclipse Scripting API
MIT License
69 stars 32 forks source link
medical-physics python

PyESAPI

"Pi-e-Sappy" for research use only.

A passion project to help accelerate breakthroughs in medical physics research by bringing the power of Python into the Varian API ecosystem. PyESAPI combined with Jupyter Notebook gives you a "command line to Eclipse" allowing you to rapidly prototype your ESAPI scripts or research ideas.

Quick Start (updated July 17th 2024)

Examples

Jupyter Notebooks (from Developer Workshop 2018)

Additional Resources

PyESAPI wraps the official ESAPI interface, so a majority of the guidance on ESAPI caries over.

Known issues

Upgrading

Recommended tooling:

Now that you've had a chance to explore the capabilities of PyESAPI, it's time to get more organized. Below are some recommendations on platforms and software to develop with.

Development Notes

For those wishing to contribute to PyESAPI or use PyESAPI with pre-released local builds of Eclipse.

Custom ESAPI DLL path

Set custom ESAPI_PATH (to DLLs) before import (bypasses production directory path search)

import os
os.environ['ESAPI_PATH'] = r'C:\Users\CoolKid\Source\Magic\Bin\Debug64'
import pyesapi
# ...

Stub Gen (experimental/under construction)

To create lintable code and enable code completion (in Visual Studio Code at least) we can generate python stubs for ESAPI libs using IronPython...

  1. Download and install IronPython (2.7.9 tested to work) in default location (C:\Program Files\IronPython 2.7\ipy.exe).
  2. Load ironpython-stubs submodule git submodule update --init (ironstubs)
  3. Move to stubgen folder cd stubgen
  4. Execute script stubgen.ps1 (if you hit a Pdb prompt, type continue)
  5. Commit updates to stubs folder