After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 637346 - Adding python-bindings to doxygen
Adding python-bindings to doxygen
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Python Bindings
git-master
Other Linux
: Normal enhancement
: ---
Assigned To: Mark Jenkins
Mark Jenkins
Depends on:
Blocks:
 
 
Reported: 2010-12-15 21:17 UTC by Christoph Holtermann
Modified: 2018-06-29 22:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds simple doxygen-support to the python-bindings (19.27 KB, patch)
2010-12-15 23:18 UTC, Christoph Holtermann
none Details | Review
Adds simple doxygen-support to the python-bindings (19.24 KB, patch)
2010-12-16 17:48 UTC, Christoph Holtermann
committed Details | Review
A second step towards doxygen python-bindings docs (23.52 KB, patch)
2010-12-19 23:21 UTC, Christoph Holtermann
committed Details | Review
A small enhancement, basically mentioning the wiki-page (1.37 KB, patch)
2011-01-18 23:53 UTC, Christoph Holtermann
committed Details | Review

Description Christoph Holtermann 2010-12-15 21:17:15 UTC
This is an attempt to include the python-bindings in the doxygen-documentation.
Comment 1 Christoph Holtermann 2010-12-15 23:18:25 UTC
Created attachment 176509 [details] [review]
Adds simple doxygen-support to the python-bindings
Comment 2 Christoph Holtermann 2010-12-15 23:25:36 UTC
This adds .py and .i files as inputs to doxygen.

Python is not fully supported by doxygen. In the comments that are used inside python which use docstrings it is not possible to use doxygens special commands. These can only be used with comments that are marked with ## or #.

It is possible to use special commands inside the docstrings only when a tool like
doxypy.py is used (http://code.foosel.org/doxypy). This can be set as an input filter to doxygen. It "translates" docstrings to #-comments. So doxygen sees the file through this filters eyes and accepts special commands in docstrings.

I don't know if it's worth the effort to try to implement that. For a beginning staying with this is sufficient.

Please have a look at these deeds and maybe commit one day if you like.
Comment 3 Frank H. Ellenberger 2010-12-16 10:53:39 UTC
Comment on attachment 176509 [details] [review]
Adds simple doxygen-support to the python-bindings

Just a Note:
From README.dependencies:
C++ style comments (`// comment to end of line') are discouraged but
not actively eradicated.

But I am not shure, it this should affect the .py files.
Comment 4 Christoph Holtermann 2010-12-16 11:24:34 UTC
(In reply to comment #3)
> (From update of attachment 176509 [details] [review])
> Just a Note:
> From README.dependencies:
> C++ style comments (`// comment to end of line') are discouraged but
> not actively eradicated.
> 
> But I am not shure, it this should affect the .py files.

Are you talking about this ?

Index: src/optional/python-bindings/timespec.i
===================================================================
...
 // A typemap for converting python dates to Timespec in functions that
 // require Timespec as an argument

I just wonder, because these lines of code are not related to my suggested attaching the bindings to doxygen but something that has already been there. 

Is this a general coding guideline for GnuCash you are speaking about or is this guideline related to doxygen ? In the first case it would be just coincidence that this line was included in the patch, in the second case I would have to have a look at all files that are newly introduced to doxygen.

In the .py files there are no comments like // (also not /* or so ). Python comments are only # like in shell-scripts or """ ... """ as docstrings.

The .i-files I am not so sure about. As far as I understand they are only used as interface-files for SWIG. Timespec.i is such a thing. I could go ahead and change all //-comments to /* and */ even though I didn't write them. I guess it wouldn't do any harm.

I could make a list of all files that are newly introduced by extending the inclusion criteria for doxygen if that is of any help.
Comment 5 Christoph Holtermann 2010-12-16 17:48:17 UTC
Created attachment 176545 [details] [review]
Adds simple doxygen-support to the python-bindings

Update reflects changes in src/optional/python-bindings/example_scripts/price_database_example.py. I had to modify that part of the patch manually for it is not yet in svn, but surely will be earlier than this one. I hope it works.

To be pedantic : The patch also includes corrections for some spelling mistakes I came across in the python-bindings ;-)
Comment 6 Christoph Holtermann 2010-12-17 12:05:14 UTC
I put a version of doxygen including this patch online on
http://www.gnucash.holtermann7.de/index.html

New page Python-bindings: http://www.gnucash.holtermann7.de/python-bindings-page.html
Added group python-bindings: http://www.gnucash.holtermann7.de/group__python-bindings.html
Added group python-bindings-examples as a subgroup of python-bindings: http://www.gnucash.holtermann7.de/group__python-bindings-examples.html
Comment 7 Christian Stimming 2010-12-17 20:37:21 UTC
Comment on attachment 176545 [details] [review]
Adds simple doxygen-support to the python-bindings

Sounds good, and it also doesn't interfere with the upcoming 2.4.0 release. I got one rejected patch for src/optional/python-bindings/example_scripts/price_database_example.py but the rest is committed.
Comment 8 Christian Stimming 2010-12-17 20:37:56 UTC
... and I committed the patch as r19956. Thanks a lot!
Comment 9 Christoph Holtermann 2010-12-19 23:12:04 UTC
(In reply to comment #8)
> ... and I committed the patch as r19956. Thanks a lot!

Thank you very much !
Comment 10 Christoph Holtermann 2010-12-19 23:21:22 UTC
Created attachment 176731 [details] [review]
A second step towards doxygen python-bindings docs

* doxygen_mainpage.c : Put reference to python-bindings to it's alphabetical place
* Rename all - to _ : python-bindings -> python_bindings - That's because doxygen at http://svn.gnucash.org/docs/HEAD/
does not like the minus signs and sometimes just takes the first part. With my local version which is 1.7 this doesn't happen.
* Move the base of documentation from gnucash_core.py to a separate file : src/doc/python-bindings-doxygen.c
* Add that file to src/doc/Makefile.am - EXTRA_DIST
* Extend the doc - Add some mre details to explain SWIGs working process.
Comment 11 Christoph Holtermann 2010-12-19 23:59:42 UTC
I also put this 2nd Version online, see Comment 6 https://bugzilla.gnome.org/show_bug.cgi?id=637346#c6
Comment 12 Christian Stimming 2010-12-20 10:09:25 UTC
Comment on attachment 176731 [details] [review]
A second step towards doxygen python-bindings docs

Very good explanation! Also, feel free to reorder to gnucash docs mainpage in other ways as well. E.g., the python page link may appear completely separated from the "modules" enumeration because python bindings are a different thing... but in any case your patch is a big improvement and can be committed immediately.
Comment 13 Christian Stimming 2010-12-27 15:36:23 UTC
Comment on attachment 176731 [details] [review]
A second step towards doxygen python-bindings docs

r19981, thanks!
Comment 14 Christoph Holtermann 2010-12-29 19:54:47 UTC
Thank you very much for committing !

One file is missing, though : src/doc/python-bindings-doxygen.py. I created it new in the 2nd patch. It's in the patch as I just checked, I didn't forget it. It contains the main part of the documentation which is at the moment missing in doxygen.
Comment 15 Christian Stimming 2010-12-29 20:55:16 UTC
r19991, thanks for noting this. (In git patches the addition of new files is noted as well; in plain patches this isn't always immediately visibile and you might need to point it out extra as well.)
Comment 16 Christoph Holtermann 2011-01-18 23:53:25 UTC
Created attachment 178676 [details] [review]
A small enhancement, basically mentioning the wiki-page
Comment 17 Christian Stimming 2011-01-20 20:21:24 UTC
Comment on attachment 178676 [details] [review]
A small enhancement, basically mentioning the wiki-page

r20127, thanks!
Comment 18 John Ralls 2018-06-29 22:49:29 UTC
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=637346. Please continue processing the bug there and please update any external references or bookmarks.