Skip to content

Commit a2acc1a

Browse files
author
Christopher Rowley
committed
Merge remote-tracking branch 'origin/main' into pr/gnuille/743
2 parents 6cb9c78 + 175f807 commit a2acc1a

File tree

10 files changed

+59
-36
lines changed

10 files changed

+59
-36
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ updates:
1313
directory: /
1414
schedule:
1515
interval: weekly
16+
- package-ecosystem: julia
17+
directory: /
18+
schedule:
19+
interval: weekly

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
## Unreleased
44
* Added `juliacall.TypeValue.__numpy_dtype__` attribute to allow converting Julia types
55
to the corresponding NumPy dtype, like `numpy.dtype(jl.Int)`.
6+
* JuliaCall now launches Julia with 1 thread by default.
67
* Added options `trace_compile` and `trace_compile_timing` to JuliaCall.
8+
* Bug fixes.
79

810
## 0.9.31 (2025-12-17)
911
* Restore support for Python 3.14+.

CondaPkg.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ version = ">=3.10,!=3.14.0,!=3.14.1,<4"
1616
matplotlib = ""
1717
numpy = ""
1818
pyside6 = ""
19+
pandas = ""

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://juliala
1414
- Fast non-copying conversion of numeric arrays in either direction: modify Python arrays (e.g. `bytes`, `array.array`, `numpy.ndarray`) from Julia or Julia arrays from Python.
1515
- Helpful wrappers: interpret Python sequences, dictionaries, arrays, dataframes and IO streams as their Julia counterparts, and vice versa.
1616
- Beautiful stack-traces.
17-
- Supports modern systems: tested on Windows, MacOS and Linux, 64-bit, Julia 1.10 upwards and Python 3.10 upwards.
17+
- Supports modern systems: tested on Windows, MacOS and Linux; 64-bit; Julia 1.10 upwards and Python 3.10 upwards.
1818

1919
⭐ If you like this, a GitHub star would be lovely thank you. ⭐
2020

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Bringing [**Python®**](https://www.python.org/) and [**Julia**](https://juliala
77
- Fast non-copying conversion of numeric arrays in either direction: modify Python arrays (e.g. `bytes`, `array.array`, `numpy.ndarray`) from Julia or Julia arrays from Python.
88
- Helpful wrappers: interpret Python sequences, dictionaries, arrays, dataframes and IO streams as their Julia counterparts, and vice versa.
99
- Beautiful stack-traces.
10-
- Works anywhere: tested on Windows, MacOS and Linux, 32- and 64-bit, Julia Julia 1.10 upwards and Python 3.10 upwards.
10+
- Works anywhere: tested on Windows, MacOS and Linux; 64-bit; Julia 1.10 upwards and Python 3.10 upwards.

pysrc/juliacall/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def args_from_config(config):
173173
CONFIG['opt_optimize'] = choice('optimize', ['0', '1', '2', '3'])[0]
174174
CONFIG['opt_procs'] = int_option('procs', accept_auto=True)[0]
175175
CONFIG['opt_sysimage'] = sysimg = path_option('sysimage', check_exists=True)[0]
176-
CONFIG['opt_threads'] = int_option('threads', accept_auto=True)[0]
176+
CONFIG['opt_threads'] = option('threads', default='1')[0]
177177
CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0]
178178
CONFIG['opt_handle_signals'] = choice('handle_signals', ['yes', 'no'])[0]
179179
CONFIG['opt_startup_file'] = choice('startup_file', ['yes', 'no'])[0]

src/Wrap/Wrap.jl

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,22 @@ function __init__()
5555
pyconvert_add_rule("collections.abc:Mapping", PyDict, pyconvert_rule_mapping, priority)
5656
pyconvert_add_rule("io:IOBase", PyIO, pyconvert_rule_io, priority)
5757
pyconvert_add_rule("_io:_IOBase", PyIO, pyconvert_rule_io, priority)
58-
pyconvert_add_rule(
59-
"pandas.core.frame:DataFrame",
60-
PyPandasDataFrame,
61-
pyconvert_rule_pandasdataframe,
62-
priority,
63-
)
64-
pyconvert_add_rule(
65-
"pandas.core.arrays.base:ExtensionArray",
66-
PyList,
67-
pyconvert_rule_sequence,
68-
priority,
69-
)
58+
for typename in ["pandas.core.frame:DataFrame", "pandas:DataFrame"]
59+
pyconvert_add_rule(
60+
typename,
61+
PyPandasDataFrame,
62+
pyconvert_rule_pandasdataframe,
63+
priority,
64+
)
65+
end
66+
for typename in ["pandas.core.arrays.base:ExtensionArray", "pandas.api.extensions:ExtensionArray"]
67+
pyconvert_add_rule(
68+
typename,
69+
PyList,
70+
pyconvert_rule_sequence,
71+
priority,
72+
)
73+
end
7074

7175
priority = PYCONVERT_PRIORITY_NORMAL
7276
pyconvert_add_rule("<arraystruct>", Array, pyconvert_rule_array, priority)

test/Compat.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,14 @@ end
104104
end
105105
end
106106

107-
@testitem "Tables.jl" begin
107+
@testitem "Tables.jl" setup=[Setup] begin
108108
@testset "pytable" begin
109109
x = (x = [1, 2, 3], y = ["a", "b", "c"])
110110
# pandas
111-
# TODO: install pandas and test properly
112-
@test_throws PyException pytable(x, :pandas)
111+
if Setup.devdeps
112+
y = pytable(x, :pandas)
113+
@test pyeq(Bool, pytype(y), pyimport("pandas").DataFrame)
114+
end
113115
# columns
114116
y = pytable(x, :columns)
115117
@test pyeq(Bool, y, pydict(x = [1, 2, 3], y = ["a", "b", "c"]))

test/Convert.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,19 @@ end
305305
@test_throws Exception pyconvert(Second, td(microseconds = 1000))
306306
end
307307

308+
@testitem "pandas.DataFrame → PyPandasDataFrame" setup=[Setup] begin
309+
if Setup.devdeps
310+
pd = pyimport("pandas")
311+
df = pd.DataFrame()
312+
df2 = pyconvert(PyPandasDataFrame, df)
313+
@test df2 isa PyPandasDataFrame
314+
@test pyis(df2, df)
315+
df3 = pyconvert(PyTable, df)
316+
@test df3 isa PyPandasDataFrame
317+
@test pyis(df3, df)
318+
end
319+
end
320+
308321
@testitem "pyconvert_add_rule (#364)" begin
309322
id = string(rand(UInt128), base = 16)
310323
pyexec(

test/Wrap.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -458,26 +458,23 @@ end
458458
end
459459
end
460460

461-
@testitem "PyPandasDataFrame" begin
461+
@testitem "PyPandasDataFrame" setup=[Setup] begin
462462
using Tables
463463
@test PyPandasDataFrame isa Type
464-
# TODO: figure out how to get pandas into the test environment
465-
# for now use some dummy type and take advantage of the fact that the code doesn't actually check it's a real dataframe
466-
@pyexec """
467-
class DataFrame:
468-
def __init__(self, **kw):
469-
self.__dict__.update(kw)
470-
""" => DataFrame
471-
df = DataFrame(shape = (4, 3), columns = pylist(["foo", "bar", "baz"]))
472-
x = PyPandasDataFrame(df)
473-
@test ispy(x)
474-
@test Py(x) === df
475-
@test Tables.istable(x)
476-
@test Tables.columnaccess(x)
477-
@test_throws Exception Tables.columns(x)
478-
@test_throws Exception pyconvert(PyPandasDataFrame, 1)
479-
str = sprint(show, MIME("text/plain"), x)
480-
@test occursin(r"4×3 .*PyPandasDataFrame", str)
464+
if Setup.devdeps
465+
pd = pyimport("pandas")
466+
df = pd.DataFrame(pydict(foo=pylist([1,2,3,4]), bar=pylist([2,3,4,5]), baz=pylist([3,4,5,6])))
467+
x = PyPandasDataFrame(df)
468+
@test ispy(x)
469+
@test Py(x) === df
470+
@test Tables.istable(x)
471+
@test Tables.columnaccess(x)
472+
# TODO: test the tables interface more fully
473+
Tables.columns(x)
474+
@test_throws Exception pyconvert(PyPandasDataFrame, 1)
475+
str = sprint(show, MIME("text/plain"), x)
476+
@test occursin(r"4×3 .*PyPandasDataFrame", str)
477+
end
481478
end
482479

483480
@testitem "PySet" begin

0 commit comments

Comments
 (0)