From 3e9851696be128e058caa829efa3bbc404797a88 Mon Sep 17 00:00:00 2001 From: Moelf Date: Fri, 3 Nov 2023 15:38:43 +0100 Subject: [PATCH 1/7] Set `compiled_modules=False` automatically --- src/julia/core.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/julia/core.py b/src/julia/core.py index 183298c4..016fe075 100644 --- a/src/julia/core.py +++ b/src/julia/core.py @@ -482,11 +482,17 @@ def __init__(self, init_julia=True, jl_init_path=None, runtime=None, logger.debug("use_custom_sysimage = %r", use_custom_sysimage) logger.debug("compiled_modules = %r", options.compiled_modules) if not ( - options.compiled_modules == "no" - or is_compatible_python + is_compatible_python or use_custom_sysimage ): - raise UnsupportedPythonError(jlinfo) + if options.compiled_modules == "yes": + raise UnsupportedPythonError(jlinfo) + else: + warnings.warn( + "Statically linked Python interpreter detected, setting `compiled_modules=False` automatically." + ) + options.compiled_modules = "no" + self.api.init_julia(options) From 48f1b8eb66a576fb3588592339d33cb3d5e063eb Mon Sep 17 00:00:00 2001 From: Jerry Ling Date: Fri, 3 Nov 2023 13:17:04 -0400 Subject: [PATCH 2/7] Update src/julia/core.py Co-authored-by: Miles Cranmer --- src/julia/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia/core.py b/src/julia/core.py index 016fe075..35896999 100644 --- a/src/julia/core.py +++ b/src/julia/core.py @@ -485,7 +485,7 @@ def __init__(self, init_julia=True, jl_init_path=None, runtime=None, is_compatible_python or use_custom_sysimage ): - if options.compiled_modules == "yes": + if options.compiled_modules in (True, "yes"): raise UnsupportedPythonError(jlinfo) else: warnings.warn( From 791c8f1c003347a08f23d503d5847028e09a1579 Mon Sep 17 00:00:00 2001 From: Jerry Ling Date: Fri, 3 Nov 2023 13:17:10 -0400 Subject: [PATCH 3/7] Update src/julia/core.py Co-authored-by: Miles Cranmer --- src/julia/core.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/julia/core.py b/src/julia/core.py index 35896999..1a67873e 100644 --- a/src/julia/core.py +++ b/src/julia/core.py @@ -487,6 +487,8 @@ def __init__(self, init_julia=True, jl_init_path=None, runtime=None, ): if options.compiled_modules in (True, "yes"): raise UnsupportedPythonError(jlinfo) + elif options.compiled_modules in (False, "no"): + pass else: warnings.warn( "Statically linked Python interpreter detected, setting `compiled_modules=False` automatically." From deff2c9d581d6c3952adbf1212d2ca623d027193 Mon Sep 17 00:00:00 2001 From: Moelf Date: Fri, 3 Nov 2023 18:18:33 +0100 Subject: [PATCH 4/7] add auto as default --- src/julia/tests/test_juliaoptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia/tests/test_juliaoptions.py b/src/julia/tests/test_juliaoptions.py index cb82953a..32136949 100644 --- a/src/julia/tests/test_juliaoptions.py +++ b/src/julia/tests/test_juliaoptions.py @@ -17,7 +17,7 @@ (dict(min_optlevel=2), ["--min-optlevel=2"]), (dict(threads="auto", optimize=3), ["--optimize=3", '--threads=auto']), (dict(optimize=3, threads="auto"), ["--optimize=3", '--threads=auto']), # passed order doesn't matter - (dict(compiled_modules=None, depwarn="yes"), ["--depwarn=yes"]), + (dict(compiled_modules="auto", depwarn="yes"), ["--depwarn=yes"]), ]) # fmt: on def test_as_args(kwargs, args): From bfca4a2043229a0bee8d4ea41bfd31e10904e532 Mon Sep 17 00:00:00 2001 From: Moelf Date: Fri, 3 Nov 2023 18:45:48 +0100 Subject: [PATCH 5/7] add auto as default --- src/julia/options.py | 2 +- src/julia/tests/test_juliaoptions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/julia/options.py b/src/julia/options.py index 00ba9801..56150236 100644 --- a/src/julia/options.py +++ b/src/julia/options.py @@ -165,7 +165,7 @@ class JuliaOptions(object): sysimage = String("sysimage") bindir = String("bindir") - compiled_modules = Choices("compiled_modules", yes_no_etc()) + compiled_modules = Choices("compiled_modules", yes_no_etc(), "auto") compile = Choices("compile", yes_no_etc("all", "min")) depwarn = Choices("depwarn", yes_no_etc("error")) warn_overwrite = Choices("warn_overwrite", yes_no_etc()) diff --git a/src/julia/tests/test_juliaoptions.py b/src/julia/tests/test_juliaoptions.py index 32136949..cb82953a 100644 --- a/src/julia/tests/test_juliaoptions.py +++ b/src/julia/tests/test_juliaoptions.py @@ -17,7 +17,7 @@ (dict(min_optlevel=2), ["--min-optlevel=2"]), (dict(threads="auto", optimize=3), ["--optimize=3", '--threads=auto']), (dict(optimize=3, threads="auto"), ["--optimize=3", '--threads=auto']), # passed order doesn't matter - (dict(compiled_modules="auto", depwarn="yes"), ["--depwarn=yes"]), + (dict(compiled_modules=None, depwarn="yes"), ["--depwarn=yes"]), ]) # fmt: on def test_as_args(kwargs, args): From 76a54904782ea43df4ecb30fa830c40957019270 Mon Sep 17 00:00:00 2001 From: Jerry Ling Date: Fri, 3 Nov 2023 13:53:50 -0400 Subject: [PATCH 6/7] Update src/julia/options.py Co-authored-by: Miles Cranmer --- src/julia/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia/options.py b/src/julia/options.py index 56150236..8289d523 100644 --- a/src/julia/options.py +++ b/src/julia/options.py @@ -165,7 +165,7 @@ class JuliaOptions(object): sysimage = String("sysimage") bindir = String("bindir") - compiled_modules = Choices("compiled_modules", yes_no_etc(), "auto") + compiled_modules = Choices("compiled_modules", yes_no_etc("auto")) compile = Choices("compile", yes_no_etc("all", "min")) depwarn = Choices("depwarn", yes_no_etc("error")) warn_overwrite = Choices("warn_overwrite", yes_no_etc()) From d35b213f406a2ed2d23dad9dbed4577fb9397c64 Mon Sep 17 00:00:00 2001 From: Miles Cranmer Date: Mon, 1 Jan 2024 09:43:56 +0000 Subject: [PATCH 7/7] Fix docs for `compiled_modules` --- src/julia/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia/options.py b/src/julia/options.py index 8289d523..ae033150 100644 --- a/src/julia/options.py +++ b/src/julia/options.py @@ -119,7 +119,7 @@ def yes_no_etc(*etc): compile: {True, False, 'yes', 'no', 'all', 'min'} Enable or disable JIT compiler, or request exhaustive compilation. -compiled_modules: {True, False, 'yes', 'no'} +compiled_modules: {True, False, 'yes', 'no', 'auto'} Enable or disable incremental precompilation of modules. depwarn: {True, False, 'yes', 'no', 'error'}