autowrap.pynih.wrap

Wrapping functionality for D to Python.

Members

Functions

addConstants
void addConstants(PyObject* pythonModule)
Undocumented in source. Be warned that the author may not have intended to support it.
createDlangPythonModule
auto createDlangPythonModule()

Initialises the Python DateTime API, the druntime, and creates the Python extension module

createPythonModule
auto createPythonModule()

Reflects on the modules given and creates a Python module called libraryName with wrappers for all of the functions and types in each of the modules.

createPythonModuleMixin
string createPythonModuleMixin()

Returns a string with the module creation function for Python, i.e. the Python extension module's entry point. Needs to be a string mixin since Python knows which function is the entry point by name convention, where an extension module called "foo" needs to export a function PyInit_foo. "All" this function does is create a function with the appropriate name and stringify the arguments to pass to the function doing the heavy lifting: createPythonModule.

wrapDlang
string wrapDlang()

Returns a string to mixin that implements the necessary boilerplate to create a Python library containing one Python module wrapping all relevant D code and data structures.

Imports

No (from std.typecons)
public import std.typecons : Yes, No;
Undocumented in source.
Yes (from std.typecons)
public import std.typecons : Yes, No;
Undocumented in source.

Static variables

PyDateTimeAPI
PyDateTime_CAPI* PyDateTimeAPI;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

Ignore (from autowrap.types)
struct Ignore via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;

Used in a module to ignore certain symbols

LibraryName (from autowrap.types)
struct LibraryName via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;

The name of the dynamic library, i.e. the file name with the .so/.dll extension

Module (from autowrap.types)
struct Module via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;

A module to automatically wrap. Usually not needed since a string will do, but is useful when trying to export all functions from a module by using Module("mymodule", Yes.alwaysExport) instead of "mymodule"

Modules (from autowrap.types)
struct Modules via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;

The list of modules to automatically wrap for consumption by other languages.

PostModuleInitCode (from autowrap.types)
struct PostModuleInitCode via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;

Code to be inserted after the call to module_init

PreModuleInitCode (from autowrap.types)
struct PreModuleInitCode via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;

Code to be inserted before the call to module_init

RootNamespace (from autowrap.types)
struct RootNamespace via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;
Undocumented in source.

Templates

aggregates
template aggregates(modules...)

The D aggregates (structs/classes/enums) to be wrapped for Python. "Returned" as python.boilerplate.Aggregates

cfunctions
template cfunctions(modules...)

The C functions that Python is actually going to call, of the type PyObject* (PyObject* args, PyObject* kwargs). "Returned" as python.boilerplate.CFunctions, obtained by reflecting on the passed-in modules and synthethising the necessary functions by doing all conversions automatically.

isModule (from autowrap.types)
template isModule(alias T) via public import autowrap.types : Modules, Module, isModule, LibraryName, PreModuleInitCode, PostModuleInitCode, RootNamespace, Ignore;
Undocumented in source.
toCFunction
template toCFunction(alias functionSymbol, string identifier = "")

Converts from mirror.meta.reflection.FunctionSymbol to the template CFunction from python.boilerplate. The reason identifier defaults to an empty string is because otherwise it doesn't compile if a regular D function symbol is passed.

toCFunction
template toCFunction(alias F, string identifier = __traits(identifier, F).toSnakeCase)
Undocumented in source.

Meta