Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyversion }}

- name: Check Python OpenSSL version (see setup_julia)
shell: python
run: |
import ssl
assert ssl.OPENSSL_VERSION_INFO < (3, 5)

- name: Set up uv
uses: astral-sh/setup-uv@v6
Expand All @@ -94,7 +100,9 @@ jobs:
id: setup_julia
uses: julia-actions/setup-julia@v2
with:
version: '1'
# Python in the GitHub runners ships with OpenSSL 3.0. Julia 1.12 requires
# OpenSSL 3.5. Therefore juliapkg requires Julia 1.11 or lower.
version: '1.11'

- name: Set up test Julia project
if: ${{ matrix.juliaexe == 'julia' }}
Expand Down
11 changes: 8 additions & 3 deletions CondaPkg.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
[deps.libstdcxx]

[deps.openssl]
version = "<=julia"

[deps.libstdcxx-ng]
[deps.libstdcxx]
version = "<=julia"

[deps.openssl]
[deps.libstdcxx-ng]
version = "<=julia"

[deps.python]
build = "**cpython**"
version = ">=3.9,<4"

[dev.deps]
matplotlib = ""
pyside6 = ""
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ UnsafePointers = "e17b2a0c-0bdf-430a-bd0c-3a23cae4ff39"
[compat]
Aqua = "0 - 999"
CategoricalArrays = "0.10, 1"
CondaPkg = "0.2.30"
CondaPkg = "0.2.33"
Dates = "1"
Libdl = "1"
MacroTools = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
"Operating System :: OS Independent",
]
requires-python = ">=3.9, <4"
dependencies = ["juliapkg >=0.1.17, <0.2"]
dependencies = ["juliapkg >=0.1.21, <0.2"]

[dependency-groups]
dev = [
Expand Down
2 changes: 1 addition & 1 deletion src/Compat/gui.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function init_gui()

# add a hook to automatically call fix_qt_plugin_path()
fixqthook =
Py(() -> (Core.CONFIG.auto_fix_qt_plugin_path && fix_qt_plugin_path(); nothing))
Py(() -> (PythonCall.CONFIG.auto_fix_qt_plugin_path && fix_qt_plugin_path(); nothing))
pymodulehooks.add_hook("PyQt4", fixqthook)
pymodulehooks.add_hook("PyQt5", fixqthook)
pymodulehooks.add_hook("PySide", fixqthook)
Expand Down
2 changes: 1 addition & 1 deletion src/Core/stdlib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function init_stdlib()
class JuliaCompatHooks:
def __init__(self):
self.hooks = {}
def find_module(self, name, path=None):
def find_spec(self, name, path=None, target=None):
hs = self.hooks.get(name)
if hs is not None:
for h in hs:
Expand Down
5 changes: 3 additions & 2 deletions src/JlWrap/any.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ function pyjlany_setattr(self, k_::Py, v_::Py)
v = pyconvert(Any, v_)
if self isa Module && !isdefined(self, k)
# Fix for https://github.com/JuliaLang/julia/pull/54678
Base.Core.eval(self, Expr(:global, k))
@eval self (global $k = $v)
else
setproperty!(self, k, v)
end
setproperty!(self, k, v)
Py(nothing)
end
pyjl_handle_error_type(::typeof(pyjlany_setattr), self, exc) = pybuiltins.AttributeError
Expand Down
19 changes: 15 additions & 4 deletions test/Compat.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
@testitem "gui" begin
@testitem "gui" setup=[Setup] begin
@testset "fix_qt_plugin_path" begin
@test PythonCall.fix_qt_plugin_path() isa Bool
# second time is a no-op
@test PythonCall.fix_qt_plugin_path() === false
end
@testset "event_loop_on/off" begin
for g in [:pyqt4, :pyqt5, :pyside, :pyside2, :pyside6, :gtk, :gtk3, :wx]
@testset "$g" for g in [:pyqt4, :pyqt5, :pyside, :pyside2, :pyside6, :gtk, :gtk3, :wx]
# TODO: actually test the various GUIs somehow?
@show g
@test_throws PyException PythonCall.event_loop_on(g)
if Setup.devdeps && g == :pyside6
# pyside6 is installed as a dev dependency
# AND it's a dependency of matplotlib, which is also a dev dependency
@test PythonCall.event_loop_on(g) isa Timer
else
@test_throws PyException PythonCall.event_loop_on(g)
end
@test PythonCall.event_loop_off(g) === nothing
end
end
@testset "matplotlib issue 676" begin
if Setup.devdeps
plt = pyimport("matplotlib.pyplot")
@test plt.get_backend() isa Py
end
end
end

@testitem "ipython" begin
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
using TestItemRunner

@testmodule Setup begin
using PythonCall
# test if we are in CI
ci = get(ENV, "CI", "") == "true"
# test if we have all dev conda deps
devdeps = PythonCall.C.CTX.which == :CondaPkg
end

@run_package_tests
Loading