GnuCash
2.6.99
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
python-bindings-doxygen.py
Go to the documentation of this file.
1
## @file
2
# @brief Documentation file for GnuCashs python bindings, input file for doxygen.
3
#
4
# This file holds the more explanatory parts of the doxygen-source-documentation.
5
# You will find the contents at @ref python_bindings_page.
6
#
7
# @par To-Do:
8
# @li Work out the relation of scheme/guile and python-bindings
9
# @li maybe join python_bindings_page and group
10
# @li work on the structure of the documentation to make it more clear
11
# @li try to make SWIG include the documentation of the c-source
12
# @li make function-links in SWIG-generated files work.
13
# @li some words to the tests
14
#
15
# @author Christoph Holtermann
16
# @date December 2010
17
# @ingroup python_bindings
18
19
20
## @defgroup python_bindings Python Bindings Module
21
# Also have a look at the page @ref python_bindings_page.
22
23
## @defgroup python_bindings_examples Python Bindings Examples Module
24
# @ingroup python_bindings
25
# The python-bindings come with quite a lot of example scripts.
26
27
## @page python_bindings_page Python bindings
28
# Also have a look at group @ref python_bindings.
29
#
30
# They can be found in src/optional/python-bindings.
31
#
32
# To enable them in the compilation process you have to add --enable-python-bindings
33
# to the call of ./configure.
34
#
35
# As a starting point have a look at the \link python_bindings_examples example-scripts\endlink.
36
#
37
# @section possibilities What are the Python bindings good for ?
38
#
39
# The python bindings supply the ability to access a wide range of the core functions of GnuCash. You
40
# can read and write Transactions, Commodities, Lots, access the business stuff... You gain the ability
41
# to manipulate your financial data with a flexible scripting language.
42
#
43
# Not everything GnuCash can is possible to access though. The bindings focus on basic accounting functions.
44
# Have a look at the examples to get an impression.
45
#
46
# @section python_bindings_section Principles
47
# The python-bindings are generated using SWIG from parts of the source-files of GnuCash.
48
#
49
# @note Python-scripts should not be executed while GnuCash runs. GnuCash is designed as
50
# a single user application with only one program accessing the data at one time. You can force your
51
# access but that may corrupt data. Maybe one day that may change but for the moment there is no active development on that.
52
#
53
# @subsection swigworks What SWIG does
54
#
55
# SWIG extracts informations from the c-sources and provides access to the structures
56
# to python. It's work is controlled by interface files :
57
#
58
# @li gnucash_core.i
59
# @li timespec.i
60
# @li glib.i
61
# @li @link base-typemaps.i src/base-typemaps.i @endlink This file is shared with Guile.
62
#
63
# it outputs:
64
#
65
# @li gnucash_core.c
66
# @li gnucash_core_c.py
67
#
68
# If you have generated your own local doxygen documentation (by "make doc") after having compiled the python-bindings, doxygen
69
# will include SWIGs output-files.
70
# It's actually quite interesting to have a look at them through doxygen, because they contain all that you can
71
# access from python.
72
#
73
# This c-style-api is the bottom layer. It is a quite raw extract and close to the original source. Some more details are described further down.
74
#
75
# For some parts there is a second layer of a nice pythonic interface. It is declared
76
# in
77
# @li gnucash_core.py and
78
# @li gnucash_business.py.
79
# @li function_class.py contains helper functions for that.
80
#
81
# @section howto How to use the Python bindings
82
# @subsection highlevel High level python wrapper classes
83
# If you
84
#
85
# @code >> import gnucash @endcode
86
#
87
# You can access the structures of the high level api. For Example you get a Session object by
88
#
89
# @code >> session=gnucash.Session() @endcode
90
#
91
# Here you will find easy to use things. But sometimes - and at the current level rather sooner than
92
# later - you may be forced to search for solutions at the :
93
#
94
# @subsection c_style_api C-style-api
95
#
96
# If you
97
#
98
# @code >> import gnucash @endcode
99
#
100
# The c-style-api can be accessed via gnucash.gnucash_core_c. You can have a look at all the possibilities
101
# at gnucash_core_c.py.
102
#
103
# You will find a lot of pointers here which you can just ignore if input and output of the function have the
104
# same type.
105
#
106
# For example you could start a session by gnucash.gnucash_core_c.qof_session_begin(). But if you just try
107
#
108
# @code session=gnucash.gnucash_core_c.qof_session_begin() @endcode
109
#
110
# you will get an error message and realize the lack of convenience for you have to add the correct function parameters.
111
#
112
# Not all of the available structures will work. SWIG just takes everything from the sources that it is fed with and translates it. Not everything
113
# is a working translation, because not everything has been worked through. At this point you are getting closer to the developers who you can
114
# contact at the mailing-list
[email protected]
. There may be a workaround. Maybe the problem can only be fixed by changing SWIGs input
115
# files to correctly translate the c-source. Feel free to post a question at the developers list. It may awaken the interest of someone who creates
116
# some more beautiful python-interfaces.
117
#
118
# @section Thisorthat When to use which api ?
119
#
120
# The start would surely be the high-level api for you can be quite sure to have something working and you will maybe find
121
# explanations in the example-scripts. If you search for something that is not yet implemented in that way you will have to
122
# take your way to the c-style-api.
123
#
124
# @section pydoc (Further) documentation
125
#
126
# @li The documentation you just read uses doxygen. It collects documentation in GnuCash's sources. Besides that there is
127
# @li the classic python-documentation using help() and docstrings. Have a look at both.
128
# @li There is a page in the GnuCash wiki at http://wiki.gnucash.org/wiki/Python
129
# @li You may also have a look into the archives of
[email protected]
.
130
# @li On Bugzilla there is also some interesting talk regarding the development process.
131
# @li Then you can use the abilities of svn to see the history of the code by @code svn log @endcode done in the directory of the python-bindings.
132
#
Generated by
1.8.6