pyufunc.cvt_py_to_dll#
- pyufunc.cvt_py_to_dll(py_file, output_dir='')#
Convert a Python file to a DLL using Cython and setuptools.
- Parameters:
- Raises:
ValueError – If the provided file is not a .py or .pyx file.
FileNotFoundError – If the DLL file is not found after conversion.
Notes
The function uses Cython to compile the Python file into a shared library (DLL).
It creates a temporary directory to perform the conversion and cleans it up afterwards.
The output DLL will have the same name as the input Python file (without extension).
Example
>>> import pyufunc as pf >>> pf.cvt_py_to_dll('example.py', output_dir='output_directory') >>> # This will convert 'example.py' to 'example.pyd (Windows)/example.so (Linux or Macos)'. >>> import example # Now you can import the compiled module as a regular Python module.
- Returns:
True if the conversion was successful, False otherwise.
- Return type: