Distributing single jar including Python scripts, Java classes and Jython runtime.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Distributing single jar including Python scripts, Java classes and Jython runtime.

Christian Wutte-2
Hello everybody,

unfortunately I can't get it to work combining Python scripts, Java
classes and the Jython runtime in a single jar as mentioned in the wiki:
https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts

I noticed the following with the released jars from version 2.7b2 (and
2.5.4rc1 too):


header for both:
Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_60
Type "help", "copyright", "credits" or "license" for more information.


jython.jar from the regular installation (without Python standard
library /Lib inside jar):
>>> import org; dir(org)
['__name__', 'apache', 'ietf', 'jcp', 'omg', 'python', 'w3c', 'xml']
>>>


jython.jar including /Lib, like the standalone.jar:
>>> import org; dir(org)
['__name__']
>>>


So while the jython.jar allows adding Java classes and accessing them,
it won't work with the standalone.jar.

How can I have both, the /Lib and access to Java classes, in a single jar?

Thanks,
Christian

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|

Re: Distributing single jar including Python scripts, Java classes and Jython runtime.

Jim Baker
Christian,

You probably want to look at the Clamp project (https://github.com/jythontools/clamp/), which supports the singlejar use case. See https://github.com/jimbaker/clamped for more details.

Incidentally, I will be at EuroPython, and Clamp is a major part of what I be discussing:
  • Poster on Clamp at EuroPython (jointly with Darjus Loktevic, a core Clamp contributor), along with related projects like Fireside (https://github.com/jythontools/fireside)
  • Presentation on running Apache Storm with Jython ("Scalable Realtime Architectures"). Storm requires a singlejar; using Jython with Storm also takes advantage of Clamp's support for directly importing Python classes as if they are Java classes.
Lastly, I will also be at JavaOne where my colleague Werner Mendizabal and I have a presentation about related efforts to run OpenStack on the JVM, using Jython. In particular, we are working on a production deployment of the Keystone identity service using Jython, going against a Java backend that we have at Rackspace. We plan to use Clamp as part of this deployment process.

- Jim


On Mon, Jun 16, 2014 at 4:46 AM, Christian Wutte <[hidden email]> wrote:
Hello everybody,

unfortunately I can't get it to work combining Python scripts, Java
classes and the Jython runtime in a single jar as mentioned in the wiki:
https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts

I noticed the following with the released jars from version 2.7b2 (and
2.5.4rc1 too):


header for both:
Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_60
Type "help", "copyright", "credits" or "license" for more information.


jython.jar from the regular installation (without Python standard
library /Lib inside jar):
>>> import org; dir(org)
['__name__', 'apache', 'ietf', 'jcp', 'omg', 'python', 'w3c', 'xml']
>>>


jython.jar including /Lib, like the standalone.jar:
>>> import org; dir(org)
['__name__']
>>>


So while the jython.jar allows adding Java classes and accessing them,
it won't work with the standalone.jar.

How can I have both, the /Lib and access to Java classes, in a single jar?

Thanks,
Christian

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|

Re: Distributing single jar including Python scripts, Java classes and Jython runtime.

Christian Wutte-2
Thanks for your pointers. From reading the documentation I am not sure
if my use case fits. In contrary to the examples I am only calling Java
classes from Python, not the other way round. So I won't have any
clamped classes.
Can I still use it to create a single jar?

Best regards,
Christian


Am 20.06.2014 01:48, schrieb Jim Baker:

> Christian,
>
> You probably want to look at the Clamp project
> (https://github.com/jythontools/clamp/), which supports the singlejar
> use case. See https://github.com/jimbaker/clamped for more details.
>
> Incidentally, I will be at EuroPython, and Clamp is a major part of what
> I be discussing:
>
>   * Poster on Clamp at EuroPython (jointly with Darjus Loktevic, a core
>     Clamp contributor), along with related projects like Fireside
>     (https://github.com/jythontools/fireside)
>   * Presentation on running Apache Storm with Jython ("Scalable Realtime
>     Architectures"). Storm requires a singlejar; using Jython with Storm
>     also takes advantage of Clamp's support for directly importing
>     Python classes as if they are Java classes.
>
> Lastly, I will also be at JavaOne where my colleague Werner Mendizabal
> and I have a presentation about related efforts to run OpenStack on the
> JVM, using Jython. In particular, we are working on a production
> deployment of the Keystone identity service using Jython, going against
> a Java backend that we have at Rackspace. We plan to use Clamp as part
> of this deployment process.
>
> - Jim
>
>
> On Mon, Jun 16, 2014 at 4:46 AM, Christian Wutte
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello everybody,
>
>     unfortunately I can't get it to work combining Python scripts, Java
>     classes and the Jython runtime in a single jar as mentioned in the wiki:
>     https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
>
>     I noticed the following with the released jars from version 2.7b2 (and
>     2.5.4rc1 too):
>
>
>     header for both:
>     Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
>     [Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_60
>     Type "help", "copyright", "credits" or "license" for more information.
>
>
>     jython.jar from the regular installation (without Python standard
>     library /Lib inside jar):
>     >>> import org; dir(org)
>     ['__name__', 'apache', 'ietf', 'jcp', 'omg', 'python', 'w3c', 'xml']
>     >>>
>
>
>     jython.jar including /Lib, like the standalone.jar:
>     >>> import org; dir(org)
>     ['__name__']
>     >>>
>
>
>     So while the jython.jar allows adding Java classes and accessing them,
>     it won't work with the standalone.jar.
>
>     How can I have both, the /Lib and access to Java classes, in a
>     single jar?
>
>     Thanks,
>     Christian
>
>     ------------------------------------------------------------------------------
>     HPCC Systems Open Source Big Data Platform from LexisNexis Risk
>     Solutions
>     Find What Matters Most in Your Big Data with HPCC Systems
>     Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
>     Leverages Graph Analysis for Fast Processing & Easy Data Exploration
>     http://p.sf.net/sfu/hpccsystems
>     _______________________________________________
>     Jython-users mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/jython-users
>
>


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|

Re: Distributing single jar including Python scripts, Java classes and Jython runtime.

Jim Baker-2
Christian,

Clamp supports the use case of just creating a single jar, including attaching a __run__.py file and making your code directly runnable, via setting the jar manifest appropriately.

Note that the singlejar support in Jython will see some additional updates in making site-packages completely transparent; Clamp works around this for now by copying over site-packages into Jython's Lib. I have a working spike of such support here: https://bitbucket.org/jimbaker/jython-singlejar-site-packages/

I have updated the docs at https://github.com/jimbaker/clamped

- Jim



On Thu, Jun 26, 2014 at 6:41 AM, Christian Wutte <[hidden email]> wrote:
Thanks for your pointers. From reading the documentation I am not sure
if my use case fits. In contrary to the examples I am only calling Java
classes from Python, not the other way round. So I won't have any
clamped classes.
Can I still use it to create a single jar?

Best regards,
Christian


Am 20.06.2014 01:48, schrieb Jim Baker:
> Christian,
>
> You probably want to look at the Clamp project
> (https://github.com/jythontools/clamp/), which supports the singlejar
> use case. See https://github.com/jimbaker/clamped for more details.
>
> Incidentally, I will be at EuroPython, and Clamp is a major part of what
> I be discussing:
>
>   * Poster on Clamp at EuroPython (jointly with Darjus Loktevic, a core
>     Clamp contributor), along with related projects like Fireside
>     (https://github.com/jythontools/fireside)
>   * Presentation on running Apache Storm with Jython ("Scalable Realtime
>     Architectures"). Storm requires a singlejar; using Jython with Storm
>     also takes advantage of Clamp's support for directly importing
>     Python classes as if they are Java classes.
>
> Lastly, I will also be at JavaOne where my colleague Werner Mendizabal
> and I have a presentation about related efforts to run OpenStack on the
> JVM, using Jython. In particular, we are working on a production
> deployment of the Keystone identity service using Jython, going against
> a Java backend that we have at Rackspace. We plan to use Clamp as part
> of this deployment process.
>
> - Jim
>
>
> On Mon, Jun 16, 2014 at 4:46 AM, Christian Wutte
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello everybody,
>
>     unfortunately I can't get it to work combining Python scripts, Java
>     classes and the Jython runtime in a single jar as mentioned in the wiki:
>     https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
>
>     I noticed the following with the released jars from version 2.7b2 (and
>     2.5.4rc1 too):
>
>
>     header for both:
>     Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
>     [Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_60
>     Type "help", "copyright", "credits" or "license" for more information.
>
>
>     jython.jar from the regular installation (without Python standard
>     library /Lib inside jar):
>     >>> import org; dir(org)
>     ['__name__', 'apache', 'ietf', 'jcp', 'omg', 'python', 'w3c', 'xml']
>     >>>
>
>
>     jython.jar including /Lib, like the standalone.jar:
>     >>> import org; dir(org)
>     ['__name__']
>     >>>
>
>
>     So while the jython.jar allows adding Java classes and accessing them,
>     it won't work with the standalone.jar.
>
>     How can I have both, the /Lib and access to Java classes, in a
>     single jar?
>
>     Thanks,
>     Christian
>
>     ------------------------------------------------------------------------------
>     HPCC Systems Open Source Big Data Platform from LexisNexis Risk
>     Solutions
>     Find What Matters Most in Your Big Data with HPCC Systems
>     Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
>     Leverages Graph Analysis for Fast Processing & Easy Data Exploration
>     http://p.sf.net/sfu/hpccsystems
>     _______________________________________________
>     Jython-users mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/jython-users
>
>



------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|

Re: Distributing single jar including Python scripts, Java classes and Jython runtime.

Christian Wutte-2
You are referring to the bin/simplejar tool mentioned in the clamp
readme? I tried it, but the resulting jar from calling that tool does
not include the Python standard library (with '/Lib' I meant the
standard library before ..).

Christian


Am 26.06.2014 23:34, schrieb Jim Baker:

> Christian,
>
> Clamp supports the use case of just creating a single jar, including
> attaching a __run__.py file and making your code directly runnable, via
> setting the jar manifest appropriately.
>
> Note that the singlejar support in Jython will see some additional
> updates in making site-packages completely transparent; Clamp works
> around this for now by copying over site-packages into Jython's Lib. I
> have a working spike of such support
> here: https://bitbucket.org/jimbaker/jython-singlejar-site-packages/
>
> I have updated the docs at https://github.com/jimbaker/clamped
>
> - Jim
>
>
>
> On Thu, Jun 26, 2014 at 6:41 AM, Christian Wutte
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Thanks for your pointers. From reading the documentation I am not sure
>     if my use case fits. In contrary to the examples I am only calling Java
>     classes from Python, not the other way round. So I won't have any
>     clamped classes.
>     Can I still use it to create a single jar?
>
>     Best regards,
>     Christian
>
>
>     Am 20.06.2014 01:48, schrieb Jim Baker:
>     > Christian,
>     >
>     > You probably want to look at the Clamp project
>     > (https://github.com/jythontools/clamp/), which supports the singlejar
>     > use case. See https://github.com/jimbaker/clamped for more details.
>     >
>     > Incidentally, I will be at EuroPython, and Clamp is a major part
>     of what
>     > I be discussing:
>     >
>     >   * Poster on Clamp at EuroPython (jointly with Darjus Loktevic, a
>     core
>     >     Clamp contributor), along with related projects like Fireside
>     >     (https://github.com/jythontools/fireside)
>     >   * Presentation on running Apache Storm with Jython ("Scalable
>     Realtime
>     >     Architectures"). Storm requires a singlejar; using Jython with
>     Storm
>     >     also takes advantage of Clamp's support for directly importing
>     >     Python classes as if they are Java classes.
>     >
>     > Lastly, I will also be at JavaOne where my colleague Werner Mendizabal
>     > and I have a presentation about related efforts to run OpenStack
>     on the
>     > JVM, using Jython. In particular, we are working on a production
>     > deployment of the Keystone identity service using Jython, going
>     against
>     > a Java backend that we have at Rackspace. We plan to use Clamp as part
>     > of this deployment process.
>     >
>     > - Jim
>     >
>     >
>     > On Mon, Jun 16, 2014 at 4:46 AM, Christian Wutte
>     > <[hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email]
>     <mailto:[hidden email]>>> wrote:
>     >
>     >     Hello everybody,
>     >
>     >     unfortunately I can't get it to work combining Python scripts,
>     Java
>     >     classes and the Jython runtime in a single jar as mentioned in
>     the wiki:
>     >     https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
>     >
>     >     I noticed the following with the released jars from version
>     2.7b2 (and
>     >     2.5.4rc1 too):
>     >
>     >
>     >     header for both:
>     >     Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
>     >     [Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_60
>     >     Type "help", "copyright", "credits" or "license" for more
>     information.
>     >
>     >
>     >     jython.jar from the regular installation (without Python standard
>     >     library /Lib inside jar):
>     >     >>> import org; dir(org)
>     >     ['__name__', 'apache', 'ietf', 'jcp', 'omg', 'python', 'w3c',
>     'xml']
>     >     >>>
>     >
>     >
>     >     jython.jar including /Lib, like the standalone.jar:
>     >     >>> import org; dir(org)
>     >     ['__name__']
>     >     >>>
>     >
>     >
>     >     So while the jython.jar allows adding Java classes and
>     accessing them,
>     >     it won't work with the standalone.jar.
>     >
>     >     How can I have both, the /Lib and access to Java classes, in a
>     >     single jar?
>     >
>     >     Thanks,
>     >     Christian
>     >
>     >    
>     ------------------------------------------------------------------------------
>     >     HPCC Systems Open Source Big Data Platform from LexisNexis Risk
>     >     Solutions
>     >     Find What Matters Most in Your Big Data with HPCC Systems
>     >     Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
>     >     Leverages Graph Analysis for Fast Processing & Easy Data
>     Exploration
>     >     http://p.sf.net/sfu/hpccsystems
>     >     _______________________________________________
>     >     Jython-users mailing list
>     >     [hidden email]
>     <mailto:[hidden email]>
>     >     <mailto:[hidden email]
>     <mailto:[hidden email]>>
>     >     https://lists.sourceforge.net/lists/listinfo/jython-users
>     >
>     >
>
>


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users