Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Dates #41

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 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
7 changes: 7 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
ianna marked this conversation as resolved.
Show resolved Hide resolved
ianna marked this conversation as resolved.
Show resolved Hide resolved
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
Expand Down
17 changes: 9 additions & 8 deletions src/AwkwardArray.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module AwkwardArray

import JSON
import Dates
import Tables

### Index ################################################################
Expand Down Expand Up @@ -274,10 +275,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",
Expand Down Expand Up @@ -3117,10 +3118,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",
Expand Down
22 changes: 22 additions & 0 deletions src/pycall/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[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
```