Skip to content

Commit c573899

Browse files
committed
Change remote libraries repository in code and README
1 parent 53761de commit c573899

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

docs/README-STUB.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ When a library is included with `%use` keyword, the following functionality is a
160160
- library initialization code
161161
- renderers for special types, e.g. charts and data frames
162162

163-
This behavior is defined by `json` library descriptor. Descriptors for all supported libraries can be found in [libraries](../libraries) directory.
163+
This behavior is defined by `json` library descriptor. Descriptors for all supported libraries can be found in [libraries](https://github.com/Kotlin/kotlin-jupyter-libraries) repository.
164164
A library descriptor may provide a set of properties with default values that can be overridden when library is included.
165165
The major use case for library properties is to specify a particular version of library. If descriptor has only one property, it can be
166166
defined without naming:
@@ -175,8 +175,7 @@ Several libraries can be included in single `%use` statement, separated by `,`:
175175
```
176176
%use lets-plot, krangl, mysql(8.0.15)
177177
```
178-
You can also specify the source of library descriptor. By default, it's taken from the `libraries` directory
179-
of kernel installation. If you want to try descriptor from another revision, use the following syntax:
178+
You can also specify the source of library descriptor. By default, it's taken from the [libraries repository](https://github.com/Kotlin/kotlin-jupyter-libraries). If you want to try descriptor from another revision, use the following syntax:
180179
```
181180
// Specify some git tag from this repository
182181
%use lets-plot@0.8.2.5

docs/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ When a library is included with `%use` keyword, the following functionality is a
167167
- library initialization code
168168
- renderers for special types, e.g. charts and data frames
169169

170-
This behavior is defined by `json` library descriptor. Descriptors for all supported libraries can be found in [libraries](../libraries) directory.
170+
This behavior is defined by `json` library descriptor. Descriptors for all supported libraries can be found in [libraries](https://github.com/Kotlin/kotlin-jupyter-libraries) repository.
171171
A library descriptor may provide a set of properties with default values that can be overridden when library is included.
172172
The major use case for library properties is to specify a particular version of library. If descriptor has only one property, it can be
173173
defined without naming:
@@ -182,8 +182,7 @@ Several libraries can be included in single `%use` statement, separated by `,`:
182182
```
183183
%use lets-plot, krangl, mysql(8.0.15)
184184
```
185-
You can also specify the source of library descriptor. By default, it's taken from the `libraries` directory
186-
of kernel installation. If you want to try descriptor from another revision, use the following syntax:
185+
You can also specify the source of library descriptor. By default, it's taken from the [libraries repository](https://github.com/Kotlin/kotlin-jupyter-libraries). If you want to try descriptor from another revision, use the following syntax:
187186
```
188187
// Specify some git tag from this repository
189188
%use lets-plot@0.8.2.5

docs/libraries.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Generally, there are two ways of adding new library:
88

99
To support new `JVM` library and make it available via `%use` magic command you need to create a library descriptor for it.
1010

11-
Check [libraries](../libraries) directory to see examples of library descriptors.
11+
Check [libraries][libs-repo] repository to see examples of library descriptors.
1212

1313
Library descriptor is a `<libName>.json` file with the following fields:
1414
- `properties`: a dictionary of properties that are used within library descriptor
@@ -37,7 +37,7 @@ To register new library descriptor:
3737
1. For private usage - create it anywhere on your computer and reference it using file syntax.
3838
2. Alternative way for private usage - create descriptor in `.jupyter_kotlin/libraries` folder and reference
3939
it using "default" syntax
40-
3. For sharing with community - commit it to [libraries](../libraries) directory and create pull request.
40+
3. For sharing with community - commit it to [libraries][libs-repo] repository and create pull request.
4141

4242
If you are maintaining some library and want to update your library descriptor, create pull request with your update.
4343
After your request is accepted, new version of your library will be available to all Kotlin Jupyter users
@@ -155,3 +155,5 @@ resources. This file should contain FQNs of all integration classes in the JSON
155155
```
156156
Classes derived from `LibraryDefinition` should be added to the `definitions` array.
157157
Classes derived from `LibraryDefinitionProducer` should be added to the `producers` array.
158+
159+
[libs-repo]: https://github.com/Kotlin/kotlin-jupyter-libraries

jupyter-lib/shared-compiler/src/main/kotlin/org/jetbrains/kotlinx/jupyter/libraries/ResolutionInfoProvider.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class StandardResolutionInfoProvider(override var fallback: LibraryResolutionInf
4242
}
4343

4444
private fun tryGetAsRef(ref: String): LibraryResolutionInfo? {
45-
val response = getHttp("$GitHubApiPrefix/contents/$LibrariesDir?ref=$ref")
45+
val response = getHttp("$GitHubApiPrefix/contents/$RemoteLibrariesDir?ref=$ref")
4646
return if (response.status.successful) LibraryResolutionInfo.getInfoByRef(ref) else null
4747
}
4848

jupyter-lib/shared-compiler/src/main/kotlin/org/jetbrains/kotlinx/jupyter/libraries/constants.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ const val LibrariesDir = "libraries"
77
const val LocalCacheDir = "cache"
88
const val LocalSettingsDir = ".jupyter_kotlin"
99
const val GitHubApiHost = "api.github.com"
10-
const val GitHubRepoOwner = "kotlin"
11-
const val GitHubRepoName = "kotlin-jupyter"
10+
const val GitHubRepoOwner = "Kotlin"
11+
const val GitHubRepoName = "kotlin-jupyter-libraries"
12+
const val RemoteLibrariesDir = ""
1213
const val GitHubApiPrefix = "https://$GitHubApiHost/repos/$GitHubRepoOwner/$GitHubRepoName"
1314
const val LibraryDescriptorExt = "json"
1415
const val LibraryPropertiesFile = ".properties"

jupyter-lib/shared-compiler/src/main/kotlin/org/jetbrains/kotlinx/jupyter/libraries/httpUtil.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.jetbrains.kotlinx.jupyter.config.getLogger
1010
fun getLatestCommitToLibraries(ref: String, sinceTimestamp: String?): Pair<String, String>? {
1111
val logger = getLogger()
1212
return logger.catchAll {
13-
var url = "$GitHubApiPrefix/commits?path=$LibrariesDir&sha=$ref"
13+
var url = "$GitHubApiPrefix/commits?path=$RemoteLibrariesDir&sha=$ref"
1414
if (sinceTimestamp != null) {
1515
url += "&since=$sinceTimestamp"
1616
}
@@ -20,7 +20,7 @@ fun getLatestCommitToLibraries(ref: String, sinceTimestamp: String?): Pair<Strin
2020
if (sinceTimestamp != null) {
2121
getLatestCommitToLibraries(ref, null)
2222
} else {
23-
logger.info("Didn't find any commits to '$LibrariesDir' at $url")
23+
logger.info("Didn't find any commits to libraries at $url")
2424
null
2525
}
2626
} else {

jupyter-lib/shared-compiler/src/main/kotlin/org/jetbrains/kotlinx/jupyter/libraries/libraryResolvers.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ object FallbackLibraryResolver : LibraryDescriptorResolver() {
112112
resolver<LibraryResolutionInfo.ByGitRef> { name ->
113113
if (name == null) throw ReplLibraryLoadingException(message = "Reference library resolver needs name to be specified")
114114

115-
val url = "$GitHubApiPrefix/contents/$LibrariesDir/$name.$LibraryDescriptorExt?ref=$sha"
115+
val url = "$GitHubApiPrefix/contents/$RemoteLibrariesDir/$name.$LibraryDescriptorExt?ref=$sha"
116116
getLogger().info("Requesting library descriptor at $url")
117117
val response = getHttp(url).jsonObject
118118

src/test/kotlin/org/jetbrains/kotlinx/jupyter/test/repl/ReplWithStandardResolverTests.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package org.jetbrains.kotlinx.jupyter.test.repl
22

33
import org.intellij.lang.annotations.Language
4-
import org.jetbrains.kotlinx.jupyter.libraries.GitHubRepoName
5-
import org.jetbrains.kotlinx.jupyter.libraries.GitHubRepoOwner
64
import org.jetbrains.kotlinx.jupyter.libraries.LibrariesDir
75
import org.jetbrains.kotlinx.jupyter.libraries.LibraryDescriptorExt
86
import org.jetbrains.kotlinx.jupyter.libraries.LibraryResolutionInfo
@@ -27,7 +25,7 @@ class ReplWithStandardResolverTests : AbstractSingleReplTest() {
2725
@file:DependsOn("org.geotools:gt-shapefile:[23,)")
2826
@file:DependsOn("org.geotools:gt-cql:[23,)")
2927
30-
%use lets-plot@cfcf8257116ad3753b176a9f779eaaea4619dacd(api=2.0.1)
28+
%use lets-plot@f2bb7075b316e7181ff8fddb1e045c4ed2c26442(api=2.0.1)
3129
3230
@file:DependsOn("org.jetbrains.lets-plot:lets-plot-kotlin-geotools:2.0.1")
3331
@@ -67,6 +65,7 @@ class ReplWithStandardResolverTests : AbstractSingleReplTest() {
6765
@Test
6866
fun testUseFileUrlRef() {
6967
val commit = "cfcf8257116ad3753b176a9f779eaaea4619dacd"
68+
val libsCommit = "f2bb7075b316e7181ff8fddb1e045c4ed2c26442"
7069
val libraryPath = "src/test/testData/test-init.json"
7170

7271
val res1 = eval(
@@ -79,7 +78,7 @@ class ReplWithStandardResolverTests : AbstractSingleReplTest() {
7978

8079
val res2 = eval(
8180
"""
82-
%use @url[https://raw.githubusercontent.com/$GitHubRepoOwner/$GitHubRepoName/$commit/$libraryPath](name=y, value=43)
81+
%use @url[https://raw.githubusercontent.com/Kotlin/kotlin-jupyter/$commit/$libraryPath](name=y, value=43)
8382
y
8483
""".trimIndent()
8584
)
@@ -88,7 +87,7 @@ class ReplWithStandardResolverTests : AbstractSingleReplTest() {
8887
val displays = mutableListOf<Any>()
8988
val handler = TestDisplayHandler(displays)
9089

91-
val res3 = eval("%use lets-plot@$commit", handler)
90+
val res3 = eval("%use lets-plot@$libsCommit", handler)
9291
assertEquals(1, displays.count())
9392
assertUnit(res3.resultValue)
9493
displays.clear()

0 commit comments

Comments
 (0)