-
Notifications
You must be signed in to change notification settings - Fork 5
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
Stop using Memento #116
Stop using Memento #116
Conversation
@@ -59,8 +58,6 @@ export JLSOFile | |||
const READABLE_VERSIONS = semver_spec("1, 2, 3, 4") | |||
const WRITEABLE_VERSIONS = semver_spec("3, 4") | |||
|
|||
const LOGGER = getlogger(@__MODULE__) | |||
__init__() = Memento.register(LOGGER) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
@@ -82,7 +82,7 @@ function Base.read(io::IO, ::Type{JLSOFile}) | |||
) | |||
) | |||
catch e | |||
warn(LOGGER, e) | |||
@warn exception=e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
@warn exception=e | |
@warn exception = e |
supported || throw(ArgumentError( | ||
"Unsupported version ($version). Expected a value between ($valid_versions)." | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
supported || throw(ArgumentError( | |
"Unsupported version ($version). Expected a value between ($valid_versions)." | |
)) | |
return supported || throw( | |
ArgumentError( | |
"Unsupported version ($version). Expected a value between ($valid_versions).", | |
), | |
) |
@@ -53,7 +53,7 @@ function getindex(jlso::JLSOFile, name::Symbol) | |||
decompressing_buffer = decompress(jlso.compression, buffer) | |||
return deserialize(jlso.format, decompressing_buffer) | |||
catch e | |||
warn(LOGGER, e) | |||
@warn exception=e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
@warn exception=e | |
@warn exception = e |
@@ -16,13 +16,13 @@ upgrade step. Won't be needed once the v2 file format is dropped. | |||
The project generated is accurate, except for duplicated names (no UUID) and custom branchs. | |||
""" | |||
function upgrade(src, dest) | |||
info(LOGGER, "Upgrading $src -> $dest") | |||
@info "Upgrading" src dest | |||
jlso = open(io -> read(io, JLSOFile), src) | |||
write(dest, jlso) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
write(dest, jlso) | |
return write(dest, jlso) |
"Failed to construct an environment with the provide package version " * | ||
"($pkgs): $e.\n Falling back to simply adding the packages." | ||
end | ||
"\nFalling back to simply adding the packages.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
"\nFalling back to simply adding the packages.", | |
"\nFalling back to simply adding the packages.", |
end | ||
"\nFalling back to simply adding the packages.", | ||
pkgs, | ||
exception=e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
exception=e | |
exception = e |
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | ||
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" | ||
|
||
[compat] | ||
BSON = "0.2.4, 0.3" | ||
CodecZlib = "0.6, 0.7" | ||
FilePathsBase = "0.7, 0.8, 0.9" | ||
Memento = "0.10, 0.11, 0.12, 0.13, 1" | ||
TimeZones = "0.9, 0.10, 0.11, 1" | ||
TimeZones = "0.9, 0.10, 0.11, ~1.0, ~1.1, ~1.2, ~1.3, ~1.4, ~1.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to this PR.
CI has actually been broken for ages.
https://github.com/invenia/JLSO.jl/actions/runs/1428133005
This is because we have specimen files that were saved with TimeZones prior to v1.5.
Codecov Report
@@ Coverage Diff @@
## master #116 +/- ##
==========================================
- Coverage 97.67% 97.66% -0.02%
==========================================
Files 6 6
Lines 215 214 -1
==========================================
- Hits 210 209 -1
Misses 5 5
Continue to review full report at Codecov.
|
I'm still not convinced, but then I actively dislike Julia's base logging system. Since we haven't changed the core file format in a while, we aren't likely to hit those upgrade logs. I still think Memento probably shouldn't depend directly on TimeZones.jl, and it should be an optional dependency instead. If you manage to get CI passing then I'll just merge. https://github.com/invenia/Memento.jl/blob/master/src/records.jl#L160 |
Here's an alternate fix which makes TimeZones.jl an optional dependency of Memento.jl invenia/Memento.jl#182.
|
I'm gonna close this since the specific issue was fixed in Memento.jl, feel free to re-open if you disagree. |
Closes #114 which will make dealing with data that was saves with different version of TimeZones.jl better.
Will also avoid other TimeZones related suffering hit by JLSO uses (cc @ablaom) like:
Test.@test_logs
is more annoying to work with thanMemento.@test_warn
see JuliaLang/julia#43016.This because
@warn exception=e
doesn't converte
to a string as part of message so@test_logs
doesn't accept a regex to apply to it.Because of that we only test if a warning was given rather than what it says.
The change to the package code (rather than the test code) is pretty minimal
This PR should only be merged if @rofinn is convinced.