Skip to content

Commit 121b36e

Browse files
committed
Add name guard to init
1 parent 698e16e commit 121b36e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pysrc/juliacall/init.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import juliacall as _ # calls init() which calls juliapkg.executable() which lazily downloads julia
1+
if __name__ == '__main__':
2+
import juliacall as _ # calls init() which calls juliapkg.executable() which lazily downloads julia
23

3-
import sys
4-
if "--debug" in sys.argv:
5-
import juliapkg, json
6-
state = juliapkg.state.STATE
7-
state["version"] = str(state["version"])
8-
print(json.dumps(state, indent=2))
9-
else:
10-
print("Initialized successfully. Pass --debug to see the full JuliaPkg state.")
4+
import sys
5+
if "--debug" in sys.argv:
6+
import juliapkg, json
7+
state = juliapkg.state.STATE
8+
state["version"] = str(state["version"])
9+
print(json.dumps(state, indent=2))
10+
else:
11+
print("Initialized successfully. Pass --debug to see the full JuliaPkg state.")

0 commit comments

Comments
 (0)