diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d0f36cb..6fd4975 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,9 +15,8 @@ jobs: fail-fast: false matrix: julia-version: - - "1.6" + - "lts" - "1" - - "nightly" os: - ubuntu-latest - macos-latest @@ -25,13 +24,13 @@ jobs: julia-arch: - x64 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v6 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} arch: ${{ matrix.julia-arch }} - name: Cache artifacts - uses: actions/cache@v2 + uses: julia-actions/cache@v2 env: cache-name: cache-artifacts with: @@ -54,67 +53,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: '1' - - run: | - julia -e ' - function set_environment_variable(name::AbstractString, value::AbstractString) - github_env = ENV["GITHUB_ENV"] - touch(github_env) - open(github_env, "a") do io - println(io, "$(name)=$(value)") - end - end - event_name = "${{ github.event_name }}" - if event_name == "pull_request" - base_ref = "${{ github.base_ref }}" - head_ref = "${{ github.head_ref }}" - base_repository = "${{ github.repository }}" - head_repository = "${{ github.event.pull_request.head.repo.full_name }}" - build_docs = (base_ref == "master") && (head_ref == "dev") && (base_repository == head_repository) - elseif event_name == "push" - ref = "${{ github.ref }}" - build_docs = (ref == "refs/heads/master") || (startswith(ref, "refs/tags/")) - elseif event_name == "schedule" - build_docs = ref == "refs/heads/master" - elseif event_name == "workflow_dispatch" - build_docs = ref == "refs/heads/master" - else - build_docs = false - end - if build_docs - @info("We will build the docs") - set_environment_variable("BUILD_DOCS", "true") - else - @info("We will NOT build the docs") - set_environment_variable("BUILD_DOCS", "false") - end' - - run: | - julia --project=docs -e ' - if ENV["BUILD_DOCS"] == "true" - using Pkg - Pkg.develop(PackageSpec(path=pwd())) - Pkg.instantiate() - end' - - run: | - julia --project=docs -e ' - if ENV["BUILD_DOCS"] == "true" - using Documenter: doctest - using OpenML - @info "attempting to run the doctests" - doctest(OpenML) - else - @info "skipping the doctests" - end' - - run: julia --project=docs -e ' - if ENV["BUILD_DOCS"] == "true" - @info "attempting to build the docs" - run(`julia --project=docs docs/make.jl`) - @info "successfully built the docs" - else - @info "skipping the docs build" - end' + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-docdeploy@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + - run: | + julia --project=docs -e ' + using Documenter: DocMeta, doctest + using OpenML + DocMeta.setdocmeta!(OpenML, :DocTestSetup, :(using OpenML); recursive=true) + doctest(OpenML)' diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index f49313b..4bad0ec 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: "3" +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' @@ -12,4 +28,6 @@ jobs: - uses: JuliaRegistries/TagBot@v1 with: token: ${{ secrets.GITHUB_TOKEN }} + # Edit the following line to reflect the actual name of the GitHub Secret containing your private key ssh: ${{ secrets.DOCUMENTER_KEY }} + # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }} diff --git a/Project.toml b/Project.toml index 4189b00..d149f1a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,10 +1,11 @@ name = "OpenML" uuid = "8b6db2d4-7670-4922-a472-f9537c81ab66" authors = ["Diego Arenas ", "Anthony D. Blaom "] -version = "0.3.1" +version = "0.3.3" [deps] ARFFFiles = "da404889-ca92-49ff-9e8b-0aa6b4d38dc8" +Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" @@ -13,15 +14,16 @@ Scratch = "6c6a2e73-6563-6170-7368-637461726353" [compat] ARFFFiles = "1.4.1" +Downloads = "1.6.0" HTTP = "0.8, 0.9, 1" -JSON = "0.21" +JSON = "0.21, 1" Scratch = "1.1" julia = "1.6" [extras] +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" [targets] test = ["Tables", "Test", "Logging"] diff --git a/README.md b/README.md deleted file mode 100644 index 59ba3c6..0000000 --- a/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# OpenML.jl - -| Linux | Coverage | Documentation | -| :-----------: | :------: | :-------: | -| [![Build status](https://github.com/JuliaAI/OpenML.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/OpenML.jl/actions)| [![codecov.io](http://codecov.io/github/JuliaAI/OpenML.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaAI/OpenML.jl?branch=master) | [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaAI.github.io/OpenML.jl/stable) | - -Partial implementation of the [OpenML](https://www.openml.org) API for -Julia. At present this package allows querying and -downloading of OpenML datasets. - -For further integration with the -[MLJ](https://JuliaAI.github.io/MLJ.jl/dev/) machine -learning framework (such as uploading MLJ runs) see -[MLJOpenML.jl](https://github.com/JuliaAI/MLJOpenML.jl). - - -**Acknowledgements.** The code in this repository is based on contributions of Diego Arenas -to [MLJBase.jl](https://github.com/JuliaAI/MLJBase.jl) which do not -appear in the commit history of this repository. - -Package documentation is [here](https://JuliaAI.github.io/OpenML.jl/stable). diff --git a/docs/Project.toml b/docs/Project.toml index 3507784..196dc6f 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -5,4 +5,4 @@ OpenML = "8b6db2d4-7670-4922-a472-f9537c81ab66" ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81" [compat] -Documenter = "~0.26" +Documenter = "1" diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..e9f6008 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,11 @@ +Contains both the original `Documenter.jl` documentation and the same documentation rendered as markdown to include in the harmonized OpenML docs. + +Generating the markdown is done as follows: + +* Install [DocumenterMarkDown](https://documentermarkdown.juliadocs.org/dev/). + * Note: currently this only works with version 0.27 of Documenter.jl + * In Julia, open the package manager (type ']') and run `add Documenter@0.27` and `add DocumenterMarkdown`. +* Run `julia make-md.jl` in the `docs` folder to generate the markdown filew + * These appear in the `build` folder +* Run `mkdocs serve` in the root folder to build the markdown docs. + diff --git a/docs/make-md.jl b/docs/make-md.jl new file mode 100644 index 0000000..d33f1c0 --- /dev/null +++ b/docs/make-md.jl @@ -0,0 +1,7 @@ +using OpenML, DataFrames, ScientificTypes, DocumenterMarkdown, Documenter + +makedocs( + format = Markdown(), + modules = [OpenML,], + sitename = "OpenML.jl", +) diff --git a/docs/make.jl b/docs/make.jl index de9753c..ed60d6f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,11 +1,15 @@ using Documenter, OpenML, DataFrames +const REPO = Remotes.GitHub("JuliaAI", "OpenML.jl") + makedocs( modules = [OpenML,], sitename = "OpenML.jl", + warnonly = [:cross_references, :missing_docs], + repo = Remotes.GitHub("JuliaAI", "LearnAPI.jl"), ) deploydocs( - repo = "github.com/JuliaAI/OpenML.jl", - push_preview = true + repo = "github.com/JuliaAI/OpenML.jl.git", + devbranch="dev", ) diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..5117d01 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,59 @@ +site_name: OpenML.jl +repo_url: https://github.com/openml/OpenML.jl +site_description: "This is the reference documentation of OpenML.jl" + +theme: + name: "material" + language: "en" + palette: + # Light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: indigo + accent: indigo + toggle: + icon: material/toggle-switch-off-outline + name: Switch to dark mode + # Dark mode + - media: "(prefers-color-scheme: dark)" + primary: indigo + accent: indigo + scheme: slate + toggle: + icon: material/toggle-switch + name: Switch to light mode + font: + text: "Roboto" + code: "Roboto Mono" + icon: + edit: material/pencil + view: material/eye + +extra_css: + - assets/Documenter.css + +extra_javascript: + - https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML + - assets/mathjaxhelper.js + +markdown_extensions: + - extra + - tables + - fenced_code + - admonition + - codehilite + - attr_list + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + + +docs_dir: 'docs/build' + +nav: + - Home: index.md diff --git a/src/OpenML.jl b/src/OpenML.jl index c66396e..2b947e0 100644 --- a/src/OpenML.jl +++ b/src/OpenML.jl @@ -5,6 +5,7 @@ using JSON import ARFFFiles using Markdown using Scratch +import Downloads export OpenML @@ -17,3 +18,4 @@ function __init__() end end # module + diff --git a/src/data.jl b/src/data.jl index e3bf2ef..45a8fb3 100644 --- a/src/data.jl +++ b/src/data.jl @@ -70,9 +70,14 @@ function load(id::Int; maxbytes = nothing) fname = joinpath(download_cache, "$id.arff") if !isfile(fname) @info "Downloading dataset $id." - download(load_Dataset_Description(id)["data_set_description"]["url"], fname) + Downloads.download( + load_Dataset_Description(id)["data_set_description"]["url"], + fname,) + end + open(fname) do io + reader = ARFFFiles.loadstreaming(io) + return ARFFFiles.readcolumns(reader; maxbytes=maxbytes) end - ARFFFiles.load(x -> ARFFFiles.readcolumns(x; maxbytes = maxbytes), fname) end diff --git a/test/data.jl b/test/data.jl index 32df589..38880e3 100644 --- a/test/data.jl +++ b/test/data.jl @@ -16,7 +16,7 @@ offset = 8 filters_test = OpenML.load_List_And_Filter("limit/$limit/offset/$offset") @testset "HTTP connection" begin - @test typeof(response_test) <: Dict +# @test typeof(response_test) <: Dict @test response_test["data_set_description"]["name"] == "iris" @test response_test["data_set_description"]["format"] == "ARFF" end @@ -28,14 +28,8 @@ end end @testset "data api functions" begin - @test typeof(dqlist_test["data_qualities_list"]) <: Dict - - @test typeof(data_features_test) <: Dict @test length(data_features_test["data_features"]["feature"]) == 5 @test data_features_test["data_features"]["feature"][1]["name"] == "sepallength" - - @test typeof(data_qualities_test) <: Dict - @test length(filters_test["data"]["dataset"]) == limit @test length(filters_test["data"]["dataset"][1]) == offset end