8000 Configure cjdk behavior via scyjava.config by ctrueden · Pull Request #83 · scijava/scyjava · GitHub
[go: up one dir, main page]

Skip to content

Configure cjdk behavior via scyjava.config #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Add Java bootstrapping example to documentation
  • Loading branch information
ctrueden committed Apr 30, 2025
commit 630ff9db34113017857d02a5fa1a4dcab53fd3d5
16 changes: 16 additions & 0 deletions src/scyjava/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@
+++oo*OO######O**oo+++++oo*OO######O**oo+++++oo*OO######O**oo+++
+++oo*OO######OO*oo+++++oo*OO######OO*oo+++++oo*OO######OO*oo+++

Bootstrap a Java installation:

>>> from scyjava import config, jimport
>>> config.set_java_constraints(fetch=True, vendor='zulu', version='17')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I was about to request you as a reviewer, but... 🚀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i noticed the brief addition of add_kwargs ... I assume it's coming elsewhere. my only comment was gonna be whether that might be too generic? (though I know it matches add_options). perhaps add_jvm_kwargs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, rather than deprecate the term options in favor of jvm_options, I decided to just leave it and call the kwargs kwargs, to maintain a foolish consistency. We could of course deprecate both in favor of clearer names.

The reason it appeared only "briefly" is because I ended up moving a bunch of unrelated (to this PR) commits over to main, which included the kwargs addition.

Note that I screwed up releasing scyjava 1.11.0: it does not include this PR, even though it had been merged, because I forgot to fast-forward my local main branch. So I then immediately did so and released 1.12.0 as well. The only "harm" there is that 1.11.0 now contains the fetch_java keyword argument to start_jvm which I then removed, breaking SemVer. But hopefully no one will use 1.11.0 and then complain about this. 😅

>>> System = jimport('java.lang.System')
cjdk: Installing JDK zulu:17.0.15 to /home/chuckles/.cache/cjdk
Download 100% of 189.4 MiB |##########| Elapsed Time: 0:00:02 Time: 0:00:02
Extract | | # | 714 Elapsed Time: 0:00:01
cjdk: Installing Maven to /home/chuckles/.cache/cjdk
Download 100% of 8.7 MiB |##########| Elapsed Time: 0:00:00 Time: 0:00:00
Extract | |# | 102 Elapsed Time: 0:00:00
>>> System.getProperty('java.vendor')
'Azul Systems, Inc.'
>>> System.getProperty('java.version')
'17.0.15'

Convert Java collections to Python:

>>> from scyjava import jimport
Expand Down
Loading
0