diff --git a/README.md b/README.md index 3542410..eb3127b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Supercharged Java access from Python. Built on [JPype](https://jpype.readthedocs.io/en/latest/) -and [jgo](https://github.com/scijava/jgo). +and [jgo](https://github.com/apposed/jgo). ## Use Java classes from Python @@ -83,7 +83,7 @@ u'1.8.0_152-release' +++oo*OO######OO*oo+++++oo*OO######OO*oo+++++oo*OO######OO*oo+++ ``` -See the [jgo documentation](https://github.com/scijava/jgo) for more about Maven endpoints. +See the [jgo documentation](https://github.com/apposed/jgo) for more about Maven endpoints. ## Bootstrap a Java installation diff --git a/pyproject.toml b/pyproject.toml index 2fa3933..f9db9cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,11 @@ include-package-data = false where = ["src"] namespaces = false +[tool.pytest.ini_options] +filterwarnings = [ + "default::DeprecationWarning", +] + [tool.ruff] line-length = 88 src = ["src", "tests"] @@ -77,3 +82,6 @@ extend-ignore = ["E203"] [tool.ruff.lint.per-file-ignores] # Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`. "__init__.py" = ["E402", "F401"] + +[tool.uv.sources] +jgo = { path = "/Volumes/Code/apposed/jgo", editable = true } diff --git a/src/scyjava/_jvm.py b/src/scyjava/_jvm.py index 1bd8017..3ed976e 100644 --- a/src/scyjava/_jvm.py +++ b/src/scyjava/_jvm.py @@ -15,7 +15,7 @@ import jpype import jpype.config -from jgo import jgo +import jgo import scyjava.config from scyjava.config import Mode, mode @@ -156,18 +156,26 @@ def start_jvm(options: Sequence[str] = None) -> None: # get endpoints and add to JPype class path if len(endpoints) > 0: + # sort endpoints list, except for the first one endpoints = endpoints[:1] + sorted(endpoints[1:]) _logger.debug("Using endpoints %s", endpoints) - _, workspace = jgo.resolve_dependencies( - "+".join(endpoints), - m2_repo=scyjava.config.get_m2_repo(), + + # join endpoints list to single concatenated endpoint + endpoint = "+".join(endpoints) + + env = jgo.build( + endpoint=endpoint, + #update=False, cache_dir=scyjava.config.get_cache_dir(), - manage_dependencies=scyjava.config.get_manage_deps(), repositories=repositories, - verbose=scyjava.config.get_verbose(), - shortcuts=scyjava.config.get_shortcuts(), + # The following obsolete arguments are from jgo v1: + #m2_repo=scyjava.config.get_m2_repo(), + #manage_dependencies=scyjava.config.get_manage_deps(), + #verbose=scyjava.config.get_verbose(), + #shortcuts=scyjava.config.get_shortcuts(), ) - jpype.addClassPath(os.path.join(workspace, "*")) + jpype.addClassPath(env.modules_dir / "*") + jpype.addClassPath(env.jars_dir / "*") # HACK: Try to set JAVA_HOME if it isn't already. if ( diff --git a/src/scyjava/config.py b/src/scyjava/config.py index cfab9d8..7d046fa 100644 --- a/src/scyjava/config.py +++ b/src/scyjava/config.py @@ -7,7 +7,9 @@ from typing import Sequence import jpype as _jpype -from jgo import maven_scijava_repository as _scijava_public + + +_SCIJAVA_PUBLIC = "https://maven.scijava.org/content/groups/public" _logger = _logging.getLogger(__name__) @@ -21,7 +23,7 @@ endpoints: list[str] = [] -_repositories = {"scijava.public": _scijava_public()} +_repositories = {"scijava.public": _SCIJAVA_PUBLIC} _verbose = 0 _manage_deps = True _cache_dir = Path.home() / ".jgo"