pbp_include.h
Go to the documentation of this file.
1/** @file pbp_include.h Includes all luabindings plug-in headers */
2
3/*
4 ****************************************************
5 Convenience header file that includes all headers
6 relevant to the pybindings plug-in.
7
8 (c) Thomas Moor 2023 - 2026
9 ****************************************************
10 */
11
12
13#ifndef FAUDES_PBP_INCLUDE_H
14#define FAUDES_PBP_INCLUDE_H
15
16// include all headers for this plugin
17#include "pbp_addons.h"
18
19
20/**
21
22@defgroup PybindingsPlugin Python Bindings Plug-In
23
24
25@ingroup AllPlugins
26
27<p>
28This plug-in implements libFAUDES bindings for the scripting language
29<a href="https://www.python.org">Python</a>.
30Relevant libFAUDES data types and functions as documented via the <a href="https://fgdes.tf.fau.de/faudes/reference">libFAUDES User Reference</a>
31can be accessed from within the Python interpreter.
32For user documentation/introduction specifically for the faudes Python module,
33see the
34<a href="https://fgdes.tf.fau.de/faudes/pythonmod">libFAUDES Python API</a>.
35<p>
36
37
38</p>
39The most convenient method
40to make the faudes Python module available is to install it via <tt>pip</tt>; i.e., for
41Linux and macOS
42</p>
43
44@code{.unparsed}
45$ pip install faudes
46$ python3 -c "import faudes; print(faudes.Version())"
47@endcode
48
49or, for native Windows
50
51@code{.unparsed}
52> py -m pip install faudes
53> py -c "import faudes; print(faudes.Version())"
54@endcode
55
56<p>
57This will search the index <a href="https://pypi.org/project/faudes/">PyPI</a>
58for a binary distribution that fits your platform/archirectur. In the case
59no such matching binary is present, please let us know. Instructions on how
60to compile your own binary are below.
61</p>
62
63
64
65
66@subsection SecPybindingsIntro1 Example Script
67
68@code{.unparsed}
69# load libFAUDES bindings
70from faudes import *
71
72# test
73Version()
74Build()
75
76# instantiate generator from Python lists
77g = Generator.NewFromLists(
78 delta=[
79 ['idle', 'alpha', 'busy'],
80 ['busy', 'beta', 'idle']],
81 Q0 =[ 'idle' ],
82 Qm =[ 'idle' ]
83)
84
85# show on console
86g.Write()
87
88# show graphically, i.e., in Jupyter notebook
89g.GraphShow()
90@endcode
91
92<p>
93Note: for graphics output you must have installed <tt>dot</tt> from the GraphViz package.
94If <tt>dot</tt> is not in the systems path, you may direct libFAUDES via
95</p>
96
97@code{.unparsed}
98DocPath("/wherever_dot_is/dot").
99@endcode
100
101
102
103@subsection SecPybindingsIntro3 Building the libFAUDES Python Modeul
104
105<p>
106The faudes Python module consists of the glue code <tt>faudes.py</tt> and a suitably
107extended libFAUDES shrared object <tt>_faudes.so</tt> (or <tt>_faudes.pyd</tt> for Windows).
108Both files are generated by the libFAUDES build system; see
109<a href="../faudes_build.html">build-system documentation</a> for details.
110Manualy copying/renaming both files to a project folder enables the import of the
111faudes module from Python scripts in that folder.
112</p>
113
114<p>
115Example for the overall build process incl. copy/rename:
116<p>
117
118@code{.unparsed}
119./libFAUDES$ make dist-clean
120./libFAUDES$ make -j configure
121./libFAUDES$ make -j
122./libFAUDES$ cp plugings/pybindings/obj/faudes.py whereever/
123./libFAUDES$ cp plugings/pybindings/obj/_faudes.so whereever/
124./libFAUDES$ cd whereever
125./whereever$ python3 -c "import faudes; print(faudes.Version())"
126@endcode
127
128<p>
129The above method is specifically recommended for MSYS environments where pip install
130from PyPI.org will fail.
131</p>
132
133
134@subsection SecPybindingsIntro4 Building the Module as Python Wheel
135
136<p>
137A <i>Python wheel</i> is an archive in a clearly defined format/layout which
138among others facilitates binary distribution of Python extenstions e.g. via PyPI.org.
139The libFAUDES build system has the dedicated target <tt>pybindings-wheel</tt>
140that utilises the Python module <tt>build</tt> to generate a Python wheel
141<tt>faudes-*.whl</tt>. The latter can be installed via <tt>pip</tt>.
142The benefit of this approach is that Python <tt>build</tt> takes care of matching
143toolchains etc. and that after installing the the module files do not need
144to be copied to each relevant project folder.
145The downside is that Python <tt>build</tt> wont use parallel jobs and therefore
146can take quite some time.
147</p>
148
149<p>
150Example for the overall build process incl. installation:
151<p>
152
153@code{.unparsed}
154./libFAUDES$ make dist-clean
155./libFAUDES$ make -j configure
156./libFAUDES$ make pybindings-wheel
157./libFAUDES$ pip install faudes-2.34.0-cp314-cp314-macosx_10_15_universal2.whl
158@endcode
159
160<p>
161Alternatively, you may download the configured source from PyPI and invoke <tt>build</tt>
162directly; e.g. for Windows with official Python distribution and MSVC installed
163</p>
164@code{.unparsed}
165./faudes-2.34> py -m build --wheel --outdir=./
166@endcode
167
168
169<p>
170Again, this method is of specific interest for MSYS environments where pip install
171from PyPI.org will fail. You will need to install the matching Python module <tt>build</tt>
172via the MSYS package manager <tt>pacman</tt>.
173</p>
174
175
176@subsection PyLicense License
177
178The Python bindings plug-in is distributed with libFAUDES.
179All code is provided under terms of the LGPL.
180
181
182Copyright (c) 2023 - 2026 Thomas Moor.
183
184
185
186*/
187
188
189
190#endif

libFAUDES 2.34g --- 2026.04.09 --- c++ api documentaion by doxygen