Skip to content

Commit a6730c0

Browse files
Make jill an optional dependency with lazy import
Previously, jill was a hard dependency that was imported at module load time. This meant diffeqpy would fail to import if jill was not installed, even when Julia was already present on the system. Changes: - Remove top-level import of jill.install - Lazy import jill only when Julia needs to be installed - Move jill to optional extras_require in setup.py - Provide clear error message when jill is needed but not installed This allows users with Julia already installed to use diffeqpy without installing jill, while still providing automatic Julia installation for users who want it via: pip install diffeqpy[julia-install] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b0ce7ce commit a6730c0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

diffeqpy/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import shutil
2-
from jill.install import install_julia
32

43
# juliacall must be loaded after `_ensure_julia_installed()` is run,
54
# so this import is in `load_julia_packages()`
@@ -12,6 +11,13 @@ def _find_julia():
1211
def _ensure_julia_installed():
1312
if not _find_julia():
1413
print("No Julia version found. Installing Julia.")
14+
try:
15+
from jill.install import install_julia
16+
except ImportError:
17+
raise RuntimeError(
18+
"Julia is not installed and the 'jill' package is not available. "
19+
"Please install Julia manually or install jill: pip install jill"
20+
)
1521
install_julia()
1622
if not _find_julia():
1723
raise RuntimeError(
@@ -61,6 +67,13 @@ def install(*, confirm=False):
6167
julia = _find_julia()
6268
if not julia:
6369
print("No Julia version found. Installing Julia.")
70+
try:
71+
from jill.install import install_julia
72+
except ImportError:
73+
raise RuntimeError(
74+
"Julia is not installed and the 'jill' package is not available. "
75+
"Please install Julia manually or install jill: pip install jill"
76+
)
6477
install_julia(confirm=confirm)
6578
julia = _find_julia()
6679
if not julia:

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def readme():
2828
author_email='[email protected]',
2929
license='MIT',
3030
packages=['diffeqpy','diffeqpy.tests'],
31-
install_requires=['juliacall>=0.9.14', 'jill'],
31+
install_requires=['juliacall>=0.9.14'],
32+
extras_require={
33+
'julia-install': ['jill']
34+
},
3235
include_package_data=True,
3336
zip_safe=False)

0 commit comments

Comments
 (0)