Skip to content

Commit 2bd425f

Browse files
authored
Merge branch 'master' into master
2 parents 626fc1f + d30fbd7 commit 2bd425f

File tree

9 files changed

+107
-16
lines changed

9 files changed

+107
-16
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/Documenter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Documentation
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- uses: julia-actions/setup-julia@v1
1515
with:
1616
version: nightly # change this to 1.6 once's that's official

.github/workflows/Invalidations.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Invalidations
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
# Skip intermediate builds: always.
8+
# Cancel intermediate builds: always.
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
evaluate:
14+
# Only run on PRs to the default branch.
15+
# In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch
16+
if: github.base_ref == github.event.repository.default_branch
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: julia-actions/setup-julia@v1
20+
with:
21+
version: '1'
22+
- uses: actions/checkout@v4
23+
- uses: julia-actions/julia-buildpkg@v1
24+
- uses: julia-actions/julia-invalidations@v1
25+
id: invs_pr
26+
27+
- uses: actions/checkout@v4
28+
with:
29+
ref: ${{ github.event.repository.default_branch }}
30+
- uses: julia-actions/julia-buildpkg@v1
31+
- uses: julia-actions/julia-invalidations@v1
32+
id: invs_default
33+
34+
- name: Report invalidation counts
35+
run: |
36+
echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
37+
echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
38+
- name: Check if the PR does increase number of invalidations
39+
if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total
40+
run: exit 1

.github/workflows/test.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,26 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
julia-version: ['1.0', '1', 'nightly']
17-
julia-arch: [x64, x86]
18-
os: [ubuntu-latest, macOS-latest, windows-latest]
16+
julia-version: ['1.0', '1.6', '1', 'nightly']
17+
julia-arch: [x64, x86, aarch64]
18+
os: [ubuntu-latest, windows-latest, macOS-13, macOS-14]
1919
exclude:
20-
- os: macOS-latest
20+
- os: ubuntu-latest
21+
julia-arch: aarch64
22+
- os: windows-latest
23+
julia-arch: aarch64
24+
- os: macOS-13
2125
julia-arch: x86
26+
- os: macOS-13
27+
julia-arch: aarch64
28+
- os: macOS-14
29+
julia-arch: x86
30+
- os: macOS-14
31+
julia-arch: x64
32+
- os: macOS-14
33+
julia-version: '1.6'
34+
- os: macOS-14
35+
julia-version: '1.0'
2236

2337
steps:
2438
- name: Set git to use LF (Windows only)
@@ -31,14 +45,15 @@ jobs:
3145
run: |
3246
echo "TMP=${USERPROFILE}\AppData\Local\Temp" >> ${GITHUB_ENV}
3347
echo "TEMP=${USERPROFILE}\AppData\Local\Temp" >> ${GITHUB_ENV}
34-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v4
3549
- uses: julia-actions/setup-julia@latest
3650
with:
3751
version: ${{ matrix.julia-version }}
3852
- uses: julia-actions/julia-runtest@latest
3953
env:
4054
JULIA_NUM_THREADS: 2
4155
- uses: julia-actions/julia-processcoverage@v1
42-
- uses: codecov/codecov-action@v1
56+
- uses: codecov/codecov-action@v4
4357
with:
4458
file: lcov.info
59+
token: ${{ secrets.CODECOV_TOKEN }}

Project.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
name = "FileIO"
22
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
3-
version = "1.16.0"
3+
version = "1.16.2"
44

55
[deps]
66
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
77
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
88
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
99

1010
[compat]
11+
Pkg = "<0.0.1, 0.7, 1"
1112
Requires = "1"
13+
UUIDs = "<0.0.1, 0.7, 1"
1214
julia = "0.7, 1"
15+
Aqua = "0.8"
16+
CSVFiles = "1"
17+
CodecZlib = "0.5, 0.6, 0.7"
18+
ColorTypes = "0.11"
19+
FilePathsBase = "0.9"
20+
HTTP = "0.6, 1"
21+
Random = "<0.0.1, 0.7, 1"
22+
Test = "<0.0.1, 0.7, 1"
1323

1424
[extras]
25+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
1526
CSVFiles = "5d742f6a-9f54-50ce-8119-2520741973ca"
1627
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
1728
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
@@ -21,4 +32,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2132
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2233

2334
[targets]
24-
test = ["ColorTypes", "CodecZlib", "CSVFiles", "FilePathsBase", "HTTP", "Random", "Test"]
35+
test = ["Aqua", "ColorTypes", "CodecZlib", "CSVFiles", "FilePathsBase", "HTTP", "Random", "Test"]

docs/src/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Install FileIO within Julia via
1515
```julia
1616
julia> using Pkg
1717

18-
julia> Pkg.add("FileIO")`
18+
julia> Pkg.add("FileIO")
1919
```
2020

2121
## Usage
@@ -48,6 +48,12 @@ Likewise, saving might be as simple as
4848
save(filename, obj)
4949
```
5050

51+
You can also utilize a piping style to save values to files like this
52+
53+
```julia
54+
obj |> save(filename)
55+
```
56+
5157
If you just want to inspect a file to determine its format, then
5258

5359
```julia

src/mimesave.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ module MimeWriter
22

33
using ..FileIO: File, @format_str
44

5-
function save(file::File{format"PNG"}, data)
5+
function save(file::File{format"PNG"}, data; ppi::Union{Nothing,Number}=nothing)
66
if showable("image/png", data)
77
open(file.filename, "w") do s
8-
show(IOContext(s, :full_fidelity=>true), "image/png", data)
8+
if ppi === nothing
9+
show(IOContext(s, :full_fidelity=>true), "image/png", data)
10+
else
11+
show(IOContext(s, :full_fidelity=>true, :ppi=>ppi), "image/png", data)
12+
end
913
end
1014
else
1115
throw(ArgumentError("Argument does not support conversion to png."))

src/registry.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const idImageIO = :ImageIO => UUID("82e4d734-157c-48bb-816b-45c225c6df19")
77
const idImageMagick = :ImageMagick => UUID("6218d12a-5da1-5696-b52f-db25d2ecc6d1")
88
const idMeshIO = :MeshIO => UUID("7269a6da-0436-5bbc-96c2-40638cbb6118")
99
const idNetpbm = :Netpbm => UUID("f09324ee-3d7c-5217-9330-fc30815ba969")
10+
const idOpenCV = :OpenCV => UUID("f878e3a2-a245-4720-8660-60795d644f2a")
1011
const idQuartzImageIO = :QuartzImageIO => UUID("dca85d43-d64c-5e67-8c65-017450d5d020")
1112
const idRData = :RData => UUID("df47a6cb-8c03-5eed-afd8-b6050d6c41da")
1213
const idStatFiles = :StatFiles => UUID("1463e38c-9381-5320-bcd4-4134955f093a")
@@ -116,6 +117,7 @@ add_format(format"AVSfld", "# AVS", [".fld"], [idAVSfldIO])
116117
add_format(format"CSV", (), [".csv"], [idCSVFiles])
117118
add_format(format"TSV", (), [".tsv"], [idCSVFiles])
118119
add_format(format"Feather", "FEA1", [".feather"], [:FeatherFiles => UUID("b675d258-116a-5741-b937-b79f054b0542")])
120+
add_format(format"Arrow", b"ARROW1\0\0", [".arrow"], [:Arrow => UUID("69666777-d1a9-59fb-9406-91d4454c9d45")])
119121
add_format(format"Excel", (), [".xls", ".xlsx"], [:ExcelFiles => UUID("89b67f3b-d1aa-5f6f-9ca4-282e8d98620d")])
120122
add_format(format"Stata", (), [".dta"], [idStatFiles, LOAD])
121123
add_format(format"SPSS", "\$FL2", [".sav"], [idStatFiles, LOAD])
@@ -148,7 +150,7 @@ add_format(format"EXR", UInt8[0x76,0x2f,0x31,0x01], ".exr",
148150
add_format(format"HDR", UInt8[0x23,0x3f,0x52,0x41,0x44,0x49,0x41,0x4e], ".hdr", [idImageMagick])
149151
add_format(format"ICO", UInt8[0x00,0x00,0x01,0x00], ".ico", [idImageMagick])
150152
add_format(format"INFO", UInt8[0x7a,0x62,0x65,0x78], ".info",[idImageMagick])
151-
add_format(format"JP2", UInt8[0x00,0x00,0x00,0x0c,0x6a,0x50,0x20,0x20], ".jp2", [idImageMagick])
153+
add_format(format"JP2", UInt8[0x00,0x00,0x00,0x0c,0x6a,0x50,0x20,0x20], ".jp2", [idImageMagick], [idOpenCV])
152154
add_format(format"PDB", UInt8[0x73,0x7a,0x65,0x7a], ".pdb", [idImageMagick])
153155
add_format(format"PDF", UInt8[0x25,0x50,0x44,0x46], ".pdf", [idImageMagick], [MimeWriter, SAVE])
154156
add_format(format"PGM", UInt8[0x50,0x35,0x0a], ".pgm", [idImageMagick])
@@ -179,6 +181,7 @@ add_format(
179181
[idImageIO],
180182
[idQuartzImageIO, OSX],
181183
[idImageMagick],
184+
[idOpenCV],
182185
[MimeWriter, SAVE]
183186
)
184187
add_format(
@@ -188,14 +191,16 @@ add_format(
188191
[idJpegTurbo],
189192
[idImageIO],
190193
[idQuartzImageIO, OSX],
191-
[idImageMagick]
194+
[idImageMagick],
195+
[idOpenCV]
192196
) # 0xe1
193197
add_format(
194198
format"BMP",
195199
UInt8[0x42,0x4d],
196200
".bmp",
197201
[idQuartzImageIO, OSX],
198-
[idImageMagick]
202+
[idImageMagick],
203+
[idOpenCV]
199204
)
200205
add_format(
201206
format"PCX",
@@ -384,7 +389,7 @@ function detecttiff(io)
384389
end
385390
# normal TIFF
386391
detect_noometiff(io) = detecttiff(io) && ((:name propertynames(io)) || !(endswith(io.name, ".ome.tif>") || endswith(io.name, ".ome.tiff>")))
387-
add_format(format"TIFF", detect_noometiff, [".tiff", ".tif"], [idImageIO], [idQuartzImageIO, OSX], [idImageMagick])
392+
add_format(format"TIFF", detect_noometiff, [".tiff", ".tif"], [idImageIO], [idQuartzImageIO, OSX], [idImageMagick], [idOpenCV])
388393
# OME-TIFF
389394
detect_ometiff(io) = detecttiff(io) && (:name propertynames(io)) && (endswith(io.name, ".ome.tif>") || endswith(io.name, ".ome.tiff>"))
390395
add_format(format"OMETIFF", detect_ometiff, [".tif", ".tiff"], [:OMETIFF => UUID("2d0ec36b-e807-5756-994b-45af29551fcf")])

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ end
2525
include("test_mimesave.jl")
2626
include("integration.jl")
2727
end
28+
29+
using Aqua
30+
Aqua.test_all(FileIO)

0 commit comments

Comments
 (0)