API Documentation

ironpycompiler.detect

Module for detecting where the IronPython executables exist.

ironpycompiler.detect.auto_detect()[source]

Decide the optimum version of IronPython in your system.

This function decides the most suitable version of IronPython in your system for the version of CPython on which IronPyCompiler is being run, and returns a tuple showing its version number and its location (the path to the IronPython directory).

Example: On CPython 2.7, first this function searches for IronPython 2.7. If this fails, then the newest IronPython 2.x in your system will be selected.

Return type:tuple
Raises ironpycompiler.exceptions.IronPythonDetectionError:
 if this function could not decide the optimum version

New in version 0.9.0.

ironpycompiler.detect.detect_ipy(regkeys=['SOFTWARE\\IronPython', 'SOFTWARE\\Wow6432Node\\IronPython'], executable='ipy.exe')[source]

This function returns the list of the paths to the IronPython directories.

This function searches in the Windows registry and PATH for IronPython.

Parameters:
  • regkeys (list) – (optional) The IronPython registry keys that should be looked for.
  • executable (str) – (optional) The name of the IronPython executable.
Return type:

list

Raises ironpycompiler.exceptions.IronPythonDetectionError:
 

if IronPython cannot be found

Changed in version 0.9.0: This function now calls search_ipy().

Warning

This function is deprecated, and will be removed in the next major version. Please use search_ipy().

ironpycompiler.detect.search_ipy(regkeys=None, executable='ipy.exe')[source]

Search for IronPython directories.

This function searches for IronPython directories using both search_ipy_env() and search_ipy_reg(), and returns a dictionary showing the versions of IronPython and their locations (the paths to the IronPython directories).

Parameters:
  • executable (str) – (optional) The name of the IronPython executable.
  • regkeys (list) – (optional) The IronPython registry keys that should be looked for.
Return type:

dict

New in version 0.9.0.

Changed in version 0.10.1: Solved the problem that the default value for the argument regkeys was mutable.

ironpycompiler.detect.search_ipy_env(executable='ipy.exe')[source]

Search for IronPython directories included in the PATH variable.

This function searches for IronPython executables in your system, reading the PATH environment variable, and gets their version numbers, executing the executables.

This function returns a dictionary showing the versions of IronPython and their locations (the paths to the IronPython directories).

Parameters:executable (str) – (optional) The name of the IronPython executable.
Return type:dict
Raises ironpycompiler.exceptions.IronPythonDetectionError:
 if IronPython cannot be found

New in version 0.9.0.

ironpycompiler.detect.search_ipy_reg(regkeys=None)[source]

Search for IronPython regisitry keys.

This function searches for IronPython keys in the Windows registry, and returns a dictionary showing the versions of IronPython and their locations (the paths to the IronPython directories).

Parameters:regkeys (list) – (optional) The IronPython registry keys that should be looked for.
Return type:dict
Raises ironpycompiler.exceptions.IronPythonDetectionError:
 if IronPython keys cannot be found

New in version 0.9.0.

Changed in version 0.10.1: Solved the problem that the default value for the argument regkeys was mutable.

ironpycompiler.compiler

Module for analyzing and compiling IronPython scripts.

class ironpycompiler.compiler.ModuleCompiler(paths_to_scripts, ipy_dir=None, pyc_path=None)[source]

This class finds the modules required by your script and create a .NET assembly.

By default this class searches for pure-Python modules in the IronPython standard library and the CPython site-packages directory.

Parameters:
  • paths_to_scripts (list) – Specify the paths to your scripts. In creating a .EXE file, the first element of this list must be the path to the main file of your project.
  • ipy_dir (str) – Specify the IronPython directory, or it will be automatically detected using ironpycompiler.detect.auto_detect().
  • pyc_path (str) – (optional) Specify the path to pyc.py.

Changed in version 0.10.0: The argument pyc_path was added.

builtin_modules = None

Set of the names of built-in modules.

call_pyc(args, delete_resp=True, executable='ipy.exe', cwd=None)[source]

Call pyc.py in order to compile your scripts.

In general use this method is not supposed to be called directly. It is recommended that you use create_asm() instead.

Parameters:
  • args (list) – Specify the arguments that should be sent to pyc.py.
  • delete_resp (bool) – (optional) Specify whether to delete the response file after compilation or not.
  • executable (str) – (optional) Specify the name of the Ironpython exectuable.
  • cwd (str) – (optional) Specify the current working directory.
check_compilability(dirs_of_modules=None)[source]

Check the compilability of the modules required by the scripts you specified.

Parameters:dirs_of_modules (list) – Specify the paths of the directories where the modules your scripts require exist, or this method searches for pure-Python modules in the IronPython standard library, and the CPython site-packages directory.
compilable_modules = None

Set of the paths to required and compilable modules.

create_asm(out=None, target_asm='dll', target_platform=None, embed=True, standalone=True, mta=False, delete_resp=True, executable='ipy.exe', copy_ipydll=False)[source]

Compile your scripts into a .NET assembly, using pyc.py.

Parameters:
  • out (str) – (optional) Specify the name of the EXE file that should be created, or the name of the main script will be used and the destination directory will be the current directory.
  • target_asm (str) – (optional) The type of the output assembly, can be “dll”, “exe”, or “winexe”. By default a .DLL file will be created.
  • target_platform (str) – (optional) Specify the target platform (“x86” or “x64”) if necessary (exe/winexe).
  • embed (bool) – (optional) Specify whether to embed the generated DLL into the executable (exe/winexe).
  • standalone (bool) – (optional) Specify whether to embed IronPython assemblies into the executable (exe/winexe).
  • mta (bool) – (optional) Specify whether to set MTAThreadAttribute (winexe).
  • delete_resp (bool) – (optional) Specify whether to delete the response file after compilation or not.
  • executable (str) – (optional) Specify the name of the Ironpython exectuable.
  • copy_ipydll (bool) – (optional) Specify whether to copy the IronPython DLL files into the destination directory.
create_dll(out=None, delete_resp=True, executable='ipy.exe')[source]

Compile your scripts into a DLL file (.NET library assembly) using pyc.py.

Parameters:
  • out (str) – (optional) Specify the name of the DLL file that should be created.
  • delete_resp (bool) – (optional) Specify whether to delete the response file after compilation or not.
  • executable (str) – (optional) Specify the name of the Ironpython exectuable.

Warning

This method is deprecated, and will be removed in the next major version. Please use create_asm() instead.

create_executable(out=None, winexe=False, target_platform=None, embed=True, standalone=True, mta=False, delete_resp=True, executable='ipy.exe')[source]

Compile your scripts into an EXE file (.NET process assembly) using pyc.py.

Parameters:
  • out (str) – (optional) Specify the name of the EXE file that should be created.
  • winexe (bool) – (optional) Specify whether to create a windows executable or to generate a console one, or a console executable will be created.
  • target_platform (str) – (optional) Specify the target platform (“x86” or “x64”) if necessary.
  • embed (bool) – (optional) Specify whether to embed the generated DLL into the executable.
  • standalone (bool) – (optional) Specify whether to embed IronPython assemblies into the executable.
  • mta (bool) – (optional) Specify whether to set MTAThreadAttribute (winexe).
  • delete_resp (bool) – (optional) Specify whether to delete the response file after compilation or not.
  • executable (str) – (optional) Specify the name of the Ironpython exectuable.

Warning

This method is deprecated, and will be removed in the next major version. Please use create_asm() instead.

output_asm = None

The path to the main output assembly.

pyc_stdout = None

Standard output from pyc.py.

uncompilable_modules = None

Set of the names of required but uncompilable modules.

ironpycompiler.compiler.gather_ipydll(dest_dir, ipy_dir=None)[source]

Copy the IronPython DLL files into the directory specified.

Parameters:
  • dest_dir (str) – The path of the destination directory.
  • ipy_dir (str) – Specify the path of the IronPython directory, or it will be detected using ironpycompiler.detect.auto_detect().

New in version 0.9.0.

Changed in version 0.10.0: This function now uses ironpycompiler.detect.auto_detect() instead of ironpycompiler.detect.detect_ipy().

ironpycompiler.exceptions

This module contains execptions of IronPyCompiler.

exception ironpycompiler.exceptions.IPCError[source]

This is the base class for exceptions in this module.

exception ironpycompiler.exceptions.IronPythonDetectionError(executable=None, msg=None)[source]

This exception will be raised when IronPython cannot be found in your system.

Parameters:
  • executable (str) – (optional) The name of the IronPython executable looked for. This argument remains for backward compatibility.
  • msg – (optional) The detailed information of the error.

Changed in version 0.9.0: The argument executable became optional, and the argument msg was added.

exception ironpycompiler.exceptions.ModuleCompilationError(msg=None)[source]

This exception means an error during compilation.

Parameters:msg – (optional) The detailed information of the error.

New in version 0.10.0.

ironpycompiler.constants

Constants for IronPyCompiler.

ironpycompiler.constants.EXECUTABLE = 'ipy.exe'

The default name of the IronPython executable.

ironpycompiler.constants.REGKEYS = ['SOFTWARE\\IronPython', 'SOFTWARE\\Wow6432Node\\IronPython']

The default IronPython registry keys.

Table Of Contents

Previous topic

Command-line Tool

This Page