Skip to content

Commit 5d62fe6

Browse files
author
Christopher Doris
committed
rename environment variables
1 parent eb10f65 commit 5d62fe6

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- uses: julia-actions/julia-runtest@v1
9090
env:
9191
JULIA_DEBUG: PythonCall
92-
PYTHONJL_EXE: CONDA
92+
JULIA_PYTHONCALL_EXE: CONDA
9393
- uses: julia-actions/julia-processcoverage@v1
9494
- uses: codecov/codecov-action@v1
9595
with:

docs/src/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ packages can always `import juliacall`.
3838

3939
If Julia and Python are in your PATH, then no further set-up is required.
4040
Otherwise, the following environment variables control how the package finds these.
41-
- `PYTHONJL_EXE`: Path to the Python executable. Or the special value `CONDA` which uses
41+
- `JULIA_PYTHONCALL_EXE`: Path to the Python executable. Or the special value `CONDA` which uses
4242
Python from the default conda environment, or `CONDA:{env}` to use the given environment.
43-
- `PYTHONJL_LIB`: Path to the Python library. Normally this is inferred from the Python
43+
- `JULIA_PYTHONCALL_LIB`: Path to the Python library. Normally this is inferred from the Python
4444
executable, but can be over-ridden.
45-
- `JULIAPY_EXE`: Path to the Julia executable.
46-
- `JULIAPY_LIB`: Path to the Julia library. Normally this is inferred from the Julia
45+
- `PYTHON_JULIACALL_EXE`: Path to the Julia executable.
46+
- `PYTHON_JULIACALL_LIB`: Path to the Julia library. Normally this is inferred from the Julia
4747
executable, but can be over-ridden.

juliacall/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
def init():
44
import os, os.path, sys, ctypes as c, types, shutil, subprocess
5-
libpath = os.environ.get('JULIAPY_LIB')
5+
libpath = os.environ.get('PYTHON_JULIACALL_LIB')
66
if libpath is None:
7-
exepath = os.environ.get('JULIAPY_EXE')
7+
exepath = os.environ.get('PYTHON_JULIACALL_EXE')
88
if exepath is None:
99
exepath = shutil.which('julia')
1010
if exepath is None:
11-
raise Exception('Cannot find Julia. Ensure it is in your PATH, set JULIAPY_EXE to its path, or set JULIAPY_LIB to the path to libjuliacall.')
11+
raise Exception('Cannot find Julia. Ensure it is in your PATH, set PYTHON_JULIACALL_EXE to its path, or set PYTHON_JULIACALL_LIB to the path to libjuliacall.')
1212
else:
1313
if not os.path.isfile(exepath):
14-
raise Exception('JULIAPY_EXE=%s does not exist' % repr(exepath))
14+
raise Exception('PYTHON_JULIACALL_EXE=%s does not exist' % repr(exepath))
1515
CONFIG['exepath'] = exepath
1616
libpath = subprocess.run([exepath, '-e', 'import Libdl; print(abspath(Libdl.dlpath("libjulia")))'], stdout=(subprocess.PIPE)).stdout.decode('utf8')
1717
else:
1818
if not os.path.isfile(libpath):
19-
raise Exception('JULIAPY_LIB=%s does not exist' % repr(libpath))
19+
raise Exception('PYTHON_JULIACALL_LIB=%s does not exist' % repr(libpath))
2020
CONFIG['libpath'] = libpath
2121
try:
2222
d = os.getcwd()
@@ -34,7 +34,7 @@ def init():
3434
res = lib.jl_eval_string(
3535
'''
3636
try
37-
ENV["PYTHONJL_LIBPTR"] = "{}"
37+
ENV["JULIA_PYTHONCALL_LIBPTR"] = "{}"
3838
import PythonCall
3939
catch err
4040
@error "Error loading PythonCall.jl" err=err

src/PythonCall.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ include("utils.jl")
3737
pyprogname_w::Vector{Cwchar_t} = []
3838
"True if this is stackless Python."
3939
isstackless::Bool = false
40-
"""True if Julia is embedded into Python (indicated by ENV["PYTHONJL_LIBPTR"] being set)."""
40+
"""True if Julia is embedded into Python (indicated by ENV["JULIA_PYTHONCALL_LIBPTR"] being set)."""
4141
isembedded::Bool = false
4242
"True if the Python interpreter is currently initialized."
4343
isinitialized::Bool = false

src/init.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ end
88

99
@init begin
1010
# Check if libpython is already loaded (i.e. if the Julia interpreter was started from a Python process)
11-
CONFIG.isembedded = haskey(ENV, "PYTHONJL_LIBPTR")
11+
CONFIG.isembedded = haskey(ENV, "JULIA_PYTHONCALL_LIBPTR")
1212

1313
if CONFIG.isembedded
1414
# In this case, getting a handle to libpython is easy
15-
CONFIG.libptr = Ptr{Cvoid}(parse(UInt, ENV["PYTHONJL_LIBPTR"]))
15+
CONFIG.libptr = Ptr{Cvoid}(parse(UInt, ENV["JULIA_PYTHONCALL_LIBPTR"]))
1616
# Check Python is initialized
1717
C.Py_IsInitialized() == 0 && error("Python is not already initialized.")
1818
CONFIG.isinitialized = CONFIG.preinitialized = true
1919
else
2020
# Find Python executable
2121
exepath = something(
2222
CONFIG.exepath,
23-
get(ENV, "PYTHONJL_EXE", nothing),
23+
get(ENV, "JULIA_PYTHONCALL_EXE", nothing),
2424
Sys.which("python3"),
2525
Sys.which("python"),
2626
Some(nothing),
@@ -30,7 +30,7 @@ end
3030
"""
3131
Could not find Python executable.
3232
33-
Ensure 'python3' or 'python' is in your PATH or set environment variable 'PYTHONJL_EXE'
33+
Ensure 'python3' or 'python' is in your PATH or set environment variable 'JULIA_PYTHONCALL_EXE'
3434
to the path to the Python executable.
3535
""",
3636
)
@@ -52,8 +52,8 @@ end
5252
5353
Ensure either:
5454
- python3 or python is in your PATH
55-
- PYTHONJL_EXE is "CONDA" or "CONDA:<env>"
56-
- PYTHONJL_EXE is the path to the Python executable
55+
- JULIA_PYTHONCALL_EXE is "CONDA" or "CONDA:<env>"
56+
- JULIA_PYTHONCALL_EXE is the path to the Python executable
5757
""")
5858
end
5959

@@ -66,7 +66,7 @@ end
6666

6767
# Find Python library
6868
libpath =
69-
something(CONFIG.libpath, get(ENV, "PYTHONJL_LIB", nothing), Some(nothing))
69+
something(CONFIG.libpath, get(ENV, "JULIA_PYTHONCALL_LIB", nothing), Some(nothing))
7070
if libpath !== nothing
7171
libptr = dlopen_e(path, CONFIG.dlopenflags)
7272
if libptr == C_NULL
@@ -91,7 +91,7 @@ end
9191
CONFIG.libpath === nothing && error("""
9292
Could not find Python library for Python executable $(repr(CONFIG.exepath)).
9393
94-
If you know where the library is, set environment variable 'PYTHONJL_LIB' to its path.
94+
If you know where the library is, set environment variable 'JULIA_PYTHONCALL_LIB' to its path.
9595
""")
9696
end
9797

0 commit comments

Comments
 (0)