Skip to content

Commit 15cedc8

Browse files
mkittinhz2LilithHafner
authored
Use public via Meta.parse for Julia 1.10 compatibility (#33)
* Add simple `@public` macro, set compat to Julia 1.10 * Support early development versions of Julia 1.11 * Relax Julia version in tests as well * Remove trailing commas * Update ChunkCodecCore/src/ChunkCodecCore.jl Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> * Apply suggestions from code review Co-authored-by: Mark Kittisopikul <mkitti@users.noreply.github.com> --------- Co-authored-by: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
1 parent 3655020 commit 15cedc8

File tree

15 files changed

+119
-43
lines changed

15 files changed

+119
-43
lines changed

ChunkCodecCore/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ authors = ["nhz2 <nhz2@cornell.edu>"]
44
version = "0.4.0"
55

66
[compat]
7-
julia = "1.11"
7+
julia = "1.10"

ChunkCodecCore/src/ChunkCodecCore.jl

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,46 @@ module ChunkCodecCore
22

33
export decode, encode
44

5-
public Codec
6-
public EncodeOptions
7-
public DecodeOptions
5+
if VERSION >= v"1.11.0-DEV.469"
6+
eval(Meta.parse("""
7+
public
8+
Codec,
9+
EncodeOptions,
10+
DecodeOptions,
811
9-
public DecodingError
10-
public DecodedSizeError
12+
DecodingError,
13+
DecodedSizeError,
1114
12-
public decode_options
15+
decode_options,
1316
14-
public decoded_size_range
15-
public encode_bound
16-
public try_encode!
17+
decoded_size_range,
18+
encode_bound,
19+
try_encode!,
1720
18-
public try_find_decoded_size
19-
public try_decode!
21+
try_find_decoded_size,
22+
try_decode!,
2023
21-
public check_in_range
22-
public check_contiguous
24+
check_in_range,
25+
check_contiguous,
2326
24-
public can_concatenate
25-
public is_thread_safe
26-
public try_resize_decode!
27+
can_concatenate,
28+
is_thread_safe,
29+
try_resize_decode!,
2730
28-
public NoopCodec
29-
public NoopEncodeOptions
30-
public NoopDecodeOptions
31+
NoopCodec,
32+
NoopEncodeOptions,
33+
NoopDecodeOptions,
3134
32-
public ShuffleCodec
33-
public ShuffleEncodeOptions
34-
public ShuffleDecodeOptions
35+
ShuffleCodec,
36+
ShuffleEncodeOptions,
37+
ShuffleDecodeOptions
38+
"""))
39+
end
3540

3641
include("types.jl")
3742
include("errors.jl")
3843
include("interface.jl")
3944
include("noop.jl")
4045
include("shuffle.jl")
4146

42-
end
47+
end

ChunkCodecCore/test/runtests.jl

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ end
4343
@testset "check helpers" begin
4444
@test_throws Exception ChunkCodecCore.check_contiguous(@view(zeros(UInt8, 8)[1:2:end]))
4545
@test_throws Exception ChunkCodecCore.check_contiguous(0x00:0xFF)
46-
@test isnothing(ChunkCodecCore.check_contiguous(Memory{UInt8}(undef, 3)))
46+
if VERSION v"1.11"
47+
@test isnothing(ChunkCodecCore.check_contiguous(Memory{UInt8}(undef, 3)))
48+
end
4749
@test isnothing(ChunkCodecCore.check_contiguous(Vector{UInt8}(undef, 3)))
4850
@test isnothing(ChunkCodecCore.check_contiguous(@view(zeros(UInt8, 8)[1:1:end])))
4951
@test_throws ArgumentError ChunkCodecCore.check_in_range(1:6; x=0)
@@ -87,4 +89,42 @@ end
8789
# negative max_size
8890
@test_throws DecodedSizeError(Int64(-1), nothing) decode(d, ones(UInt8, Int64(100)); max_size=Int64(-1))
8991
@test_throws DecodedSizeError(typemin(Int64), nothing) decode(d, ones(UInt8, Int64(100)); max_size=typemin(Int128))
90-
end
92+
end
93+
@testset "public" begin
94+
if VERSION >= v"1.11.0-DEV.469"
95+
for sym in (
96+
:Codec,
97+
:EncodeOptions,
98+
:DecodeOptions,
99+
100+
:DecodingError,
101+
:DecodedSizeError,
102+
103+
:decode_options,
104+
105+
:decoded_size_range,
106+
:encode_bound,
107+
:try_encode!,
108+
109+
:try_find_decoded_size,
110+
:try_decode!,
111+
112+
:check_in_range,
113+
:check_contiguous,
114+
115+
:can_concatenate,
116+
:is_thread_safe,
117+
:try_resize_decode!,
118+
119+
:NoopCodec,
120+
:NoopEncodeOptions,
121+
:NoopDecodeOptions,
122+
123+
:ShuffleCodec,
124+
:ShuffleEncodeOptions,
125+
:ShuffleDecodeOptions
126+
)
127+
@test Base.ispublic(ChunkCodecCore, sym)
128+
end
129+
end
130+
end

ChunkCodecTests/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1010
[compat]
1111
ChunkCodecCore = "0.4"
1212
Test = "1"
13-
julia = "1.11"
13+
julia = "1.10"

ChunkCodecs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ChunkCodecLibLz4 = "0.1"
2020
ChunkCodecLibSnappy = "0.1"
2121
ChunkCodecLibZlib = "0.1"
2222
ChunkCodecLibZstd = "0.1"
23-
julia = "1.11"
23+
julia = "1.10"
2424

2525
[sources]
2626
ChunkCodecCore = {path = "../ChunkCodecCore"}

LibBlosc/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ ChunkCodecCore = "0b6fb165-00bc-4d37-ab8b-79f91016dbe1"
1010
[compat]
1111
Blosc_jll = "1"
1212
ChunkCodecCore = "0.4"
13-
julia = "1.11"
13+
julia = "1.10"

LibBlosc/src/ChunkCodecLibBlosc.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export BloscCodec,
2222
BloscDecodeOptions,
2323
BloscDecodingError
2424

25-
public is_compressor_valid, compcode, compname
25+
if VERSION >= v"1.11.0-DEV.469"
26+
eval(Meta.parse("public is_compressor_valid, compcode, compname"))
27+
end
2628

2729
# reexport ChunkCodecCore
2830
using ChunkCodecCore: ChunkCodecCore, encode, decode

LibBlosc/test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,10 @@ end
7777
c[end-5] = 0x40
7878
@test_throws BloscDecodingError decode(BloscDecodeOptions(), c)
7979
end
80+
@testset "public" begin
81+
if VERSION >= v"1.11.0-DEV.469"
82+
for sym in (:is_compressor_valid, :compcode, :compname)
83+
@test Base.ispublic(ChunkCodecLibBlosc, sym)
84+
end
85+
end
86+
end

LibBzip2/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ ChunkCodecCore = "0b6fb165-00bc-4d37-ab8b-79f91016dbe1"
1010
[compat]
1111
Bzip2_jll = "1"
1212
ChunkCodecCore = "0.4"
13-
julia = "1.11"
13+
julia = "1.10"

LibLz4/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Lz4_jll = "5ced341a-0733-55b8-9ab6-a4889d929147"
1010
[compat]
1111
ChunkCodecCore = "0.4"
1212
Lz4_jll = "1"
13-
julia = "1.11"
13+
julia = "1.10"

0 commit comments

Comments
 (0)