From c0a41d7da15d863bc26e0871c1cfb2e5d22f3a1d Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 30 Oct 2024 21:25:16 +1300 Subject: [PATCH 1/5] fix: correctly allow for license=(:fulltext, ...) in update_dataset --- CHANGELOG.md | 6 ++++++ Project.toml | 2 +- src/datasets.jl | 14 +++++++++++--- test/datasets.jl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4df8afb55..147a06274 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Version [v0.1.12] - 2024-??-?? + +### Fixed + +* The `JuliaHub.update_dataset` function now correctly accepts the `license=(:fulltext, ...)` argument. () + ## Version [v0.1.11] - 2024-06-27 ### Added diff --git a/Project.toml b/Project.toml index eca3cde93..eae396485 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JuliaHub" uuid = "bc7fa6ce-b75e-4d60-89ad-56c957190b6e" authors = ["JuliaHub Inc."] -version = "0.1.11" +version = "0.1.12" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/src/datasets.jl b/src/datasets.jl index 160340d8c..730edc38b 100644 --- a/src/datasets.jl +++ b/src/datasets.jl @@ -465,8 +465,9 @@ const _DOCS_datasets_metadata_fields = """ * `description`: description of the dataset (a string) * `tags`: an iterable of strings of all the tags of the dataset * `visibility`: a string with possible values `public` or `private` -* `license`: a valid SPDX license identifier, or a tuple `(:fulltext, license_text)`, where - `license_text` is the full text string of a custom license +* `license`: a valid SPDX license identifier (as a string or in a + `(:spdx, licence_identifier)` tuple), or a tuple `(:fulltext, license_text)`, + where `license_text` is the full text string of a custom license * `groups`: an iterable of valid group names """ @@ -983,7 +984,14 @@ function update_dataset end cmd, license_value = license params["license"] = if cmd == :spdx Dict("spdx_id" => license_value) - elseif cmd == :text + elseif cmd in (:fulltext, :text) + if cmd == :text + Base.depwarn( + "Passing license=(:text, ...) is deprecated, use license=(:fulltext, ...) instead.", + :update_dataset; + force=true, + ) + end Dict("text" => license_value) else throw(ArgumentError("Invalid license argument: $(cmd) ∉ [:spdx, :text]")) diff --git a/test/datasets.jl b/test/datasets.jl index 59ec2161d..2506f2242 100644 --- a/test/datasets.jl +++ b/test/datasets.jl @@ -237,6 +237,24 @@ end @test_throws TypeError JuliaHub.update_dataset( "example-dataset"; description=42 ) + # Different options for `license` keyword + @test JuliaHub.update_dataset("example-dataset"; license="MIT") isa JuliaHub.Dataset + @test JuliaHub.update_dataset("example-dataset"; license=(:spdx, "MIT")) isa + JuliaHub.Dataset + @test JuliaHub.update_dataset("example-dataset"; license=(:fulltext, "...")) isa + JuliaHub.Dataset + # This should log a deprecation warning + @test @test_logs ( + :warn, + "Passing license=(:text, ...) is deprecated, use license=(:fulltext, ...) instead.", + ) JuliaHub.update_dataset( + "example-dataset"; license=(:text, "...") + ) isa JuliaHub.Dataset + @test_throws TypeError JuliaHub.update_dataset("example-dataset"; license=1234) + @test_throws ArgumentError JuliaHub.update_dataset("example-dataset"; license=(:foo, "")) + @test_throws TypeError JuliaHub.update_dataset( + "example-dataset"; license=(:fulltext, 1234) + ) end end @@ -293,6 +311,33 @@ end # @test JuliaHub.upload_dataset( # "existing-dataset", @__FILE__; update=true) isa JuliaHub.Dataset + + # Different options for `license` keyword + @test JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; create=true, license="MIT" + ) isa JuliaHub.Dataset + @test JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; replace=true, license=(:spdx, "MIT") + ) isa JuliaHub.Dataset + @test JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; replace=true, license=(:fulltext, "...") + ) isa JuliaHub.Dataset + # This should log a deprecation warning + @test @test_logs ( + :warn, + "Passing license=(:text, ...) is deprecated, use license=(:fulltext, ...) instead.", + ) JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; replace=true, license=(:text, "...") + ) isa JuliaHub.Dataset + @test_throws TypeError JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; replace=true, license=1234 + ) + @test_throws ArgumentError JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; replace=true, license=(:foo, "") + ) + @test_throws TypeError JuliaHub.upload_dataset( + "example-dataset-license", @__FILE__; replace=true, license=(:fulltext, 1234) + ) end empty!(MOCK_JULIAHUB_STATE) end From f6a96dc4984555704af7a67d4f87624f68386232 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 30 Oct 2024 21:30:01 +1300 Subject: [PATCH 2/5] update changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 147a06274..88f6b4c13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Version [v0.1.12] - 2024-??-?? +## Unreleased ### Fixed -* The `JuliaHub.update_dataset` function now correctly accepts the `license=(:fulltext, ...)` argument. () +* The `JuliaHub.update_dataset` function now correctly accepts the `license=(:fulltext, ...)` argument. ([#74]) ## Version [v0.1.11] - 2024-06-27 @@ -140,3 +140,4 @@ Initial package release. [#52]: https://github.com/JuliaComputing/JuliaHub.jl/issues/52 [#53]: https://github.com/JuliaComputing/JuliaHub.jl/issues/53 [#58]: https://github.com/JuliaComputing/JuliaHub.jl/issues/58 +[#74]: https://github.com/JuliaComputing/JuliaHub.jl/issues/74 From aa1763571e8f186923bae574700bcaf5985c464a Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 30 Oct 2024 21:32:30 +1300 Subject: [PATCH 3/5] add deprecation note to docstring --- src/datasets.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/datasets.jl b/src/datasets.jl index 730edc38b..4f5febe96 100644 --- a/src/datasets.jl +++ b/src/datasets.jl @@ -469,6 +469,11 @@ const _DOCS_datasets_metadata_fields = """ `(:spdx, licence_identifier)` tuple), or a tuple `(:fulltext, license_text)`, where `license_text` is the full text string of a custom license * `groups`: an iterable of valid group names + +!!! compat "JuliaHub.jl v0.1.12" + + The `license = (:fulltext, ...)` form requires v0.1.12, and `license = (:fulltext, ...)` + is deprecated since that version. """ """ From 57c28cf274b0aaa9f7a7e3973fd954180f462971 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 30 Oct 2024 21:32:58 +1300 Subject: [PATCH 4/5] set -DEV version for now --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index eae396485..9e8a9d961 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JuliaHub" uuid = "bc7fa6ce-b75e-4d60-89ad-56c957190b6e" authors = ["JuliaHub Inc."] -version = "0.1.12" +version = "0.1.12-DEV" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" From 7e9752ca6cc1f815e7b84e4a18509b775c6c5b7d Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Wed, 4 Dec 2024 21:19:00 +1300 Subject: [PATCH 5/5] Update src/datasets.jl Co-authored-by: Sebastian Pfitzner --- src/datasets.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datasets.jl b/src/datasets.jl index 4f5febe96..f4c7441fe 100644 --- a/src/datasets.jl +++ b/src/datasets.jl @@ -472,7 +472,7 @@ const _DOCS_datasets_metadata_fields = """ !!! compat "JuliaHub.jl v0.1.12" - The `license = (:fulltext, ...)` form requires v0.1.12, and `license = (:fulltext, ...)` + The `license = (:fulltext, ...)` form requires v0.1.12, and `license = (:text, ...)` is deprecated since that version. """