Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1b7e59e
Handle varargs method calls.
cpwright Jun 14, 2017
2615f1f
Take fixed arity matches over varargs.
cpwright Sep 12, 2017
69da2cd
Verbose exceptions.
cpwright Sep 12, 2017
320783f
Remove duplicate stack trace entries.
cpwright Sep 12, 2017
bf3bd98
Add more introspection to PyObject, reuse globals for locals.
cpwright Sep 14, 2017
1eac854
Fix for toString test, and variable initialization.
cpwright Sep 14, 2017
6425cdd
Comment cleanups.
cpwright Sep 19, 2017
9c6eacb
Change variable name.
cpwright Sep 27, 2017
c85d722
Combine append calls..
cpwright Sep 27, 2017
53ae338
Copy and expand comment.
cpwright Sep 28, 2017
21ccf81
GetStringUTFChars result checking.
cpwright Sep 28, 2017
71637e1
Reran javah.
cpwright Sep 28, 2017
e05b35e
Comment cleanups.
cpwright Sep 28, 2017
74a81a9
Variable initialization.
cpwright Sep 28, 2017
4cd7208
Code review cleanups.
cpwright Sep 28, 2017
ba726cb
Verbose exception test.
cpwright Sep 28, 2017
d1f3053
Mark all files as modified, to comply with 'prominent notices stating…
cpwright Sep 28, 2017
2b40cc6
negative to not a positive.
cpwright Sep 28, 2017
9562da2
Handle local and global maps for input to executeCode/executeScript.
cpwright Sep 29, 2017
846237e
Access to main dictionary and copy.
cpwright Sep 29, 2017
ad7f778
Typed exceptions, use dictionary wrappers as globals.
cpwright Sep 29, 2017
4c23a75
Fix memory error in verbose exceptions.
cpwright Sep 29, 2017
0994e00
Fix copy and paste error.
cpwright Sep 29, 2017
447db6a
FileNotFoundException when a script issn't found.
cpwright Sep 30, 2017
53c4fdf
Type matching for String lists.
cpwright Sep 30, 2017
1327584
Remove debug prints.
cpwright Oct 2, 2017
52a3991
Check for NULL from map to dict conversion. Remove REPR printf.
cpwright Oct 2, 2017
40563fd
Move comment.
cpwright Oct 2, 2017
ccd6478
Fix comment.
cpwright Oct 2, 2017
49e892a
Fix comment.
cpwright Oct 2, 2017
915b306
Comment fixes.
cpwright Oct 2, 2017
24704ea
Comment fix.
cpwright Oct 2, 2017
6b48635
Comment fix.
cpwright Oct 2, 2017
aa02e8c
PyDictWrapper: Use delegation for String/Object overloads.
cpwright Oct 2, 2017
445d1ad
jpy_jmethod.c: move variable out of loop initializer.
cpwright Oct 6, 2017
5adfb4a
Method overloading should check assignability for String/primitives.
cpwright Dec 11, 2017
6bac924
jpy_jtype.c: Exclude bridge methods to prevent covariant return probl…
cpwright Dec 21, 2017
b92272a
aff FTP upload to appveyor
mzuehlke Feb 8, 2018
5722843
add FTP upload to appveyor (fix password)
mzuehlke Feb 8, 2018
74365f0
update appveyor badge
mzuehlke Feb 8, 2018
9ab5d6e
move declarations to be C89 compatible (for Windows)
Apr 27, 2018
6a878e7
Ensure that the 'name' argument is non-null, for preventing a JVM crash.
desruisseaux May 2, 2018
5f74e78
CHANGES.md: Updated.
cpwright May 8, 2018
a4c7d71
Merge pull request #126 from Geomatys/master
forman May 9, 2018
b7d3024
PyString and PyInt are not py3 compatible.
cpwright May 9, 2018
53c86b0
Merge remote-tracking branch 'github/master' into illumon_varargs2
cpwright May 9, 2018
7eedc1f
More Python3 string fixes, correct one not actually fix.
cpwright May 9, 2018
21e0990
repr() was also using PyString_AS_STRING.
cpwright May 9, 2018
3331eb1
Merge pull request #111 from cpwright/illumon_varargs2
forman May 9, 2018
f1f2f59
Move StopIteration.java to its correct directory for its package name…
desruisseaux May 11, 2018
370b0d8
Merge pull request #129 from Geomatys/master
forman May 14, 2018
f579190
Explicit null checks for avoiding JVM crash.
desruisseaux May 16, 2018
f78ddbe
Merge pull request #131 from Geomatys/master
forman May 18, 2018
84ad413
Update intro.rst
Dr-Irv Jun 11, 2018
2c1ca88
Merge pull request #135 from Dr-Irv/patch-1
forman Jun 12, 2018
826de3f
Fix iterating over dicts
Dr-Irv Jun 12, 2018
b7adfb7
make constants get into Python correctly
Dr-Irv Jun 13, 2018
47f9adc
Fix Java to Python example again
Dr-Irv Jun 18, 2018
aca1e1e
Support setting PYTHONHOME
Dr-Irv Jun 20, 2018
378c59d
Fix Python 3.4 issue
Dr-Irv Jun 20, 2018
faab8f4
Fix Py3.4 and x86
Dr-Irv Jun 21, 2018
2d9e12e
Merge pull request #144 from Dr-Irv/prefix
forman Jun 22, 2018
40255b0
Merge pull request #142 from Dr-Irv/patch-1
forman Jun 22, 2018
4c12d42
Merge pull request #137 from Dr-Irv/fixdict
forman Jun 22, 2018
b2136a7
Docs for setPythonHome
Dr-Irv Jun 22, 2018
7e1efd8
Support hashCode, equals, str
Dr-Irv Jun 22, 2018
c66d637
starting 0.10
forman Jun 25, 2018
36eeeec
starting 0.10
forman Jun 25, 2018
b58cf1d
formatting code
Dr-Irv Jun 25, 2018
86fce2c
Merge in master
Dr-Irv Jun 25, 2018
673783e
Merge pull request #146 from Dr-Irv/hasheq
forman Jun 25, 2018
31bc163
merged with hasheq
Dr-Irv Jun 25, 2018
0642455
doc change
Dr-Irv Jun 25, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ Vagrantfile
*.so
*.dll

/bin/
38 changes: 31 additions & 7 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@
jpy Changelog
*************

Version 0.10 (in development)
=============================

* Make jpy work with Anaconda by setting environment variable
`PYTHONHOME` from Java
[#143](https://github.com/bcdev/jpy/issues/143). Contribution by Dr-Irv.
* Fixed: Constants are not properly passed from Java to Python when using interfaces
[#140](https://github.com/bcdev/jpy/issues/140). Contribution by Dr-Irv.
* Fixed: Cannot iterate through a dict in Python 3.x
[#136](https://github.com/bcdev/jpy/issues/136). Contribution by Dr-Irv.

Version 0.9
===========

This version includes a number of contributions from supportive GitHub users. Thanks to all of you!
This version includes a number of contributions from supportive GitHub users. Thanks to all of you!

Fixes
-----
Expand All @@ -14,18 +25,31 @@ Fixes
* Fixed problem where default methods on Java 8 Interfaces were not found (issue #102). Fix by Charles P. Wright.
* Fixed error caused by missing `sys.argv` in Python when called from Java (issue #81). Fix by Dave Voutila.
* Fixed problem where calling jpy.get_type() too many times causes a memory access error (issue #74). Fix by Dave Voutila.
* Fixed a corruption when retrieving long values (#72). Fix by chipkent.
* Fixed a corruption when retrieving long values (#72). Fix by chipkent.
* Fixed fatal error when stopping python session (issue #70, #77). Fix by Dave Voutila.
# Explicit null checks for avoiding JVM crash (issue #126). Fix by Geomatys.

Improvements
------------

* Can now use pip to install Python `jpy` package directly from GitHub (#83).
This works for Linux and OS X where C compilers are available by default
and should work on Windows with Visual Studio 15 installed.
Contribution by Dave Voutila.
* Java `PyObject` is now serializable. Contribution by Mario Briggs.

This works for Linux and OS X where C compilers are available by default
and should work on Windows with Visual Studio 15 installed.
Contribution by Dave Voutila.
* Java `PyObject` is now serializable. Contribution by Mario Briggs.
* Improved Varargs method matching. You may pass in either an array (as in the
past) or individual Python arguments, the match for a varargs method call is
the minimum match for each of the arguments. Zero length arrays (i.e. no
arguments) are also permitted with a match value of 10.
* `jpy.type_translations` dictionary for callbacks when instantiating Python objects.
* `jpy.VerboseExceptions` enables full Java stack traces.
* More Python exceptions are translated to the corresponding Java type.
* Globals and locals are converted when executing code with PyLib, to allow variables to be
used across statement invocation; and interrogated from Java.
* PyObject wrappers for dictionary, list, and introspection functions to tell
you whether or not you can convert the object.
* Support for isAssignable checks when dealing with Python Strings and primitives, to allow
matches for argument types such as `java.lang.Comparable` or `java.lang.Number`.

Version 0.8
===========
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/bcdev/jpy.svg?branch=master)](https://travis-ci.org/bcdev/jpy)
[![Build Status](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/forman/jpy)
[![Build Status](https://ci.appveyor.com/api/projects/status/ywkcey4nlt0avasf?svg=true)](https://ci.appveyor.com/project/bcdev/jpy)
[![Documentation Status](https://readthedocs.org/projects/jpy/badge/?version=latest)](http://jpy.readthedocs.org/en/latest/?badge=latest)


Expand Down
15 changes: 15 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@ install:
build_script:
- set PATH=%JPY_PYTHON_HOME%;%JPY_PYTHON_HOME%\DLLs;%JPY_JDK_HOME%;%JPY_JDK_HOME%\bin;%PATH%
- call "%JPY_PYTHON_HOME%\python.exe" setup.py --maven bdist_wheel
- move dist win

artifacts:
- path: 'win\*.whl'
name: wheel

deploy:
- provider: FTP
protocol: ftp
host: ftp.brockmann-consult.de
username: jpy
password:
secure: AMte8IErI/LRGmLGq4Y5YQ==
folder: software
debug: true
11 changes: 11 additions & 0 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,23 @@ Another optional parameter

* ``jpy.debug`` - which is either ``true`` or ``false`` can be used to output extra debugging information.

The optional parameter

* ``jpy.pythonPrefix`` - points to the location of the PYTHONHOME. If set, then jpy will call ``PyLib.setPythonHome()`` with the value of this parameter.

All the parameters can be passed directly to the JVM either as Java system properties or by using the single system property

* ``jpy.config`` - which is a path to a Java properties files containing the definitions of the two parameters named above.

Such property file is also written for each build and is found in ``build/lib-<os-platform>-<python-version>/jpyconfig.properties``.

Setting PYTHONHOME
------------------

If the environment variable ``PYTHONHOME`` is not set when you call Python from Java, you may get an error about
file system encodings not being found. It is possible to set the location of Python from your
Java program. Use ``PyLib.setPythonHome(pathToPythonHome)`` to do that, where ``pathToPythonHome`` is a ``String`` that
contains the location of the Python installation, or as described above, use the parameter ``jpy.pytyhonPrefix``.

========================
Build for Linux / Darwin
Expand Down
5 changes: 1 addition & 4 deletions doc/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ then we can call the Python code from Java as follows ::
// Import the Python module
PyModule plugInModule = PyLib.importModule("bibo_plugin");

// Get the Python class
PyObject plugInClass = plugInModule.getAttribute("BiboPlugIn");

// Call the Python class to instantiate an object
PyObject plugInObj = plugInClass.call();
PyObject plugInObj = plugInModule.call("BiboPlugin");

// Create a Java proxy object for the Python object
PlugIn plugIn = plugInObj.createProxy(PlugIn.class);
Expand Down
19 changes: 18 additions & 1 deletion doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,20 @@ Variables
Here a call to the ``read`` method will modify the numpy array's content as desired and return the
same array instance as indicated by the Java method's specification.

.. py:data:: type_translations
:module: jpy

Contains callbacks which are called when instantiating a Python object from a Java object.
After the standard wrapping of the Java object as a Python object, the Java type name is looked up in this
dictionary. If the returned item is a callable, the callable is called with the JPy object as an argument,
and the callable's result is returned to the user.


.. py:data:: VerboseExceptions.enabled
:module: jpy

If set to true, then jpy will produce more verbose exception messages; which include the full Java stack trace.
If set to false, then jpy produces exceptions using only the underlying Java exception's toString method.

.. py:data:: diag
:module: jpy
Expand Down Expand Up @@ -379,7 +393,7 @@ Java object types
| ``java.lang.String`` | 1 | 0 | 0 | 0 | 100 |
+-------------------------+--------------+----------+---------+------------+---------+
| ``java.lang.Object`` | 1 | 10 | 10 | 10 | 10 |
+-------------------------+--------------+----------+---------+------------+---------+
+-------------------------+--------------+----------+---------+------------+---------+jpy

Java primitive array types
--------------------------
Expand Down Expand Up @@ -410,6 +424,9 @@ given above, the a match value of 10 applies, as long as the item size of a buff
Java object array types
-----------------------

For String arrays, if a sequence is matched with a value of 80 if all the elements in the sequence are Python strings.


todo


Expand Down
4 changes: 2 additions & 2 deletions jpyutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import subprocess


__author__ = "Norman Fomferra, Brockmann Consult GmbH"
__copyright__ = "Copyright 2015-2017 Brockmann Consult GmbH"
__author__ = "Norman Fomferra (Brockmann Consult GmbH) and contributors"
__copyright__ = "Copyright 2015-2018 Brockmann Consult GmbH and contributors"
__license__ = "Apache 2.0"
__version__ = "0.9.1.dev1"

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@
</snapshotRepository>
</distributionManagement>

</project>
</project>
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
sources = [
os.path.join(src_main_c_dir, 'jpy_module.c'),
os.path.join(src_main_c_dir, 'jpy_diag.c'),
os.path.join(src_main_c_dir, 'jpy_verboseexcept.c'),
os.path.join(src_main_c_dir, 'jpy_conv.c'),
os.path.join(src_main_c_dir, 'jpy_compat.c'),
os.path.join(src_main_c_dir, 'jpy_jtype.c'),
Expand Down Expand Up @@ -98,6 +99,7 @@
os.path.join(src_test_py_dir, 'jpy_typeconv_test.py'),
os.path.join(src_test_py_dir, 'jpy_typeres_test.py'),
os.path.join(src_test_py_dir, 'jpy_modretparam_test.py'),
os.path.join(src_test_py_dir, 'jpy_translation_test.py'),
os.path.join(src_test_py_dir, 'jpy_gettype_test.py'),
]

Expand Down Expand Up @@ -200,7 +202,7 @@ def test_python_java_classes():
""" Run Python tests against JPY test classes """
sub_env = {'PYTHONPATH': _build_dir()}

log.info('Executing Python unit tests (against Java runtime classes)...')
log.info('Executing Python unit tests (against JPY test classes)...')
return jpyutil._execute_python_scripts(python_java_jpy_tests,
env=sub_env)

Expand Down
Loading