Save-only error on newly registered file type with custom package
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 228
- Forks
- 81
- Avg merge
- 1d 29m
- Merged PRs (30d)
- 1
Description
@maucejo 's https://github.com/maucejo/UFFFiles.jl was recently merged into the FileIO registry.
For my work, I have a custom package that handles similar files.
To handle the load / save logic, so far, I used the following in my package.
function load(f::File{format"UNV"})
...
end
function save(f::File{format"UNV"}, data)
...
end
detect_unv(io) = endswith(io.name, ".unv>") || endswith(io.name, ".uff>")
function __init__()
add_format(format"UNV", detect_unv, [".unv", ".uff"], [MyPackage])
end
Since 1.18, which is the introduction of UFFFiles in the registry, my tests fail for save, but load works fine.
ERROR: ArgumentError: Package UFFFiles [20c5726e-8372-4c34-be2c-190a5a70d483] is required but does not seem to be installed
I could have expected that both success (as in previous FileIO versions) or fail, but I don't understand a partial fail.
Any ideas what could be the reason ?
I've attempted to make a MWE, but in a module, not totally a package, so the init-equivalent step may not be relevant as such.
using Pkg
Pkg.activate("TestFileIO")
Pkg.add(name="FileIO", version="1.17")
unvname = joinpath(tempdir(), "test.unv")
write(unvname, "test")
module TempFileIO
using FileIO
function load(f::File{FileIO.format"UNV"})
open(f, "r") do s
String(take!(s.io))
end
end
function save(f::File{FileIO.format"UNV"}, data)
open(f, "w") do s
write(s.io, data)
end
end
detect_unv(io) = endswith(io.name, ".unv>") || endswith(io.name, ".uff>")
add_loader(format"UNV", detect_unv, [".unv", ".uff"], [TempFileIO])
end
using .TempFileIO
using FileIO
load(unvname) # Works regardless of version
save(unvname, "test") # Fails in 1.18+ since UFF is registered
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided TestFileIO environment and the module's load, save, detect_unv, and add_loader entry points. Compare resolution before and after registering UFFFiles, then determine why save requires UFFFiles while load succeeds. Done means the behavior is consistent and the provided MWE succeeds or reports a clear, intentional error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100