From version < 1.2 >
edited by Krzysztof Płachno
on 2017/07/26 21:46
To version < 2.1 >
edited by Krzysztof Płachno
on 2017/07/26 21:59
< >
Change comment: There is no comment for this version

Summary

Details

ExtensionCode.ExtensionClass[0]
Description
... ... @@ -1,1 +1,29 @@
1 -Extension extending Extension Module with possibility to import extension from Pypi repositories.
1 +XWiki has possibility to scirpt on its pages in Python. Under the hood it's Java Scripting API and Jython that takes care of running this script and returning result to page. Jython has implementation only for standard libraries. That's why **Extension Repository Connector - Pypi** is created - to be able to import to XWiki other (non-standard) python packages that are hosted on pypi: https://pypi.python.org/pypi
2 +
3 +== Limitations ==
4 +
5 +Unfortunately there's huge amount of python packages that cannot be installed in XWiki. There are 2 groups of such packages:
6 + - Platform dependent - packages depending on libraries written in C and compiled per given platform e.g. NumPy or SciPy. Jython has limited compatibility with such packages. The future development of extension may take into consideration JyNI (Jython Native Interface) that is a project with aim to enable Jython to use native CPython extensions.
7 + - Packages only for python 3 - that are packages that does not have built version for python 2. Jython version used by XWiki is 2.7.1 that means it's compatible with python packages in version 2.7. (Built package means platform independent Wheel package). To release package on pypi the minimum requirement is to upload sources in 'sdist' package and unfortunately there are quite some packages (but fortunately mainly those less common) that have only 'sdist' (zip) distribution.
8 +
9 +{{warning}}
10 +Simple search finds python packages that themselves have build distribution compatible with XWiki Jython. However during installation it may turn out that one of packages's dependency does not have compatible distribution. In such case installation fails.
11 +{{/warning}}
12 +
13 +== Configuration ==
14 +No configuration needed. The extension after installment connects automatically to main (and practically the only commonly used one) pypi repository which is https://pypi.python.org/pypi
15 +
16 +== Example ==
17 +Using **Extension Repository Connector - Pypi** import ## requests ## package. Then create xwiki page with following script:
18 +{{code language=none}}{{python}}
19 +import requests
20 +r = requests.get(' http://www.mocky.io/v2/59736a8810000022034418c8')
21 +print "Status code is: "
22 +print r.status_code
23 +{{/python}}{{/code}}
24 +
25 +The result should be:
26 +{{code language=none}}Status code is:
27 +200{{/code}}
28 +
29 +
Show installed count
... ... @@ -1,0 +1,1 @@
1 +Yes
cogExtension extending Extension Module with possibility to import extension from Pypi repositories.
TypeJAR
Categoryrepository
Developed by

Krzysztof Płachno, Thomas Mortagne

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

Extension extending Extension Module with possibility to import extension from Pypi repositories.

XWiki has possibility to scirpt on its pages in Python. Under the hood it's Java Scripting API and Jython that takes care of running this script and returning result to page. Jython has implementation only for standard libraries. That's why Extension Repository Connector - Pypi is created - to be able to import to XWiki other (non-standard) python packages that are hosted on pypi: https://pypi.python.org/pypi

Limitations

Unfortunately there's huge amount of python packages that cannot be installed in XWiki. There are 2 groups of such packages:
 - Platform dependent - packages depending on libraries written in C and compiled per given platform e.g. NumPy or SciPy. Jython has limited compatibility with such packages. The future development of extension may take into consideration JyNI (Jython Native Interface) that is a project with aim to enable Jython to use native CPython extensions.
 - Packages only for python 3 - that are packages that does not have built version for python 2. Jython version used by XWiki is 2.7.1 that means it's compatible with python packages in version 2.7. (Built package means platform independent Wheel package). To release package on pypi the minimum requirement is to upload sources in 'sdist' package and unfortunately there are quite some packages (but fortunately mainly those less common) that have only 'sdist' (zip) distribution. 

Simple search finds python packages that themselves have build distribution compatible with XWiki Jython. However during installation it may turn out that one of packages's dependency does not have compatible distribution. In such case installation fails.

Configuration

No configuration needed. The extension after installment connects automatically to main (and practically the only commonly used one) pypi repository which is https://pypi.python.org/pypi

Example

Using Extension Repository Connector - Pypi import  requests  package. Then create xwiki page with following script:
{{python}}
import requests
r = requests.get(' http://www.mocky.io/v2/59736a8810000022034418c8')
print "Status code is: "
print r.status_code
{{/python}}
 

The result should be:
Status code is:
200
 

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.contrib:repository-pypi 1.0):

Get Connected