jpype-project / jpype

JPype is cross language bridge to allow Python programs full access to Java class libraries.
http://www.jpype.org
Apache License 2.0
1.12k stars 183 forks source link

fix compatibility of jpype with setuptools==72.0.0 #1206

Closed alexrashed closed 3 months ago

alexrashed commented 4 months ago

Motivation

With setuptools==72.0.0, the test command was removed after being deprecated for a long time. This completely breaks the installation of any packages using the test command, including JPype. See https://github.com/pypa/setuptools/issues/4519 for other issue reports. This PR fixes JPype to be compatible with setuptools 72+ again. Fixes https://github.com/jpype-project/jpype/issues/1205.

Changes

Testing

Before:

$ pip install --upgrade setuptools
$ pip install -e .
Obtaining file:///home/.../Repos/kyuubi/python
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/.../Repos/kyuubi/python/setup.py", line 4, in <module>
          from setuptools.command.test import test as TestCommand
      ModuleNotFoundError: No module named 'setuptools.command.test'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

With the code in this PR:

$ pip install --upgrade setuptools
$ pip install -e .
Obtaining file:///home/.../Repos/jpype
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: packaging in ./.venv/lib/python3.11/site-packages (from JPype1==1.5.0.dev0) (24.1)
Building wheels for collected packages: JPype1
  Building editable for JPype1 (pyproject.toml) ... done
  Created wheel for JPype1: filename=JPype1-1.5.0.dev0-0.editable-cp311-cp311-linux_x86_64.whl size=9998 sha256=4783526b2a6725dfa504b1d71cdc5feaa4d4256319c001c0a97c0809905d2e98
  Stored in directory: /tmp/pip-ephem-wheel-cache-6fkq_j06/wheels/ca/b9/cd/ed1acf12ba47865d19baa6a7e9f7464d25608d983055f6fbf6
Successfully built JPype1
Installing collected packages: JPype1
Successfully installed JPype1-1.5.0.dev0
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.44%. Comparing base (653ccff) to head (31339e3). Report is 157 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1206 +/- ## ========================================== + Coverage 87.42% 87.44% +0.01% ========================================== Files 113 113 Lines 10238 10234 -4 Branches 4059 4059 ========================================== - Hits 8951 8949 -2 + Misses 692 691 -1 + Partials 595 594 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Thrameos commented 4 months ago

@marscher are you around? There have been a number of items requiring update recently. If you aren't available for review I will likely have to self review and get the ball rolling towards a release.

pelson commented 3 months ago

If you aren't available for review I will likely have to self review and get the ball rolling towards a release.

I can step up for some review. Particularly on the Python infra side of things. Feel free to ping me.

pelson commented 3 months ago

FWIW, I think this PR is good to go as it is.

Thrameos commented 3 months ago

Thanks. I will start merging. I will also need to finish the patch/kludge for 3.13 before we release.

marscher commented 3 months ago

Sorry for being not available for so long. Thanks for the patch. I think this is pretty straight forward.