Python Libraries.

Discussion about writing code for Inkscape.
User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Python Libraries.

Postby ragstian » Fri Feb 06, 2015 9:14 am

Hi.

I am working on an extension where the use of the "sympy" library would be "nice to have".
What does it take to get sympy added to the standard libraries shipped with Inkscape?

( I can install and use this but then the extension would not work for others. )

The current python version used by Inkscape is 2.6.5 - released Mars 2010, the current release of python is 2.7.9 - released December 2014.
Will a newer version of python be included in the future?

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Python Libraries.

Postby brynn » Fri Feb 06, 2015 8:04 pm

If you don't get an answer here, you might try the devel mailing list :D

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Python Libraries.

Postby hulf2012 » Sat Feb 07, 2015 2:19 am

Agree with brynn,

What I know is that even the python instalation (embbeded) that comes with Inkscape have some libraries unpresent. Like those TCL/tk which could permit add more GUI to the extensions system. I talk about file managers gui (Save, Load, etc).

My guess is that updating the embedde python is impossible, or very hard to do.

However, you can just copy the ".py" files in the extension directory. But if they are not compatible with the old python interpreter...
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Python Libraries.

Postby ragstian » Sat Feb 07, 2015 4:19 am

Hi

hulf2012 wrote:My guess is that updating the embedded python is impossible, or very hard to do.

Hmm.. Quite the contrary - it's just a matter of copying the directory, problem would be to "sync"
this operation among the developers to ensure they would all be using the same version, reckon they got some tools to take care of this.

brynn wrote:If you don't get an answer here, you might try the devel mailing list

Was hoping for "~suv" to pop up" - the developers mailing list is "unknown territory"!

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Python Libraries.

Postby Lazur » Sat Feb 07, 2015 4:47 am

Head right to the IRC, for an instant notice.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Python Libraries.

Postby brynn » Sat Feb 07, 2015 10:36 am

"Instant notice" is not a guarantee! In fact, in my experience, the opposite. I've posted questions that were never answered (and I did wait 30 to 45 min). This has happened to me twice. Yet I read messages where people are apparently getting help there. So sometimes I log on, just to watch "the action". For only the first time, the other day, I actually saw a discussion happening (probably the 6th or 8th time I've logged on, and I watch for nearly an hour each time). (I'm told my experience is atypical, but it will take a lot to change my impression.)

FAQ #B.10 -- https://inkscape.org/en/learn/faq/#Wher ... h_Inkscape and scroll down to "Asking for help on IRC". Also see the Ask Smart Questions PDF on this page: https://inkscape.org/en/community/discussion/

The mailing list does generate a lot of email that I often don't read. I finally had to break down and subscribe when I voluteered to update some of the community info in the wiki. (The only way to get an account to edit the wiki, is to post on the devel list.) But I have learned a LOT, while participating hardly at all.

The user list, however, gets much less mail, and it seems that developers often answer questions on the user list. Maybe a good compromise option?

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Python Libraries.

Postby ragstian » Sat Feb 07, 2015 11:13 am

Hi.

Thanks brynn, i have tried the IRC but the few times I have been there it's been quiet, no action at all.
I will try some more.

I will work on my extension and using whatever is available now.

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Python Libraries.

Postby ~suv » Sat Feb 07, 2015 11:23 am

ragstian wrote:I am working on an extension where the use of the "sympy" library would be "nice to have".
What does it take to get sympy added to the standard libraries shipped with Inkscape?
An extension bundled with inkscape (or a very popular one which is externally developed and maintained) would make an argument … so far, I haven't encountered a single extension which imports sympy

Consider that every Inkscape user on Windows and OS X would have to download this (sympy for Python 2.7 on OS X installs about 38MB of files in site-packages/sympy), even if she never installs an extension which makes use of sympy. On Linux, it would add an additional (recommended) dependency to the already long list - not every linux user appreciates it if lots of other packages get installed just to be able to use Inkscape to edit SVG files.

The question whether to bundle sympy with Inkscape by default probably would best be brought up on the inkscape-devel mailing list, along with a couple of extensions demonstrating its use (and making the case why it can't be done without sympy, and how future extension development would benefit if sympy were available).

ragstian wrote:( I can install and use this but then the extension would not work for others. )
You could provide instructions along with your extension to download and install sympy (into the python installation of Inkscape) - AFAICT sympy does not use compiled modules (which makes it a lot easier compared to e.g. a module like numpy).

ragstian wrote:(The current python version used by Inkscape is 2.6.5 - released Mars 2010, the current release of python is 2.7.9 - released December 2014.
Will a newer version of python be included in the future?
Hopefully (Python 2.6 is indeed outdated by now). Unfortunately, while Windows users are likely the largest user base (based on download stats), there are very few active contributors and developers working on Windows. Thus the Windows devlibs (repositories with all the dependencies required to compile inkscape itself on Windows and to create the installer packages) somewhat lack maintenance and are not updated frequently.

As a first step, I'd probably file reports for the Windows devlibs, asking for an upgrade of Python to latest 2.7.9:

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Python Libraries.

Postby ~suv » Sat Feb 07, 2015 11:39 am

~suv wrote:Thus the Windows devlibs (…) are not updated frequently.
The changelogs:
Last edited by ~suv on Sat Feb 07, 2015 11:40 am, edited 1 time in total.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Python Libraries.

Postby ragstian » Sat Feb 07, 2015 11:39 am

Hi.

Thanks ~suv, what you are saying makes a lot of sense. Will see if I can do without sympy, I was looking at the sympy geometry module
I can always copy the code I need into my extension. 38Mb sounds like "too much excess baggage" as
it would almost double the download size.

A brief explanation on the sympy geometry module sympy geometry module

Will see If I can come up with some valid arguments to update the Python version for a possible "report" to the devlibs.

Thanks again, really appreciated.

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Python Libraries.

Postby ~suv » Sat Feb 07, 2015 11:42 am

ragstian wrote:38Mb sounds like "too much excess baggage" as it would almost double the download size.
I didn't take the time to filter out the *.pyc files (they are not included when creating the packages), and of course they would get compressed when included in the installer (for Windows) or the DMG (for OS X).


Return to “Programming”