From a83e3537ef2e1fe3825a3dc87abdb2eac2b9c72b Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 13:33:45 +0200
Subject: [PATCH 01/12] kill pirates

---
 src/export/generic.jl     |  4 +--
 src/export/jld2wrapper.jl | 61 +++++++++++++++++++++++++++++----------
 2 files changed, 48 insertions(+), 17 deletions(-)

diff --git a/src/export/generic.jl b/src/export/generic.jl
index b7db702..dbad0df 100644
--- a/src/export/generic.jl
+++ b/src/export/generic.jl
@@ -15,7 +15,7 @@ function backend(filename::String)
         error("File appears to be a $modulename file but library is not loaded.")
     end
     if modulename == :JLD2
-        return JLD2.JLDFile
+        return JLD2Wrapper
     elseif modulename == :HDF5
         return H5Wrapper
     else
@@ -927,7 +927,7 @@ function write_sim(filename, sim::Simulation; dumprng = true)
         Base.require(Main, modulename)
         return Base.invokelatest(write_sim, filename, sim; dumprng)
     elseif modulename == :JLD2
-        FT = JLD2.JLDFile
+        FT = JLD2Wrapper
     elseif modulename == :HDF5
         FT = H5Wrapper
     else
diff --git a/src/export/jld2wrapper.jl b/src/export/jld2wrapper.jl
index 3d640d9..a92f1a3 100644
--- a/src/export/jld2wrapper.jl
+++ b/src/export/jld2wrapper.jl
@@ -1,24 +1,41 @@
+export JLD2Wrapper
 using .JLD2
 
+
+const JLD2Obj = Union{JLD2.JLDFile, JLD2.Group}
+
+struct JLD2Wrapper{T<:JLD2Obj}
+    _handle::T
+end
+
+function Base.getindex(j2w::JLD2Wrapper, key)
+    item = j2w._handle[key]
+    return item isa JLD2Obj ? JLD2Wrapper(item) : item
+end
+
+Base.get(j2w::JLD2Wrapper, key, default) = get(j2w._handle, key, default)
+
+Base.setindex!(j2w::JLD2Wrapper, val, key) = setindex!(j2w._handle, val, key)
+# For backwards compatibility with HDF5 write all SArrays as Arrays
+Base.setindex!(j2w::JLD2Wrapper, value::SArray, key::String) = setindex!(j2w, collect(value), key)
+# use writedict for recursive dicts
+Base.setindex!(j2w::JLD2Wrapper, value::Dict{String, Any}, key::String) = InPartS.writedict(j2w, value; name = key)
+
+
 # InPartS IO Backend API
-dfopen(type::Type{JLD2.JLDFile}, filename::String, mode::String = "r") = JLD2.jldopen(filename, mode)
+InPartS.dfopen(::Type{<:JLD2Wrapper}, filename::String, mode::String = "r") = JLD2Wrapper(JLD2.jldopen(filename, mode))
 
-dfclose(f::JLD2.JLDFile) = close(f)
-function dfrename(::Type{JLD2.JLDFile}, oldname, newname; force = false)
+InPartS.dfclose(j2w::JLD2Wrapper) = close(j2w._handle)
+
+function InPartS.dfrename(::Type{JLD2Wrapper}, oldname, newname; force = false)
     cp(oldname, newname; force = force)
     rm(oldname)
 end
 
-gcreate(g::Union{JLD2.JLDFile, JLD2.Group}, name::String; kwargs...) = JLD2.Group(g, name; kwargs...)
-
-isgroup(g::Union{JLD2.JLDFile, JLD2.Group}, key) = (g[key] isa JLD2.Group)
-Base.length(g::Union{JLD2.JLDFile, JLD2.Group}) = length(keys(g))
+InPartS.gcreate(g::JLD2Wrapper, name::String; kwargs...) = JLD2.Group(g._handle, name; kwargs...)
 
-# For backwards compatibility with HDF5 write all SArrays as Arrays
-Base.setindex!(g::JLD2.Group, value::SArray, key::String) = setindex!(g, collect(value), key)
-Base.setindex!(g::JLD2.JLDFile, value::SArray, key::String) = setindex!(g, collect(value), key)
-Base.setindex!(g::JLD2.Group, value::Dict{String, Any}, key::String) = InPartS.writedict(g, value; name = key)
-Base.setindex!(g::JLD2.JLDFile, value::Dict{String, Any}, key::String) = InPartS.writedict(g, value; name = key)
+InPartS.isgroup(g::JLD2Wrapper, key) = (g[key] isa JLD2Wrapper{<:JLD2Group})
+Base.length(g::JLD2Wrapper) = length(keys(g._handle))
 
 
 
@@ -27,7 +44,8 @@ Base.setindex!(g::JLD2.JLDFile, value::Dict{String, Any}, key::String) = InPartS
 # to preserve nestedness
 # is faster than generic version in generic.jl because reading via `g[k]`
 # only happens once
-function readdict(g::Union{JLD2.JLDFile, JLD2.Group}; kwargs...)
+function InPartS.readdict(j2w::JLD2Wrapper; kwargs...)
+    g = j2w._handle
     d = Dict{String, Any}()
     for k in keys(g)
         v = g[k]
@@ -39,5 +57,18 @@ function readdict(g::Union{JLD2.JLDFile, JLD2.Group}; kwargs...)
     end
     return d
 end
-    
-readdict(d::Dict) = d
+
+InPartS.readdict(d::Dict) = d
+
+
+
+# legacy stuff
+InPartS.dfopen(::Type{<:JLD2.JLDFile}, args...; kwargs...) = dfopen(JLD2Wrapper, args...; kwargs...)
+InPartS.dfclose(df::JLD2.JLDFile) = dfclose(JLD2Wrapper(df))
+InPartS.dfrename(df::Type{<:JLD2.JLDFile}, args...; kwargs...) = InPartS.dfrename(JLD2Wrapper, args...; kwargs...)
+ # fully automatic wrapping
+for fun ∈ [:readdict, :readdomain, :readobstacles, :readparams, :readrng, :readsim, :readsnap, :readstatic, :readtype, :numsnaps, :lastfullsnap]
+    @eval InPartS.$(fun)(d::JLD2Obj, args...; kwargs...) = InPartS.$(fun)(JLD2Wrapper(d), args...; kwargs...)
+end
+
+InPartS.readsnap!(sim::Simulation, df::JLD2.JLDFile, args...; kwargs...) = InPartS.readsnap!(sim::Simulation, JLD2Wrapper(df), args...; kwargs...)
-- 
GitLab


From fcbfd204e702bb7293f6c0f11777968153f2b7d6 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 13:46:28 +0200
Subject: [PATCH 02/12] maybe resolve ambiguity

---
 src/export/generic.jl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/export/generic.jl b/src/export/generic.jl
index dbad0df..4a3cded 100644
--- a/src/export/generic.jl
+++ b/src/export/generic.jl
@@ -30,9 +30,9 @@ Open the data file at `filename`.
 
 Mode specifications follow [`Base.open`](@ref).
 """
-dfopen(type::Type, filename::String, mode::String) = dfopen(type, filename; modetoflags(mode)...)
-dfopen(@nospecialize(type::Type), filename::String; kwargs...) = error("Unknown export backend: $type")
-dfopen(filename::String, mode::String="r") = dfopen(backend(filename), filename, mode)
+dfopen(type::Type, filename, mode) = dfopen(type, filename; modetoflags(mode)...)
+dfopen(@nospecialize(type::Type), filename; kwargs...) = error("Unknown export backend: $type")
+dfopen(filename::String, mode="r") = dfopen(backend(filename), filename, mode)
 
 function dfopen(f::Function, args...; kwargs...)
     file = dfopen(args...; kwargs...)
-- 
GitLab


From 30fb3e0fc1b5c7f6f5509d03abf4f8114a0576d2 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 13:50:26 +0200
Subject: [PATCH 03/12] missing functions

---
 src/export/jld2wrapper.jl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/export/jld2wrapper.jl b/src/export/jld2wrapper.jl
index a92f1a3..aca45e4 100644
--- a/src/export/jld2wrapper.jl
+++ b/src/export/jld2wrapper.jl
@@ -21,6 +21,8 @@ Base.setindex!(j2w::JLD2Wrapper, value::SArray, key::String) = setindex!(j2w, co
 # use writedict for recursive dicts
 Base.setindex!(j2w::JLD2Wrapper, value::Dict{String, Any}, key::String) = InPartS.writedict(j2w, value; name = key)
 
+Base.keys(j2w::JLD2Wrapper) = keys(j2w._handle)
+Base.haskey(j2w::JLD2Wrapper, k) = haskey(j2w._handle, k)
 
 # InPartS IO Backend API
 InPartS.dfopen(::Type{<:JLD2Wrapper}, filename::String, mode::String = "r") = JLD2Wrapper(JLD2.jldopen(filename, mode))
-- 
GitLab


From f4f80e8f82aa7e8f4f06b38476001327a0f5e9e7 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 15:26:42 +0200
Subject: [PATCH 04/12] more fixes

---
 src/export/jld2wrapper.jl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/export/jld2wrapper.jl b/src/export/jld2wrapper.jl
index aca45e4..4f3f183 100644
--- a/src/export/jld2wrapper.jl
+++ b/src/export/jld2wrapper.jl
@@ -13,7 +13,7 @@ function Base.getindex(j2w::JLD2Wrapper, key)
     return item isa JLD2Obj ? JLD2Wrapper(item) : item
 end
 
-Base.get(j2w::JLD2Wrapper, key, default) = get(j2w._handle, key, default)
+Base.get(j2w::JLD2Wrapper, key, default) = haskey(j2w, key) ? j2w[key] : default
 
 Base.setindex!(j2w::JLD2Wrapper, val, key) = setindex!(j2w._handle, val, key)
 # For backwards compatibility with HDF5 write all SArrays as Arrays
-- 
GitLab


From 08a428f308f61144087867365d4437f49426c54e Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 16:08:04 +0200
Subject: [PATCH 05/12] more fixes

---
 src/export/jld2wrapper.jl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/export/jld2wrapper.jl b/src/export/jld2wrapper.jl
index 4f3f183..00ec0ae 100644
--- a/src/export/jld2wrapper.jl
+++ b/src/export/jld2wrapper.jl
@@ -26,15 +26,15 @@ Base.haskey(j2w::JLD2Wrapper, k) = haskey(j2w._handle, k)
 
 # InPartS IO Backend API
 InPartS.dfopen(::Type{<:JLD2Wrapper}, filename::String, mode::String = "r") = JLD2Wrapper(JLD2.jldopen(filename, mode))
-
 InPartS.dfclose(j2w::JLD2Wrapper) = close(j2w._handle)
+Base.close(j2w::JLD2Wrapper{<:JLD2.JLDFile}) = close(j2w._handle) # for lazy people
 
 function InPartS.dfrename(::Type{JLD2Wrapper}, oldname, newname; force = false)
     cp(oldname, newname; force = force)
     rm(oldname)
 end
 
-InPartS.gcreate(g::JLD2Wrapper, name::String; kwargs...) = JLD2.Group(g._handle, name; kwargs...)
+InPartS.gcreate(g::JLD2Wrapper, name::String; kwargs...) = JLD2Wrapper(JLD2.Group(g._handle, name; kwargs...))
 
 InPartS.isgroup(g::JLD2Wrapper, key) = (g[key] isa JLD2Wrapper{<:JLD2Group})
 Base.length(g::JLD2Wrapper) = length(keys(g._handle))
-- 
GitLab


From d7686640344b25c0ea62dd256ed9604be1594858 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 16:51:53 +0200
Subject: [PATCH 06/12] default snap for readsim

---
 src/export/generic.jl | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/export/generic.jl b/src/export/generic.jl
index 4a3cded..1ed2337 100644
--- a/src/export/generic.jl
+++ b/src/export/generic.jl
@@ -496,13 +496,14 @@ end
 ## Convenience function for reading things
 
 """
-    readsim(filename; snap, [warn = IOWARN[]], [kwargs...])
-    readsim(f; snap, [warn = IOWARN[]], [kwargs...])
-Read a simulation from file and load the specified snapshot.
+readsim(f; snap = InPartS.lastfullsnap(f), [warn = IOWARN[]], [kwargs...])
+readsim(filename; snap, [warn = IOWARN[]], [kwargs...])
+Read a simulation from file and load the specified snapshot. Defaults to the last full snapshot
+(see [`lastfullsnap`](@ref)).
 
 Additional keyword arguments are passed through to [`readstatic!`](@ref) and [`readsnap`](@ref).
 """
-function readsim(f; snap, warn = IOWARN[], kwargs...)
+function readsim(f; snap = lastfullsnap(f), warn = IOWARN[], kwargs...)
     sim = readstatic(f; warn, kwargs...)
     try
         readsnap!(sim, f, snap; warn, kwargs...)
-- 
GitLab


From d43f303c877a4ba79f1e8211a0ad925978aed84e Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 16:52:18 +0200
Subject: [PATCH 07/12] =?UTF-8?q?backends=20=E2=86=92=20extensions?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Project.toml                                |  5 +++++
 src/export/h5wrapper.jl => ext/HDF5Ext.jl   | 21 +++++++++++++--------
 src/export/jld2wrapper.jl => ext/JLD2Ext.jl | 13 +++++++++----
 src/InPartS.jl                              | 20 ++++++++++++--------
 src/export/generic.jl                       | 12 +++++-------
 5 files changed, 44 insertions(+), 27 deletions(-)
 rename src/export/h5wrapper.jl => ext/HDF5Ext.jl (78%)
 rename src/export/jld2wrapper.jl => ext/JLD2Ext.jl (90%)

diff --git a/Project.toml b/Project.toml
index 7055263..b101ed1 100644
--- a/Project.toml
+++ b/Project.toml
@@ -16,6 +16,11 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
 StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
 Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
 
+[weakdeps]
+JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
+
+[extensions]
+JLD2Ext = "JLD2"
 
 [compat]
 julia = "1.7"
diff --git a/src/export/h5wrapper.jl b/ext/HDF5Ext.jl
similarity index 78%
rename from src/export/h5wrapper.jl
rename to ext/HDF5Ext.jl
index f5fffd6..716bfcf 100644
--- a/src/export/h5wrapper.jl
+++ b/ext/HDF5Ext.jl
@@ -1,12 +1,15 @@
-export H5Wrapper
+module HDF5Ext
 
-using .HDF5
+using InPartS, HDF5
 
 
 struct H5Wrapper{T<:Union{HDF5.File, HDF5.Group}}
     handle::T
 end
 
+InPartS._backend(::Val{:HDF5}) = H5Wrapper
+
+
 """
     H5Wrapper(filename; [kwargs...]) → H5Wrapper{HDF5.File}
     H5Wrapper(filename, mode::String) → H5Wrapper{HDF5.File}
@@ -48,21 +51,23 @@ Base.setindex!(h5w::H5Wrapper, value::SArray, key::String) = setindex!(h5w.handl
 Base.get(h5w::H5Wrapper, key::String, default) = exists(h5w.handle, key) ? h5w[key] : default
 
 # InPartS IO Backend API
-dfopen(::Type{H5Wrapper}, name::String; flags...) = H5Wrapper(name; flags...)
-dfclose(h5w::H5Wrapper{HDF5.File}) = close(h5w.handle)
-function dfrename(::Type{H5Wrapper}, oldname, newname; force = false)
+InPartS.dfopen(::Type{H5Wrapper}, name::String; flags...) = H5Wrapper(name; flags...)
+InPartS.dfclose(h5w::H5Wrapper{HDF5.File}) = close(h5w.handle)
+function InPartS.dfrename(::Type{H5Wrapper}, oldname, newname; force = false)
     cp(oldname, newname; force = force)
     rm(oldname)
 end
 
-gcreate(h5w::H5Wrapper, name::String; kwargs...) = H5Wrapper(HDF5.create_group(h5w.handle, name))
+InPartS.gcreate(h5w::H5Wrapper, name::String; kwargs...) = H5Wrapper(HDF5.create_group(h5w.handle, name))
 Base.keys(h5w::H5Wrapper) = keys(h5w.handle)
 Base.haskey(h5w::H5Wrapper, k::AbstractString) = haskey(h5w.handle, k)
 
-isgroup(h5w::H5Wrapper, key) = !(h5w.handle[key] isa HDF5.Dataset)
+InPartS.isgroup(h5w::H5Wrapper, key) = !(h5w.handle[key] isa HDF5.Dataset)
 Base.length(h5w::H5Wrapper) = length(h5w.handle)
 
 
 
 # more efficient readdict
-readdict(h5w::H5Wrapper; kwargs...) = read(h5w.handle)
+InPartS.readdict(h5w::H5Wrapper; kwargs...) = read(h5w.handle)
+
+end
\ No newline at end of file
diff --git a/src/export/jld2wrapper.jl b/ext/JLD2Ext.jl
similarity index 90%
rename from src/export/jld2wrapper.jl
rename to ext/JLD2Ext.jl
index 00ec0ae..1e8a21a 100644
--- a/src/export/jld2wrapper.jl
+++ b/ext/JLD2Ext.jl
@@ -1,5 +1,6 @@
-export JLD2Wrapper
-using .JLD2
+module JLD2Ext
+
+using InPartS, JLD2
 
 
 const JLD2Obj = Union{JLD2.JLDFile, JLD2.Group}
@@ -25,6 +26,8 @@ Base.keys(j2w::JLD2Wrapper) = keys(j2w._handle)
 Base.haskey(j2w::JLD2Wrapper, k) = haskey(j2w._handle, k)
 
 # InPartS IO Backend API
+InPartS._backend(::Val{:JLD2}) = JLD2Wrapper
+
 InPartS.dfopen(::Type{<:JLD2Wrapper}, filename::String, mode::String = "r") = JLD2Wrapper(JLD2.jldopen(filename, mode))
 InPartS.dfclose(j2w::JLD2Wrapper) = close(j2w._handle)
 Base.close(j2w::JLD2Wrapper{<:JLD2.JLDFile}) = close(j2w._handle) # for lazy people
@@ -65,8 +68,8 @@ InPartS.readdict(d::Dict) = d
 
 
 # legacy stuff
-InPartS.dfopen(::Type{<:JLD2.JLDFile}, args...; kwargs...) = dfopen(JLD2Wrapper, args...; kwargs...)
-InPartS.dfclose(df::JLD2.JLDFile) = dfclose(JLD2Wrapper(df))
+InPartS.dfopen(::Type{<:JLD2.JLDFile}, args...; kwargs...) = InPartS.dfopen(JLD2Wrapper, args...; kwargs...)
+InPartS.dfclose(df::JLD2.JLDFile) = InPartS.dfclose(JLD2Wrapper(df))
 InPartS.dfrename(df::Type{<:JLD2.JLDFile}, args...; kwargs...) = InPartS.dfrename(JLD2Wrapper, args...; kwargs...)
  # fully automatic wrapping
 for fun ∈ [:readdict, :readdomain, :readobstacles, :readparams, :readrng, :readsim, :readsnap, :readstatic, :readtype, :numsnaps, :lastfullsnap]
@@ -74,3 +77,5 @@ for fun ∈ [:readdict, :readdomain, :readobstacles, :readparams, :readrng, :rea
 end
 
 InPartS.readsnap!(sim::Simulation, df::JLD2.JLDFile, args...; kwargs...) = InPartS.readsnap!(sim::Simulation, JLD2Wrapper(df), args...; kwargs...)
+
+end
\ No newline at end of file
diff --git a/src/InPartS.jl b/src/InPartS.jl
index 0518a43..e874704 100644
--- a/src/InPartS.jl
+++ b/src/InPartS.jl
@@ -189,16 +189,20 @@ function __init__()
 
 
     # EXPORT BACKENDS
-
-    @require HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" begin
-        include("export/h5wrapper.jl")
-        @info "InPartS: HDF5 export enabled"
-    end
-    @require JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" begin
-        include("export/jld2wrapper.jl")
-        @info "InPartS: JLD2 export enabled"
+    # fallback if no extensions available
+    @static if !isdefined(Base, :get_extension)
+        @require HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" begin
+            include("../ext/HDF5Ext.jl")
+            @info "InPartS: HDF5 export enabled"
+        end
+
+        @require JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" begin
+            include("../ext/JLD2Ext.jl")
+            @info "InPartS: JLD2 export enabled"
+        end
     end
 
+
     # Use Requires infrastructure to warn if legacy version is ever loaded simultaneously
     legacyInPartS = Base.PkgId(Base.UUID("385f2a1c-27df-41b8-9918-2c5d735168af"), "InPartS")
     Requires.listenpkg(legacyInPartS) do
diff --git a/src/export/generic.jl b/src/export/generic.jl
index 1ed2337..10e0485 100644
--- a/src/export/generic.jl
+++ b/src/export/generic.jl
@@ -14,15 +14,13 @@ function backend(filename::String)
     if !isdefined(Main, modulename)
         error("File appears to be a $modulename file but library is not loaded.")
     end
-    if modulename == :JLD2
-        return JLD2Wrapper
-    elseif modulename == :HDF5
-        return H5Wrapper
-    else
-        error("This backend is not implemented")
-    end
+    # this is a hack to get around the fact that extensions cannot export copied
+    # so we can't use the JLD2Wrapper/H5Wrapper types from here
+    return _backend(Val(modulename))
 end
 
+_backend(v) = error("The backend $v is not implemented")
+
 """
     dfopen(backend, filename; kwargs...)
     dfopen(backend, filename, mode::String)
-- 
GitLab


From 24ff064acfa1d3c82f8ec0a1040ec64b50fff1e5 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 16:56:02 +0200
Subject: [PATCH 08/12] fix

---
 src/export/generic.jl | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/export/generic.jl b/src/export/generic.jl
index 10e0485..a20ff6f 100644
--- a/src/export/generic.jl
+++ b/src/export/generic.jl
@@ -920,18 +920,7 @@ A function for whenever you just need to save the ~~world~~ simulation.
 
 """
 function write_sim(filename, sim::Simulation; dumprng = true)
-    s = FileIO.query(filename; checkfile=true)
-    modulename = typeof(s).parameters[1].parameters[1]
-    if !isdefined(InPartS, modulename)
-        Base.require(Main, modulename)
-        return Base.invokelatest(write_sim, filename, sim; dumprng)
-    elseif modulename == :JLD2
-        FT = JLD2Wrapper
-    elseif modulename == :HDF5
-        FT = H5Wrapper
-    else
-        error("This backend is not implemented")
-    end
+    FT = backend(filename)
     dfopen(FT, filename, "w") do f
         writestatic(f, sim)
         writesnap(f[SNAPGROUPNAME], sim; name = "0", dumprng)
-- 
GitLab


From ef400ca49cd65be41ccfabd60a9bfc900b25bb88 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 17:29:42 +0200
Subject: [PATCH 09/12] forgot to register extension

---
 Project.toml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Project.toml b/Project.toml
index b101ed1..1c477a6 100644
--- a/Project.toml
+++ b/Project.toml
@@ -18,9 +18,11 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
 
 [weakdeps]
 JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
+HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
 
 [extensions]
 JLD2Ext = "JLD2"
+HDF5Ext = "HDF5
 
 [compat]
 julia = "1.7"
-- 
GitLab


From b45d801e75284a50dc4af09ce65d40044bd2acca Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 17:49:13 +0200
Subject: [PATCH 10/12] typo

---
 Project.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Project.toml b/Project.toml
index 1c477a6..95180cd 100644
--- a/Project.toml
+++ b/Project.toml
@@ -22,7 +22,7 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
 
 [extensions]
 JLD2Ext = "JLD2"
-HDF5Ext = "HDF5
+HDF5Ext = "HDF5"
 
 [compat]
 julia = "1.7"
-- 
GitLab


From 4d48ab683ed205ab296f74190598e01eb644ed28 Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 18:01:14 +0200
Subject: [PATCH 11/12] ugb

---
 ext/HDF5Ext.jl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/HDF5Ext.jl b/ext/HDF5Ext.jl
index 716bfcf..57524a3 100644
--- a/ext/HDF5Ext.jl
+++ b/ext/HDF5Ext.jl
@@ -41,7 +41,7 @@ end
 # dictionary-like access
 function Base.getindex(h5w::H5Wrapper, key::String)
     item = h5w.handle[key]
-    return isgroup(h5w, key) ? H5Wrapper(item) : read(item)
+    return InPartS.isgroup(h5w, key) ? H5Wrapper(item) : read(item)
 end
 Base.setindex!(h5w::H5Wrapper, value, key::String) = setindex!(h5w.handle, value, key)
 Base.setindex!(h5w::H5Wrapper, value::Dict{String, Any}, key::String) = InPartS.writedict(h5w, value; name = key)
-- 
GitLab


From 9e4120142c5de5555bd1e49535329c476842c89a Mon Sep 17 00:00:00 2001
From: Lukas Hupe <lukas.hupe@ds.mpg.de>
Date: Thu, 27 Jul 2023 18:09:32 +0200
Subject: [PATCH 12/12] aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaA

---
 ext/JLD2Ext.jl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/JLD2Ext.jl b/ext/JLD2Ext.jl
index 1e8a21a..da0a3a0 100644
--- a/ext/JLD2Ext.jl
+++ b/ext/JLD2Ext.jl
@@ -55,7 +55,7 @@ function InPartS.readdict(j2w::JLD2Wrapper; kwargs...)
     for k in keys(g)
         v = g[k]
         if v isa JLD2.Group
-            d[k] = readdict(v)
+            d[k] = InPartS.readdict(v)
         else
             d[k] = v
         end
-- 
GitLab