This is a script that fixes shortcommings in the existing iron-stubs output, as of 7/5/2023.
Right now, iron-stubs gets types right in the comments it adds, but not the code. It also produces
stubs that have a lot of type errors, and no import statements.
To fix this, this script will re-write the functions and classes with correct syntax.
It will also go through every type in every function, property, and class, and look
for it in all the other stubs files in the same root. If it finds the class in another stub file,
it will add an import statement at the top of the file. Note that it will use the first class
definition it finds, so if names are not unique and you want to limit the stubs folders it looks through,
remove the unwanted stubs folders. In my case, all the external references were from System
If it does not find a class's inherited class in the current file, another stubs file, or
the builtin types, it will omit that inherited class from the revised code.
This code is not super well written (sorry) (...or commented), but as of now it creates stub files that are
100% warning- and error-free.
Compared to the current repo, I rebuilt my System stubs like this to get the latest datatypes:
C:\'Program Files'\'IronPython 2.7'\ipy.exe -m ironstubs make mscorlib --path="C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
How to use this script:
Put this script in the root of the stubs directory.
You will be prompted for the name of the Stubs folder that you want to clean up.
Path syntax is currently handled for Windows (i.e. ), but can be easily fixed for linux
This is a script that fixes shortcommings in the existing iron-stubs output, as of 7/5/2023.
Right now, iron-stubs gets types right in the comments it adds, but not the code. It also produces stubs that have a lot of type errors, and no import statements.
To fix this, this script will re-write the functions and classes with correct syntax.
It will also go through every type in every function, property, and class, and look for it in all the other stubs files in the same root. If it finds the class in another stub file, it will add an import statement at the top of the file. Note that it will use the first class definition it finds, so if names are not unique and you want to limit the stubs folders it looks through, remove the unwanted stubs folders. In my case, all the external references were from System
If it does not find a class's inherited class in the current file, another stubs file, or the builtin types, it will omit that inherited class from the revised code.
This code is not super well written (sorry) (...or commented), but as of now it creates stub files that are 100% warning- and error-free.
Compared to the current repo, I rebuilt my System stubs like this to get the latest datatypes: C:\'Program Files'\'IronPython 2.7'\ipy.exe -m ironstubs make mscorlib --path="C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
How to use this script: Put this script in the root of the stubs directory. You will be prompted for the name of the Stubs folder that you want to clean up. Path syntax is currently handled for Windows (i.e. ), but can be easily fixed for linux
written by Mike Reilly mreilly92@gmail.com