FellowTraveler / Open-Transactions-old

Open-Transactions democratizes financial and monetary actions. You can use it for issuing currencies/stock, paying dividends, creating asset accounts, sending/receiving digital cash, writing/depositing cheques, cashier's cheques, creating basket currencies, trading on markets, scripting custom agreements, recurring payments, escrow, etc. Open-Transactions uses strong crypto. The balances are unchangeable (even by a malicious server.) The receipt history is destructible. The transactions are unforgeable. The cash is unlinkable. The cheques are non-repudiable. Etc.
http://opentransactions.org
408 stars 84 forks source link

generate python docstrings with SWIG (it only takes one line) #120

Closed ehmry closed 11 years ago

ehmry commented 12 years ago

I've found that if you throw a little feature line into swig/otapi/OTAPI.i you get some nice argument documentation in your python wrapper,

%include "std_string.i";
%include "typemaps.i"

%feature("autodoc","1") ;  // <----------- add this

// ---------------------------------------------------------------

and instead of this:

Type:       builtin_function_or_method
String Form:<built-in function OT_API_withdrawVoucher>
Docstring:  <no docstring>

you get this:

Type:       function
String Form:<function OT_API_withdrawVoucher at 0x2f7e050>
File:       /usr/lib64/python2.7/site-packages/otapi.py
Definition: otapi.OT_API_withdrawVoucher(*args)
Docstring:
OT_API_withdrawVoucher(char const * SERVER_ID, char const * USER_ID, char const * ACCT_ID, char const * RECIPIENT_USER_ID, 
    char const * CHEQUE_MEMO, char const * AMOUNT) -> int