Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.1k stars 107 forks source link

Add support for adding a new repository available to %use line magics #466

Open cmelchior opened 4 weeks ago

cmelchior commented 4 weeks ago

See https://kotlinlang.slack.com/archives/C05333T208Y/p1724308760303349

Sometimes, you want to combine the ease of use with e.g%use kandy, but pull artifacts from a private repository.

For custom libraries, people can define their own library definition, but this gets clunky for 3rd party libraries.

Off the top of my head, I see two options, but it probably requires a bit of thought. Especially around which order repositories should be checked.


Possible API's:

Take into account USE if it was defined in a previous cell, e.g.:

// Cell 1
USE {
    repositories {
        maven {
            url = "<repo1-url>"
            credentials {
                username = "auth-username"
                password = "auth-token"
            }
        }
    }
}

Cell 2
// Will use repo1 before checking default repositories
// Should probably check repo1 after any repository defined in kandy.json
%use kandy

Introduce a new line magic that does it:

%repository maven(url = "repo1-url", username = "auth-username", password = "auth-token") 
%use kandy
ileasile commented 3 weeks ago

Approach (1) should already work. Order of repositories doesn't matter until you publish the same version to 2 different repos with different content (which is shooting in your own knee)

Approach (2) seems to be not needed unless we already have @Repository annotation