Re: Boost/Python

2018-01-11 Thread John Ralls
It might indeed work. The core devs are focussed on other priorities ATM so if 
you’d like to work it out we’ll look forward to your PR.

Regards,
John Ralls

> On Jan 11, 2018, at 1:30 AM, Alen Siljak <alen.sil...@gmx.com> wrote:
> 
> From my limited knowledge of Python, this sounds like something that could be 
> mitigated by a virtual environment, perhaps?
>  
> In that case, there could be the "officially-supported" version of Python so 
> an advanced user would have to set up the virtual environment with that 
> version, etc. etc.
>  
> Do you think this would be an option?
>  
> Currently I'll dig a bit into the c# option but would still somehow prefer to 
> work in Python, if/when possible.
>  
> Cheers
>  
> Sent: Thursday, January 11, 2018 at 2:59 AM
> From: "John Ralls" <jra...@ceridwen.us>
> To: cicko <alen.sil...@gmx.com>
> Cc: gnucash-devel@gnucash.org
> Subject: Re: Boost/Python
> 
> The bindings may work on Windows. They do work on MacOS, but we don’t include 
> them in either AIO because they need to link libpython and so will work with 
> only a single python version.  Since the interpreter and the GnuCash 
> bindings have to link the same libpython that creates a problem for an AIO.
>  

___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Boost/Python

2018-01-11 Thread cicko
Success!
At least a limited one. I've assembled a small demo - retrieving the GnuCash
version from core-utilities.

https://github.com/MisterY/gnucash-portfolio.net

Some more prototyping needed, mostly in mapping the unmanaged types to
managed.

I'll try this approach first, before setting up a whole dev environment on
Linux, building the custom version of GnuCash, etc. I'd rather focus on the
higher-level functionality for the moment, relying on production GnuCash
libraries. 
My goal is to have a few working tools, like upcoming transactions reminder.

Last weekend I've set up a Raspberry Pi server. Now I'm thinking this could
be my reminder provider, having a synchronized copy of GnuCash db, or
something like that. A mobile app could read/cache the reminders. 

Even better, I could try to publish the reminders as an .ics and have them
as an additional calendar on the phone.



--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Boost/Python

2018-01-10 Thread John Ralls


> On Jan 10, 2018, at 7:49 AM, cicko  wrote:
> 
> Thanks a lot, John! 
> I'll read more into this. I'd hope for some sort of wrapper on top of the
> already compiled binaries. Was hoping that these Python interfaces would do
> something like that. Which makes me wonder why the bindings currently don't
> work on Windows. I don't know much about the inner workings of this part at
> all.
> 
> The ability to read c/c++ dlls directly from c# makes it another interesting
> multi-platform option. It's supposed to work well on Linux by now. I might
> explore that route into more details over the weekend. 
> I tried it before but the thought of rewriting the data access layer threw
> me off a bit and Python seemed like an easier approach for a hobby project,
> considering there is PyCash, which provides the complete GnuCash data model. 
> Now that direct access to GnuCash libraries looks possible, I might tap
> directly into the real engine and, for example, get the list of scheduled
> transactions with next due dates, instead of writing a parallel logic for
> this elsewhere.
> 
> Hopefully this turns out to provide enough access to create some sort of
> prototype (.net is my main professional development platform, btw). Then it
> would be a fairly simple thing of exposing it over HTTP endpoint, which is
> what some have been asking for on the lists. I'd also prefer a HTTP UI as it
> also opens the door to mobile apps as well.
> 
> 

The bindings may work on Windows. They do work on MacOS, but we don’t include 
them in either AIO because they need to link libpython and so will work with 
only a single python version. Apple ships a different python version with each 
version of MacOS and Microsoft doesn’t provide python at all so it’s up to the 
user who wants python to install it. Since the interpreter and the GnuCash 
bindings have to link the same libpython that creates a problem for an AIO. 

You can install the python of your choice on Windows and build GnuCash from 
source with the python bindings enabled. We don’t test that so I can’t be sure 
that it will work.

Regards,
John Ralls

___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Boost/Python

2018-01-10 Thread cicko
Thanks a lot, John! 
I'll read more into this. I'd hope for some sort of wrapper on top of the
already compiled binaries. Was hoping that these Python interfaces would do
something like that. Which makes me wonder why the bindings currently don't
work on Windows. I don't know much about the inner workings of this part at
all.

The ability to read c/c++ dlls directly from c# makes it another interesting
multi-platform option. It's supposed to work well on Linux by now. I might
explore that route into more details over the weekend. 
I tried it before but the thought of rewriting the data access layer threw
me off a bit and Python seemed like an easier approach for a hobby project,
considering there is PyCash, which provides the complete GnuCash data model. 
Now that direct access to GnuCash libraries looks possible, I might tap
directly into the real engine and, for example, get the list of scheduled
transactions with next due dates, instead of writing a parallel logic for
this elsewhere.

Hopefully this turns out to provide enough access to create some sort of
prototype (.net is my main professional development platform, btw). Then it
would be a fairly simple thing of exposing it over HTTP endpoint, which is
what some have been asking for on the lists. I'd also prefer a HTTP UI as it
also opens the door to mobile apps as well.



--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: Boost/Python

2018-01-10 Thread John Ralls


> On Jan 10, 2018, at 4:43 AM, Alen Siljak <alen.sil...@gmx.com> wrote:
> 
>   In my quest to call GnuCash functions from Python (or C#), I ran across
>   Boost.Python
>   (http://www.boost.org/doc/libs/1_66_0/libs/python/doc/html/index.html).
> 
>   What are the chances that this would work with GnuCash .dlls on
>   Windows? Has anyone had any experience and willing to share?
> 
>   To me it currently looks like an interesting field to explore.
>   A mini project to use this on would be an enhancement of the scheduled
>   transactions management, for which I've submitted a few feature
>   requests.
>   Access to basic functions for listing and creation of records would be
>   enough to build additional functions for displaying the transactions in
>   range, changing states, etc.
>   I'm currently focusing on using a Web interface through Flask.
> ___________

We use SWIG, which does the same thing as Boost::Python and has the advantage 
of supporting Guile (and a bunch of other languages) as well.

If you need more of the API wrapped for Python it’s mostly a matter of adding 
Python definitions to the existing *.i files.

C# should be able to link the dlls directly.

Regards,
John Ralls


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Boost/Python

2018-01-10 Thread Alen Siljak
   In my quest to call GnuCash functions from Python (or C#), I ran across
   Boost.Python
   (http://www.boost.org/doc/libs/1_66_0/libs/python/doc/html/index.html).

   What are the chances that this would work with GnuCash .dlls on
   Windows? Has anyone had any experience and willing to share?

   To me it currently looks like an interesting field to explore.
   A mini project to use this on would be an enhancement of the scheduled
   transactions management, for which I've submitted a few feature
   requests.
   Access to basic functions for listing and creation of records would be
   enough to build additional functions for displaying the transactions in
   range, changing states, etc.
   I'm currently focusing on using a Web interface through Flask.
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel