Skip to content

Commit 3ef19f4

Browse files
committed
Drop Julia 0.6
1 parent de9c0de commit 3ef19f4

21 files changed

+66
-393
lines changed

.travis.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ python:
66
- "3.6"
77
env:
88
matrix:
9-
- JULIA_VERSION=0.6.4 CROSS_VERSION=1
109
- JULIA_VERSION=1.0
1110
- JULIA_VERSION=nightly
1211
global:
@@ -32,26 +31,13 @@ matrix:
3231
- JULIA_VERSION=1.0
3332
# - JULIA_VERSION=nightly
3433
os: osx
35-
- language: generic
36-
env:
37-
- PYTHON=python2
38-
- JULIA_VERSION=0.6.4
39-
- CROSS_VERSION=1
40-
os: osx
4134
- language: generic
4235
env:
4336
- PYTHON=python3
4437
- PYJULIA_TEST_INCOMPATIBLE_PYTHONS=python2
4538
- JULIA_VERSION=1.0
4639
# - JULIA_VERSION=nightly
4740
os: osx
48-
- language: generic
49-
env:
50-
- PYTHON=python3
51-
- PYJULIA_TEST_INCOMPATIBLE_PYTHONS=python2
52-
- JULIA_VERSION=0.6.4
53-
- CROSS_VERSION=1
54-
os: osx
5541

5642
# Upload the package to `test.pypi.org` when there is a push to
5743
# `release/test` branch:
@@ -124,18 +110,6 @@ script:
124110
fi
125111
- echo "$PYJULIA_TEST_INCOMPATIBLE_PYTHONS"
126112

127-
# "py,py27" below would be redundant when the main interpreter is
128-
# Python 2.7 but it simplifies the CI setup.
129-
- if [ "$CROSS_VERSION" = "1" ]; then
130-
$PYTHON -m tox -e py,py27;
131-
fi
132-
- if [ "$CROSS_VERSION" = "1" ]; then
133-
cat .tox/py/log/pytest.log;
134-
fi
135-
- if [ "$CROSS_VERSION" = "1" ]; then
136-
cat .tox/py27/log/pytest.log;
137-
fi
138-
139113
- PYJULIA_TEST_REBUILD=yes $PYTHON -m tox -- --cov=julia
140114
- cat .tox/py/log/pytest.log
141115

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PyJulia
66
[![Build Status](https://travis-ci.org/JuliaPy/pyjulia.svg?branch=master)](https://travis-ci.org/JuliaPy/pyjulia)
77
[![Build status](https://ci.appveyor.com/api/projects/status/github/JuliaPy/pyjulia?svg=true)](https://ci.appveyor.com/project/Keno/pyjulia)
88

9-
Experimenting with developing a better interface to [Julia language](https://julialang.org/) that works with [Python](https://www.python.org/) 2 & 3 and Julia v0.6+.
9+
Experimenting with developing a better interface to [Julia language](https://julialang.org/) that works with [Python](https://www.python.org/) 2 & 3 and Julia v1.0+.
1010

1111
Quick usage
1212
-----------

appveyor.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ environment:
77
# for more python versions have a look at
88
# https://github.com/ogrisel/python-appveyor-demo/blob/master/appveyor.yml
99
matrix:
10-
# 32 julia-0.6 Python-35
11-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
12-
PYTHONDIR: "C:\\Python35"
13-
BATDIR: ci\appveyor\win32
14-
CROSS_VERSION: 1
15-
1610
# 32 julia-1.0 Python-35
1711
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/1.0/julia-1.0-latest-win32.exe"
1812
PYTHONDIR: "C:\\Python35"
@@ -23,12 +17,6 @@ environment:
2317
# PYTHONDIR: "C:\\Python35"
2418
# BATDIR: ci\appveyor\win32
2519

26-
# 64 julia-0.6 Python-35
27-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
28-
PYTHONDIR: "C:\\Python35-x64"
29-
BATDIR: ci\appveyor\win64
30-
CROSS_VERSION: 1
31-
3220
# 64 julia-1.0 Python-35
3321
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/1.0/julia-1.0-latest-win64.exe"
3422
PYTHONDIR: "C:\\Python35-x64"
@@ -78,14 +66,6 @@ test_script:
7866
- "SET PATH=%cd%\\%BATDIR%;%PYTHONDIR%;%PYTHONDIR%\\Scripts;C:\\projects\\julia\\bin;%PATH%"
7967
- dir
8068

81-
# Run cross-version tests but ignore the failures (from Python 2).
82-
# Once cross-version in Windows is fmixed, stop using
83-
# Invoke-Expression (which ignores the exit status).
84-
- ps: if ($env:CROSS_VERSION -eq 1) { Invoke-Expression "tox" }
85-
# - ps: if ($env:CROSS_VERSION -eq 1) { tox }
86-
- ps: if ($env:CROSS_VERSION -eq 1) { Invoke-Expression "cat .tox\py\log\pytest.log" }
87-
- ps: if ($env:CROSS_VERSION -eq 1) { Invoke-Expression "cat .tox\py27\log\pytest.log" }
88-
8969
# Rebuild PyCall.ji for each Python interpreter before testing:
9070
- "SET PYJULIA_TEST_REBUILD=yes"
9171
- tox

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Welcome to PyJulia’s documentation!
55

66
Experimenting with developing a better interface to
77
`Julia language <https://julialang.org/>`_ that works with
8-
`Python <https://www.python.org/>`_ 2 & 3 and Julia v0.6+.
8+
`Python <https://www.python.org/>`_ 2 & 3 and Julia v1.0+.
99

1010
PyJulia is tested against Python versions 2.7, 3.5, 3.6, and 3.7.
1111

docs/source/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
See below for more detailed explanations.
2727

2828
**Note:** If you are using Python installed with Ubuntu or ``conda``,
29-
PyJulia may not work with Julia ≥ 0.7. For workarounds, see
29+
PyJulia may not work with the default setting. For workarounds, see
3030
:doc:`Troubleshooting <troubleshooting>`. Same caution applies to any
3131
Debian-based and possibly other GNU/Linux distributions.
3232

@@ -115,7 +115,7 @@ Alternatively, you can use Julia's builtin package manager.
115115

116116
.. code-block:: jlcon
117117
118-
julia> using Pkg # for julia ≥ 0.7
118+
julia> using Pkg
119119
julia> Pkg.add("PyCall")
120120
121121
Note that PyCall must be built with Python executable that is used to

docs/source/troubleshooting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Your Python interpreter is statically linked to libpython
88

99
If you use Python installed with Debian-based Linux distribution such as
1010
Ubuntu or install Python by ``conda``, you might have noticed that
11-
PyJulia cannot be initialized properly with Julia ≥ 0.7. This is because
11+
PyJulia cannot be initialized properly out-of-the-box. This is because
1212
those Python executables are statically linked to libpython. (See
1313
:doc:`limitations` for why that's a problem.)
1414

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def pyload(path):
7575
},
7676
packages=find_packages("src"),
7777
package_dir={"": "src"},
78-
package_data={'julia': ['fake-julia/*', "*.jl"]},
78+
package_data={"julia": ["*.jl"]},
7979
extras_require={
8080
# Update `ci/test-upload/tox.ini` when "test" is changed:
8181
"test": [

src/julia/core.py

Lines changed: 34 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ def is_accessible_name(name):
311311
isprotected(name) or
312312
notascii(name))
313313

314+
# fmt: on
315+
314316

315317
def isdefined(julia, parent, member):
316318
return julia.eval("isdefined({}, :({}))".format(parent, member))
@@ -338,39 +340,6 @@ def determine_if_statically_linked():
338340
return linked_libpython() is None
339341

340342

341-
juliainfo_script = """
342-
println(VERSION < v"0.7.0-DEV.3073" ? JULIA_HOME : Base.Sys.BINDIR)
343-
if VERSION >= v"0.7.0-DEV.3630"
344-
using Libdl
345-
using Pkg
346-
end
347-
println(Libdl.dlpath(string("lib", splitext(Base.julia_exename())[1])))
348-
println(unsafe_string(Base.JLOptions().image_file))
349-
350-
println(VERSION)
351-
println(VERSION.major)
352-
println(VERSION.minor)
353-
println(VERSION.patch)
354-
355-
if VERSION < v"0.7.0"
356-
PyCall_depsfile = Pkg.dir("PyCall","deps","deps.jl")
357-
else
358-
pkg = Base.PkgId(Base.UUID(0x438e738f_606a_5dbb_bf0a_cddfbfd45ab0), "PyCall")
359-
modpath = Base.locate_package(pkg)
360-
if modpath == nothing
361-
PyCall_depsfile = nothing
362-
else
363-
PyCall_depsfile = joinpath(dirname(modpath),"..","deps","deps.jl")
364-
end
365-
end
366-
if PyCall_depsfile !== nothing && isfile(PyCall_depsfile)
367-
include(PyCall_depsfile)
368-
println(pyprogramname)
369-
println(libpython)
370-
end
371-
"""
372-
373-
374343
class JuliaInfo(object):
375344
"""
376345
Information required for initializing Julia runtime.
@@ -417,16 +386,22 @@ def load(cls, julia="julia", **popen_kwargs):
417386
# object file: No such file or directory":
418387
popen_kwargs.setdefault("env", _enviorn)
419388

389+
juliainfo_script = os.path.join(
390+
os.path.dirname(os.path.realpath(__file__)), "juliainfo.jl"
391+
)
420392
proc = subprocess.Popen(
421-
[julia, "--startup-file=no", "-e", juliainfo_script],
393+
[julia, "--startup-file=no", juliainfo_script],
422394
stdout=subprocess.PIPE,
423395
stderr=subprocess.PIPE,
424396
universal_newlines=True,
425-
**popen_kwargs)
397+
**popen_kwargs
398+
)
426399

427400
stdout, stderr = proc.communicate()
428401
retcode = proc.wait()
429402
if retcode != 0:
403+
logger.debug("STDOUT from %s:\n%s", julia, stdout)
404+
logger.debug("STDERR from %s:\n%s", julia, stderr)
430405
if sys.version_info[0] < 3:
431406
output = "\n".join(["STDOUT:", stdout, "STDERR:", stderr])
432407
raise subprocess.CalledProcessError(
@@ -445,9 +420,19 @@ def load(cls, julia="julia", **popen_kwargs):
445420

446421
return cls(julia, *args)
447422

448-
def __init__(self, julia, bindir, libjulia_path, sysimage,
449-
version_raw, version_major, version_minor, version_patch,
450-
python=None, libpython_path=None):
423+
def __init__(
424+
self,
425+
julia,
426+
version_raw,
427+
version_major,
428+
version_minor,
429+
version_patch,
430+
bindir=None,
431+
libjulia_path=None,
432+
sysimage=None,
433+
python=None,
434+
libpython_path=None,
435+
):
451436
self.julia = julia
452437
self.bindir = bindir
453438
self.libjulia_path = libjulia_path
@@ -501,6 +486,9 @@ def is_compatible_exe(jl_libpython):
501486
# `jl_libpython` to be a `str` always.
502487

503488

489+
# fmt: off
490+
491+
504492
def setup_libjulia(libjulia):
505493
# Store the running interpreter reference so we can start using it via self.call
506494
libjulia.jl_.argtypes = [c_void_p]
@@ -951,77 +939,28 @@ def __init__(self, init_julia=True, jl_init_path=None, runtime=None,
951939
self.api = get_libjulia()
952940
elif init_julia:
953941
jlinfo = JuliaInfo.load(runtime)
942+
if jlinfo.version_info < (0, 7):
943+
raise RuntimeError("PyJulia does not support Julia < 0.7 anymore")
944+
954945
self.api = LibJulia.from_juliainfo(jlinfo)
955946

956947
if jl_init_path:
957948
self.api.bindir = jl_init_path
958949

959950
options = JuliaOptions(**julia_options)
960951

961-
use_separate_cache = not (
962-
options.compiled_modules == "no" or jlinfo.is_compatible_python()
963-
)
964-
logger.debug("use_separate_cache = %s", use_separate_cache)
965-
if use_separate_cache:
966-
PYCALL_JULIA_HOME = os.path.join(
967-
os.path.dirname(os.path.realpath(__file__)), "fake-julia").replace("\\", "\\\\")
968-
os.environ["JULIA_HOME"] = PYCALL_JULIA_HOME # TODO: this line can be removed when dropping Julia v0.6
969-
os.environ["JULIA_BINDIR"] = PYCALL_JULIA_HOME
970-
self.api.bindir = PYCALL_JULIA_HOME
952+
is_compatible_python = jlinfo.is_compatible_python()
953+
logger.debug("is_compatible_python = %r", is_compatible_python)
954+
logger.debug("compiled_modules = %r", options.compiled_modules)
955+
if not (options.compiled_modules == "no" or is_compatible_python):
956+
raise_separate_cache_error(runtime, jlinfo)
971957

972958
was_initialized = self.api.jl_is_initialized()
973959
if was_initialized:
974960
set_libjulia(self.api)
975961
else:
976962
self.api.init_julia(options)
977963

978-
if use_separate_cache:
979-
if jlinfo.version_info < (0, 6):
980-
raise RuntimeError(
981-
"PyJulia does not support Julia < 0.6 anymore")
982-
elif jlinfo.version_info >= (0, 7):
983-
raise_separate_cache_error(runtime, jlinfo)
984-
# Intercept precompilation
985-
os.environ["PYCALL_PYTHON_EXE"] = sys.executable
986-
os.environ["PYCALL_JULIA_HOME"] = PYCALL_JULIA_HOME
987-
os.environ["PYJULIA_IMAGE_FILE"] = jlinfo.sysimage
988-
os.environ["PYCALL_LIBJULIA_PATH"] = os.path.dirname(jlinfo.libjulia_path)
989-
# Add a private cache directory. PyCall needs a different
990-
# configuration and so do any packages that depend on it.
991-
self._call(u"unshift!(Base.LOAD_CACHE_PATH, abspath(Pkg.Dir._pkgroot()," +
992-
"\"lib\", \"pyjulia%s-v$(VERSION.major).$(VERSION.minor)\"))" % sys.version_info[0])
993-
994-
# If PyCall.jl is already pre-compiled, for the global
995-
# environment, hide it while we are loading PyCall.jl
996-
# for PyJulia which has to compile a new cache if it
997-
# does not exist. However, Julia does not compile a
998-
# new cache if it exists in Base.LOAD_CACHE_PATH[2:end].
999-
# https://github.com/JuliaPy/pyjulia/issues/92#issuecomment-289303684
1000-
self._call(u"""
1001-
for path in Base.LOAD_CACHE_PATH[2:end]
1002-
cache = joinpath(path, "PyCall.ji")
1003-
backup = joinpath(path, "PyCall.ji.backup")
1004-
if isfile(cache)
1005-
mv(cache, backup; remove_destination=true)
1006-
end
1007-
end
1008-
""")
1009-
1010-
# This is mainly for initiating the precompilation:
1011-
self._call(u"using PyCall")
1012-
1013-
if use_separate_cache:
1014-
self._call(u"""
1015-
for path in Base.LOAD_CACHE_PATH[2:end]
1016-
cache = joinpath(path, "PyCall.ji")
1017-
backup = joinpath(path, "PyCall.ji.backup")
1018-
if !isfile(cache) && isfile(backup)
1019-
mv(backup, cache)
1020-
end
1021-
rm(backup; force=true)
1022-
end
1023-
""")
1024-
1025964
# We are assuming that `jl_is_initialized()` was true only
1026965
# if this process was a Julia process (hence PyCall had
1027966
# already called `atexit(Py_Finalize)`). This is not true

src/julia/fake-julia/Makefile

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/julia/fake-julia/README.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)