From 0900bbf59c5e79d6751967864d38035dd298b665 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Sun, 15 Oct 2023 16:24:30 +0200 Subject: [PATCH 1/7] docs: add how to install awkward for PyCall.jl --- src/pycall/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/pycall/README.md diff --git a/src/pycall/README.md b/src/pycall/README.md new file mode 100644 index 0000000..73f9a57 --- /dev/null +++ b/src/pycall/README.md @@ -0,0 +1,26 @@ +[PyCall](https://github.com/JuliaPy/PyCall.jl) is currently configured to use the Julia-specific Python distribution +installed by the [Conda.jl](https://github.com/JuliaPy/Conda.jl) package. + + conda create --name ak-julia + conda activate ak-julia + conda install -c conda-forge awkward + +```julia +using Conda +Conda.add("awkward") +``` + +```julia +using PyCall + +@pyimport awkward + +py""" +import awkward as ak + def test(): + print(ak.__version__) +""" + +py"test"() +2.4.6 +``` From 40b585b897d40428238f454d78dc926a08bf2407 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Sun, 15 Oct 2023 16:46:11 +0200 Subject: [PATCH 2/7] Update src/pycall/README.md Co-authored-by: Jerry Ling --- src/pycall/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pycall/README.md b/src/pycall/README.md index 73f9a57..d84d5eb 100644 --- a/src/pycall/README.md +++ b/src/pycall/README.md @@ -13,7 +13,7 @@ Conda.add("awkward") ```julia using PyCall -@pyimport awkward +const ak = pyimport("awkward") py""" import awkward as ak From 6eb2360ce2d3acc976ef45a47c6eb0c3681cdea0 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Sun, 15 Oct 2023 16:46:24 +0200 Subject: [PATCH 3/7] Update src/pycall/README.md Co-authored-by: Jerry Ling --- src/pycall/README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pycall/README.md b/src/pycall/README.md index d84d5eb..1f2f743 100644 --- a/src/pycall/README.md +++ b/src/pycall/README.md @@ -15,12 +15,8 @@ using PyCall const ak = pyimport("awkward") -py""" -import awkward as ak - def test(): - print(ak.__version__) -""" +test() = println(ak.__version__) -py"test"() +test() 2.4.6 ``` From bae438c1bb838129422e994210187a369b0464bc Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Thu, 19 Oct 2023 16:39:30 +0200 Subject: [PATCH 4/7] test: add Dates and other dependencies --- Project.toml | 7 +++++++ src/AwkwardArray.jl | 17 +++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index df54d98..ef688eb 100644 --- a/Project.toml +++ b/Project.toml @@ -5,6 +5,13 @@ version = "1.0.0-DEV" [deps] JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d" +Debugger = "31a5f54b-26ea-5ae9-a837-f05ce5417438" +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" +OhMyREPL = "5fb14364-9ced-5910-84b2-373655c76a03" +PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" +Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" [compat] julia = "1.8" diff --git a/src/AwkwardArray.jl b/src/AwkwardArray.jl index 9b01a95..b6f0425 100644 --- a/src/AwkwardArray.jl +++ b/src/AwkwardArray.jl @@ -1,6 +1,7 @@ module AwkwardArray import JSON +import Dates ### Index ################################################################ @@ -272,10 +273,10 @@ function _to_buffers!( primitive = "complex64" elseif ITEM == Complex{Float64} primitive = "complex128" - # elseif ITEM <: Dates.DateTime # FIXME - # primitive = "datetime64" - # elseif ITEM <: Dates.TimePeriod # FIXME - # primitive = "timedelta64" + elseif ITEM <: DateTime + primitive = "datetime64" + elseif ITEM <: TimePeriod + primitive = "timedelta64" else error( "PrimitiveArray has an ITEM type that can't be serialized in the to_buffers protocol: $ITEM", @@ -3113,10 +3114,10 @@ function from_buffers( data = reinterpret(Complex{Float32}, buffer) elseif primitive == "complex128" data = reinterpret(Complex{Float64}, buffer) - # elseif primitive == "datetime64" - # FIXME: Dates.DateTime - # elseif primitive == "timedelta64" - # FIXME: Dates.TimePeriod + elseif primitive == "datetime64" + data = reinterpret(DateTime, buffer) + elseif primitive == "timedelta64" + data = reinterpret(TimePeriod, buffer) else error( "unrecognized \"primitive\": $(repr(primitive)) in \"class\": \"$class\" node", From b3cce9e83e3eb6df0b207878cde5c40c711dc618 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 15 Nov 2023 18:01:13 +0100 Subject: [PATCH 5/7] remove unneeded dependencies --- Project.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Project.toml b/Project.toml index 332e3d1..52e1677 100644 --- a/Project.toml +++ b/Project.toml @@ -5,13 +5,7 @@ version = "1.0.0-DEV" [deps] JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d" -Debugger = "31a5f54b-26ea-5ae9-a837-f05ce5417438" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" -IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" -OhMyREPL = "5fb14364-9ced-5910-84b2-373655c76a03" -PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" -Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] From 1d0b93e98b63aefb2dc051586fc5a3b9f7f8b52f Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 15 Nov 2023 18:02:13 +0100 Subject: [PATCH 6/7] Update README.md --- src/pycall/README.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/pycall/README.md b/src/pycall/README.md index 1f2f743..8b13789 100644 --- a/src/pycall/README.md +++ b/src/pycall/README.md @@ -1,22 +1 @@ -[PyCall](https://github.com/JuliaPy/PyCall.jl) is currently configured to use the Julia-specific Python distribution -installed by the [Conda.jl](https://github.com/JuliaPy/Conda.jl) package. - conda create --name ak-julia - conda activate ak-julia - conda install -c conda-forge awkward - -```julia -using Conda -Conda.add("awkward") -``` - -```julia -using PyCall - -const ak = pyimport("awkward") - -test() = println(ak.__version__) - -test() -2.4.6 -``` From a2fbf9ebebcd767f02bfa7f59b257bb98ca2b524 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 15 Nov 2023 18:02:34 +0100 Subject: [PATCH 7/7] Delete src/pycall/README.md --- src/pycall/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/pycall/README.md diff --git a/src/pycall/README.md b/src/pycall/README.md deleted file mode 100644 index 8b13789..0000000 --- a/src/pycall/README.md +++ /dev/null @@ -1 +0,0 @@ -