Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,30 @@ 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...
To create lintable code and enable code completion (in Visual Studio Code at least) we can generate python stubs for ESAPI libs using multiple approaches:

### Method 1: IronPython Assembly Introspection (Recommended)
1. [Download](https://ironpython.net/download/) and install IronPython (2.7.9 tested to work) in default location (C:\Program Files\IronPython 2.7\ipy.exe).
1. Load ironpython-stubs submodule `git submodule update --init` (ironstubs)
1. Move to stubgen folder `cd stubgen`
1. Execute script `stubgen.ps1` (if you hit a Pdb prompt, type continue)
1. Commit updates to stubs folder

### Method 2: CHM Documentation Extraction
If you have access to ESAPI CHM help files:
1. Move to stubgen folder `cd stubgen`
1. Run CHM converter: `.\chm_to_stubs.ps1 -ChmPath "C:\Path\To\ESAPI.chm" -OutputDir "chm_stubs"`
1. Review and integrate generated stubs

See [stubgen/README.md](stubgen/README.md) for detailed instructions.


## 2025 Upgrades
* structures masks
* intellisense (stubs for v18, at least)
* HU on CT (non-breaking)
* ImageGeo to pass into _like functions

## Future
* support model evaluation
* fast approx dose
6 changes: 2 additions & 4 deletions pyesapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@
from .stubs.VMS.TPS.Common.Model.API import *

from .stubs import System
from .stubs.System.Collections.Generic import Dictionary
from .stubs.System import Array, Int32, Double

# for numpy array interfacing
# from .stubs.System.Windows import Point
from .stubs.System import Array, Int32, Double
# from .stubs.System.Runtime.InteropServices import GCHandle, GCHandleType # TODO: these are missing from type stubs
from .stubs.System.Runtime.InteropServices import GCHandle, GCHandleType

else:
# enforce single thread apartment mode:
Expand Down
142 changes: 0 additions & 142 deletions pyesapi/stubs/Microsoft/CSharp.py

This file was deleted.

149 changes: 0 additions & 149 deletions pyesapi/stubs/Microsoft/VisualBasic.py

This file was deleted.

Loading
Loading