Skip to content

Commit ef4fa53

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ubuntu-24.04
2 parents 5ae64d9 + 7af8906 commit ef4fa53

File tree

19 files changed

+536
-132
lines changed

19 files changed

+536
-132
lines changed

.github/workflows/build.yml

Lines changed: 103 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ jobs:
6060
- { machine: 'windows-2022', python: '3.11', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
6161
- { machine: 'windows-2022', python: '3.12', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
6262
- { machine: 'windows-2022', python: '3.13', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
63-
- { machine: 'macos-12', python: '3.6', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
64-
- { machine: 'macos-12', python: '3.7', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
65-
- { machine: 'macos-12', python: '3.11', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
66-
- { machine: 'macos-12', python: '3.12', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
67-
- { machine: 'macos-12', python: '3.13', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
63+
- { machine: 'macos-13', python: '3.6', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
64+
- { machine: 'macos-13', python: '3.7', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
65+
- { machine: 'macos-13', python: '3.11', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
66+
- { machine: 'macos-13', python: '3.12', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
67+
- { machine: 'macos-13', python: '3.13', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
6868

6969
steps:
7070
- uses: actions/checkout@v4
@@ -79,7 +79,6 @@ jobs:
7979
distribution: 'temurin'
8080
java-version: '8'
8181

82-
- run: pip install setuptools
8382
- run: ${{ matrix.info.cmd }}
8483

8584
- uses: actions/upload-artifact@v4
@@ -108,9 +107,9 @@ jobs:
108107
fail-fast: false
109108
matrix:
110109
info:
111-
- { machine: 'macos-12', python: '3.8', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
112-
- { machine: 'macos-12', python: '3.9', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
113-
- { machine: 'macos-12', python: '3.10', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
110+
- { machine: 'macos-13', python: '3.8', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
111+
- { machine: 'macos-13', python: '3.9', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
112+
- { machine: 'macos-13', python: '3.10', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
114113

115114
steps:
116115
- uses: actions/checkout@v4
@@ -135,7 +134,7 @@ jobs:
135134
path: dist/*.whl
136135
retention-days: 1
137136

138-
bdist-wheels-linux-arm64:
137+
bdist-wheel-linux-arm64:
139138
runs-on: 'ubuntu-24.04'
140139
steps:
141140
- uses: actions/checkout@v4
@@ -146,8 +145,12 @@ jobs:
146145
- name: Set up Docker Buildx
147146
uses: docker/setup-buildx-action@v3
148147

148+
- run: mkdir /tmp/dist
149+
149150
- name: Bake
150-
uses: docker/bake-action@v4.6.0
151+
uses: docker/bake-action@v5.11.0
152+
env:
153+
DOCKER_BUILD_RECORD_UPLOAD: false
151154
with:
152155
files: .github/docker/docker-bake.hcl
153156
pull: true
@@ -157,13 +160,97 @@ jobs:
157160
158161
- uses: actions/upload-artifact@v4
159162
with:
160-
name: bdist-wheels-linux-arm64
163+
name: bdist-wheel-linux-arm64
161164
path: /tmp/dist/*.whl
162165
retention-days: 1
163166

167+
bdist-wheel-t:
168+
runs-on: ${{ matrix.info.machine }}
169+
strategy:
170+
fail-fast: false
171+
matrix:
172+
info:
173+
- { machine: 'ubuntu-20.04', python: '3.13t', java: '8', arch: 'amd64', cmd: '.github/env/Linux/bdist-wheel.sh' }
174+
- { machine: 'windows-2022', python: '3.13t', java: '8', arch: 'amd64', cmd: '.\.github\env\Windows\bdist-wheel.ps1' }
175+
- { machine: 'macos-13', python: '3.13t', java: '8', arch: 'amd64', cmd: '.github/env/macOS/bdist-wheel.sh' }
176+
- { machine: 'macos-14', python: '3.13t', java: '11', arch: 'arm64', cmd: '.github/env/macOS/bdist-wheel.sh' }
177+
178+
steps:
179+
- uses: actions/checkout@v4
180+
181+
- uses: actions/setup-java@v4
182+
id: setup-java
183+
with:
184+
distribution: 'temurin'
185+
java-version: ${{ matrix.info.java }}
186+
187+
- uses: astral-sh/setup-uv@v5
188+
- if : ${{ startsWith(matrix.info.machine, 'windows')}}
189+
run: |
190+
uv python install ${{ matrix.info.python }}
191+
uv venv --python ${{ matrix.info.python }}
192+
.venv\Scripts\Activate.ps1
193+
uv pip install pip
194+
echo PATH=$PATH >> $GITHUB_PATH
195+
${{ matrix.info.cmd }}
196+
- if : ${{ ! startsWith(matrix.info.machine, 'windows')}}
197+
run: |
198+
uv python install ${{ matrix.info.python }}
199+
uv venv --python ${{ matrix.info.python }}
200+
source .venv/bin/activate
201+
uv pip install pip
202+
echo PATH=$PATH >> $GITHUB_PATH
203+
${{ matrix.info.cmd }}
204+
205+
- uses: actions/upload-artifact@v4
206+
with:
207+
name: build-${{ matrix.info.python }}-${{ matrix.info.machine }}-${{ matrix.info.arch }}
208+
path: dist/*.whl
209+
retention-days: 1
210+
211+
bdist-wheel-linux-arm64-t:
212+
runs-on: ${{ matrix.info.machine }}
213+
strategy:
214+
fail-fast: false
215+
matrix:
216+
info:
217+
- { machine: 'ubuntu-20.04', python: '3.13t', java: '11', arch: 'aarch64', cmd: '.github/env/Linux/bdist-wheel.sh' }
218+
219+
steps:
220+
- uses: actions/checkout@v4
221+
222+
- name: Set up QEMU
223+
uses: docker/setup-qemu-action@v3
224+
225+
- name: Build wheels
226+
uses: pypa/cibuildwheel@v2.21.3
227+
env:
228+
CIBW_FREE_THREADED_SUPPORT: true
229+
CIBW_ARCHS_LINUX: "aarch64"
230+
CIBW_BUILD: "cp313t-*"
231+
CIBW_SKIP: "cp313t-musllinux_aarch64"
232+
CIBW_BEFORE_ALL_LINUX: >
233+
yum install -y java-${{ matrix.info.java }}-openjdk-devel &&
234+
yum install -y wget &&
235+
wget https://www.apache.org/dist/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz -P /tmp &&
236+
tar xf /tmp/apache-maven-3.8.8-bin.tar.gz -C /opt &&
237+
ln -s /opt/apache-maven-3.8.8/bin/mvn /usr/bin/mvn
238+
CIBW_ENVIRONMENT: JAVA_HOME=/etc/alternatives/jre_11_openjdk
239+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'auditwheel repair --exclude libjvm.so -w {dest_dir} {wheel}'
240+
241+
with:
242+
package-dir: .
243+
output-dir: dist
244+
245+
- uses: actions/upload-artifact@v4
246+
with:
247+
name: build-${{ matrix.info.python }}-${{ matrix.info.machine }}-${{ matrix.info.arch }}
248+
path: dist/*.whl
249+
retention-days: 1
250+
164251
collect-artifacts:
165252
runs-on: ubuntu-24.04
166-
needs: ['sdist', 'bdist-wheel', 'bdist-wheel-universal2-hack', 'bdist-wheels-linux-arm64']
253+
needs: ['sdist', 'bdist-wheel', 'bdist-wheel-universal2-hack', 'bdist-wheel-linux-arm64', 'bdist-wheel-t', 'bdist-wheel-linux-arm64-t']
167254
steps:
168255
- uses: actions/checkout@v4
169256
- uses: actions/download-artifact@v4
@@ -200,14 +287,14 @@ jobs:
200287
with:
201288
distribution: 'temurin'
202289
java-version: '8'
203-
server-id: ossrh
290+
server-id: central
204291
server-username: MAVEN_USERNAME
205292
server-password: MAVEN_PASSWORD
206293
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
207294
gpg-passphrase: GPG_PASSPHRASE
208295
- name: Publish package
209296
run: mvn --batch-mode deploy -Pjpy-maven-deploy -DskipTests
210297
env:
211-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
212-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
298+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
299+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
213300
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/check.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,51 @@ jobs:
2929

3030
- name: Run Test
3131
run: python setup.py test
32+
33+
- name: Upload JVM Error Logs
34+
uses: actions/upload-artifact@v4
35+
if: failure()
36+
with:
37+
name: check-ci-jvm-err
38+
path: |
39+
**/*_pid*.log
40+
**/core.*
41+
if-no-files-found: ignore
42+
43+
test-free-threaded:
44+
runs-on: ubuntu-22.04
45+
strategy:
46+
matrix:
47+
python: ['3.13t']
48+
java: ['8', '11', '17', '21', '23']
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- uses: actions/setup-java@v4
53+
with:
54+
distribution: 'temurin'
55+
java-version: ${{ matrix.java }}
56+
57+
- uses: astral-sh/setup-uv@v5
58+
- run: |
59+
uv python install ${{ matrix.python }}
60+
uv venv --python ${{ matrix.python }}
61+
source .venv/bin/activate
62+
uv pip install pip
63+
echo $JAVA_HOME
64+
echo PATH=$PATH >> $GITHUB_PATH
65+
66+
- run: pip install "setuptools < 72"
67+
68+
- name: Run Free-threaded Test
69+
run: python setup.py test
70+
71+
- name: Upload JVM Error Logs
72+
uses: actions/upload-artifact@v4
73+
if: failure()
74+
with:
75+
name: check-ci-jvm-err
76+
path: |
77+
**/*_pid*.log
78+
**/core.*
79+
if-no-files-found: ignore

CHANGES.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# jpy Changelog
22

3-
## Version 0.19.0 (in development)
3+
## Version 1.2.0 (in development)
4+
5+
## Version 1.1.0
6+
* [#179](https://github.com/jpy-consortium/jpy/pull/179) Improve libpython search with python's sysconfig INSTSONAME
7+
8+
## Version 1.0.0
9+
* [#176](https://github.com/jpy-consortium/jpy/pull/176) fix: make PyObject cleanup thread-safe in free-threaded Python and reduce contention
10+
* [#175](https://github.com/jpy-consortium/jpy/pull/175) Update project's Development Status classifier
11+
12+
## Version 0.19.0
13+
* [#165](https://github.com/jpy-consortium/jpy/pull/165) feat: free-threaded Python (3.13.0+) support
14+
* [#168](https://github.com/jpy-consortium/jpy/pull/168) Add Python 3.13 builds
15+
* [#164](https://github.com/jpy-consortium/jpy/pull/164) fix: Make org.jpy.PyLib.getCurrentLocals/Globals work for Python 3.13
16+
* [#162](https://github.com/jpy-consortium/jpy/pull/162) Find Zero-Assembler OpenJDK 21
417

518
## Version 0.18.0
619
* [#158](https://github.com/jpy-consortium/jpy/pull/158) Get the correct computed tb lineno

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ languages. It comes with a number of outstanding features:
2020
* Java arrays translate into Python sequence objects
2121
* Java API for accessing Python objects (`jpy.jar`)
2222

23-
jpy has been tested with Python 3.4–3.8 and OpenJDK 8 on 64-bit Ubuntu Linux,
24-
Windows 10, and macOS.
23+
jpy has been tested with Python 3.6–3.13 and OpenJDK 8+ on Linux, Windows, and macOS.
2524

2625
The initial development of jpy was driven by the need to write Python
2726
extensions to an established scientific imaging application programmed in
2827
Java, namely the [SNAP](http://step.esa.int/) toolbox, the SeNtinel
2928
Application Platform project, funded by the [European Space
3029
Agency](http://www.esa.int/ESA) (ESA). (jpy is bundled with the SNAP
31-
distribution.)
30+
distribution.) Current development and maintenance is funded by [Deephaven](https://deephaven.io).
3231

3332
Writing such Python plug-ins for a Java application usually requires a
3433
bi-directional communication between Python and Java since the Python
@@ -108,20 +107,6 @@ Running Tests
108107

109108
Run: `python setup.py build test`
110109

111-
Automated builds
112-
----------------
113-
114-
As of 2020-08-27, [Python wheel](https://pythonwheels.com/) packages for jpy
115-
are automatically built on
116-
[AppVeyor](https://ci.appveyor.com/project/bcdev/jpy), but at present they are
117-
uploaded only to a private FTP server and not publicly released. Wheels are
118-
built for Python versions 3.4, 3.5, 3.6, 3.7, and 3.8 on Linux, Windows, and
119-
macOS (≥10.9). Only 64-bit wheels are built.
120-
121-
The repository also contains an outdated configuration for [automated Travis
122-
builds](https://travis-ci.org/github/bcdev/jpy), but this configuration is
123-
currently unmaintained and broken.
124-
125110
Code Of Conduct
126111
---------------
127112

RELEASE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The wheel artifacts are compatible with the table below, and released to the PyP
1616
| 3.11 | Linux | x86_64 |
1717
| 3.12 | Linux | x86_64 |
1818
| 3.13 | Linux | x86_64 |
19+
| 3.13t | Linux | x86_64 |
1920
| 3.6 | Linux | arm64 |
2021
| 3.7 | Linux | arm64 |
2122
| 3.8 | Linux | arm64 |
@@ -24,6 +25,7 @@ The wheel artifacts are compatible with the table below, and released to the PyP
2425
| 3.11 | Linux | arm64 |
2526
| 3.12 | Linux | arm64 |
2627
| 3.13 | Linux | arm64 |
28+
| 3.13t | Linux | arm64 |
2729
| 3.6 | MacOS | x86_64 |
2830
| 3.7 | MacOS | x86_64 |
2931
| 3.8 | MacOS | x86_64 |
@@ -32,6 +34,7 @@ The wheel artifacts are compatible with the table below, and released to the PyP
3234
| 3.11 | MacOS | x86_64 |
3335
| 3.12 | MacOS | x86_64 |
3436
| 3.13 | MacOS | x86_64 |
37+
| 3.13t | MacOS | x86_64 |
3538
| 3.6 | MacOS | arm64 |
3639
| 3.7 | MacOS | arm64 |
3740
| 3.8 | MacOS | arm64 |
@@ -40,6 +43,7 @@ The wheel artifacts are compatible with the table below, and released to the PyP
4043
| 3.11 | MacOS | arm64 |
4144
| 3.12 | MacOS | arm64 |
4245
| 3.13 | MacOS | arm64 |
46+
| 3.13t | MacOS | arm64 |
4347
| 3.6 | Windows | x86_64 |
4448
| 3.7 | Windows | x86_64 |
4549
| 3.8 | Windows | x86_64 |
@@ -48,6 +52,7 @@ The wheel artifacts are compatible with the table below, and released to the PyP
4852
| 3.11 | Windows | x86_64 |
4953
| 3.12 | Windows | x86_64 |
5054
| 3.13 | Windows | x86_64 |
55+
| 3.13t | Windows | x86_64 |
5156

5257
## Process
5358

jpyutil.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
__author__ = "Norman Fomferra (Brockmann Consult GmbH) and contributors"
3737
__copyright__ = "Copyright 2015-2018 Brockmann Consult GmbH and contributors"
3838
__license__ = "Apache 2.0"
39-
__version__ = "0.19.0.dev0"
39+
__version__ = "1.2.0.dev0"
4040

4141

4242
# Setup a dedicated logger for jpyutil.
@@ -303,9 +303,13 @@ def _find_python_dll_file(fail=False):
303303
logger.debug("Searching for Python shared library file")
304304

305305
# Prepare list of search directories
306-
307306
search_dirs = [sys.prefix]
308307

308+
# installed_base/lib needs to be added to the search path for Python 3.13t files
309+
installed_base = sysconfig.get_config_var('installed_base')
310+
if installed_base:
311+
search_dirs.append(os.path.join(installed_base, "lib"))
312+
309313
extra_search_dirs = [sysconfig.get_config_var(name) for name in PYTHON_LIB_DIR_CONFIG_VAR_NAMES]
310314
for extra_dir in extra_search_dirs:
311315
if extra_dir and extra_dir not in search_dirs and os.path.exists(extra_dir):
@@ -325,20 +329,34 @@ def _find_python_dll_file(fail=False):
325329
logger.debug("Potential Python shared library search dirs: %s" % repr(search_dirs))
326330

327331
# Prepare list of possible library file names
332+
# Prefer "Install .so name" as first candidate for file_names
333+
instsoname = sysconfig.get_config_var("INSTSONAME")
334+
file_names = [ instsoname ] if instsoname else []
335+
336+
# account for Python debug builds
337+
338+
debug_build = sysconfig.get_config_var('Py_DEBUG')
339+
340+
# account for Python 3.13+ with GIL disabled
341+
dll_suffix = ''
342+
if sys.version_info >= (3, 13):
343+
if not sys._is_gil_enabled():
344+
dll_suffix = 't'
345+
dll_suffix += 'd' if debug_build else ''
328346

329347
vmaj = str(sys.version_info.major)
330348
vmin = str(sys.version_info.minor)
331349

332350
if platform.system() == 'Windows':
333-
versions = (vmaj + vmin, vmaj, '')
334-
file_names = ['python' + v + '.dll' for v in versions]
351+
versions = (vmaj + vmin, vmaj, vmaj + vmin + dll_suffix, '')
352+
file_names += ['python' + v + '.dll' for v in versions]
335353
elif platform.system() == 'Darwin':
336-
versions = (vmaj + "." + vmin, vmaj, '')
337-
file_names = ['libpython' + v + '.dylib' for v in versions] + \
338-
['libpython' + v + '.so' for v in versions]
354+
versions = (vmaj + "." + vmin, vmaj, vmaj + "." + vmin + dll_suffix, '')
355+
file_names += ['libpython' + v + '.dylib' for v in versions]
356+
file_names += ['libpython' + v + '.so' for v in versions]
339357
else:
340-
versions = (vmaj + "." + vmin, vmaj, '')
341-
file_names = ['libpython' + v + '.so' for v in versions]
358+
versions = (vmaj + "." + vmin, vmaj, vmaj + "." + vmin + dll_suffix, '')
359+
file_names += ['libpython' + v + '.so' for v in versions]
342360

343361
logger.debug("Potential Python shared library file names: %s" % repr(file_names))
344362

0 commit comments

Comments
 (0)