Skip to content

Add the Toolkit tutorials: MUnit, OS-Lib, UPickle and sttp #2795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 119 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
d153307
Init tutorials about MUnit in the Scala Toolkit
adpi2 Nov 14, 2022
a8dd89e
Tutorial for MUnit async tests.
sjrd Nov 14, 2022
20ea8d2
Small imprvements
adpi2 Nov 14, 2022
032fadb
Merge pull request #9 from sjrd/tutorial-munit-async
adpi2 Nov 14, 2022
263d988
Add tutorial on writing assertions
julienrf Nov 15, 2022
afc5122
+you -we
julienrf Nov 15, 2022
0d96b56
complete tutorial for running individual tests
bishabosha Nov 14, 2022
eb3808a
Merge pull request #10 from scalacenter/toolkit-munit-single-test
bishabosha Nov 16, 2022
633bd5b
Improve intro and “next steps”
julienrf Nov 17, 2022
b3a659b
Make munit-test-suite tutorial more concise
adpi2 Nov 16, 2022
af14a6b
Adding small tutorial about testing exceptions
adpi2 Nov 17, 2022
cd85d90
Merge pull request #15 from adpi2/munit-exceptions
adpi2 Nov 17, 2022
23521c6
Remove explanations
julienrf Nov 18, 2022
0378714
Merge pull request #11 from scalacenter/assertions
adpi2 Nov 18, 2022
083c32d
Init tutorials about sttp
szymon-rd Dec 14, 2022
cc77932
Fix munit -> sttp
szymon-rd Dec 14, 2022
fdc3e18
Navigate from munit
szymon-rd Dec 14, 2022
b89bead
Fix next page on sttp-request-body
szymon-rd Dec 15, 2022
3ac518e
Tutorial on uploading files
szymon-rd Dec 15, 2022
a7074af
Fixing some typos
szymon-rd Dec 15, 2022
b206115
Apply suggestions from code review
szymon-rd Dec 16, 2022
ffb9c8a
Rename dynamic urls tutorialg
szymon-rd Dec 16, 2022
22b404b
Fix address & change the link
szymon-rd Dec 16, 2022
d171760
Split into lines
szymon-rd Dec 16, 2022
8ec129f
Fix some URLs
szymon-rd Dec 21, 2022
f3f84bd
Add tutorial about flaky tests
adpi2 Nov 18, 2022
e36d7de
Merge pull request #17 from adpi2/munit-flakiness
adpi2 Dec 28, 2022
19518b4
Add tutorial about resource management in MUnit
adpi2 Nov 18, 2022
8e00657
Merge pull request #16 from adpi2/munit-resources
adpi2 Dec 28, 2022
9fe2e2f
Review & structure fixes to sttp tutorials
szymon-rd Jan 4, 2023
900bbdd
Missing .html
szymon-rd Jan 5, 2023
d34f2ae
Fix links
szymon-rd Jan 12, 2023
3856742
Shorter sentences and other changes
adpi2 Jan 18, 2023
67e1af0
Apply suggestions from code review
adpi2 Jan 18, 2023
a1d7f4e
WIP: os-lib tutorial
SethTisue Feb 1, 2023
68e9c3f
wip
SethTisue Feb 1, 2023
ad9a25c
wip
SethTisue Feb 24, 2023
4b385c8
wip
SethTisue Feb 24, 2023
03746e8
wip
SethTisue Feb 28, 2023
5850414
wip
SethTisue Feb 28, 2023
45dcb3b
wip
SethTisue Feb 28, 2023
3ab3445
wip
SethTisue Feb 28, 2023
4b1f464
apply review feedback from Szymon
SethTisue Mar 1, 2023
af3bb0e
Reworking tutorials to have two tabs
szymon-rd Mar 1, 2023
3aa5519
Add scala versions to snippets
szymon-rd Mar 2, 2023
e85098c
Fix Scala-cli installation
szymon-rd Mar 2, 2023
0a4d1cd
Merge remote-tracking branch 'origin/main' into toolkit
adpi2 Mar 27, 2023
e8a1625
Explain testOnly
adpi2 Mar 27, 2023
be04161
Merge pull request #18 from scalacenter/toolkit-sttp
adpi2 Mar 29, 2023
4896542
Init upicle tutorials
szymon-rd Dec 21, 2022
d9bc226
Reading jsons lesson
szymon-rd Dec 21, 2022
3df21f8
Fixes to the tutorial
szymon-rd Dec 21, 2022
34c94b7
More work on reading JSONs tutorial
szymon-rd Dec 21, 2022
bf80ca8
3 tutorials in total for upickle
szymon-rd Dec 22, 2022
484981f
More tutorials on upickle
szymon-rd Dec 22, 2022
4a2ccf6
Update links to prev/next
szymon-rd Dec 22, 2022
7fadcaa
Fixes in the upickle tutorials
szymon-rd Jan 4, 2023
3862453
Fix links
szymon-rd Jan 12, 2023
6a19bdc
Review JSON tutorials
adpi2 Jan 19, 2023
f9d9678
Add scala versions to snippets
szymon-rd Mar 2, 2023
d4a229b
Merge pull request #22 from scalacenter/toolkit-upickle
adpi2 Mar 29, 2023
6aacbd1
Merge remote-tracking branch 'scalacenter/toolkit' into oslib-tutorial
SethTisue Mar 29, 2023
f3865fe
Tutorials on STTP x UPickle
szymon-rd Jan 17, 2023
07e2c63
Use real examples from the Github REST API
adpi2 Jan 27, 2023
17bb590
Add snippets for different versions of Scala
szymon-rd Mar 2, 2023
8129767
Merge pull request #23 from scalacenter/toolkit-sttp-upickle
adpi2 Mar 29, 2023
5cc1259
Merge pull request #21 from SethTisue/oslib-tutorial
adpi2 Mar 29, 2023
b16b40c
Fix pages of toolkit tutorials
adpi2 Mar 29, 2023
7deb40c
Restructuring the Toolkit tutorials
adpi2 Mar 29, 2023
c1efe88
Fix title of upickle-parse-json
adpi2 Mar 29, 2023
03a61e8
Fix titles of upickle-parse-json and sttp-query-parameters
adpi2 Mar 30, 2023
8dad30c
OS-Lib adjustments
SethTisue Mar 30, 2023
8e2d901
what else can OS-Lib do
SethTisue Mar 30, 2023
cb8d0ce
oslib: take Julien's suggestion
SethTisue Mar 30, 2023
1ca93bf
revise OS-Lib examples to not be REPL based
SethTisue Apr 5, 2023
9af67c6
Add short introduction
adpi2 Apr 6, 2023
28a9fc9
Add MUnit intro
adpi2 Apr 6, 2023
16b26fc
Add uPickle intro
adpi2 Apr 6, 2023
7c02349
Add uPickle what else
adpi2 Apr 6, 2023
38e7d66
Add a word about why testing is useful
adpi2 Apr 6, 2023
43d18f3
expand overall intro
SethTisue Apr 6, 2023
bfba2d4
expand introduction
SethTisue Apr 6, 2023
a1e7332
Add sttp intro
adpi2 Apr 6, 2023
c2ac051
Link build tool tab together
adpi2 Apr 11, 2023
4f40de7
Add checks for class=tabs-build-tool
adpi2 Apr 11, 2023
a5138b7
Fix function.js
adpi2 Apr 12, 2023
aa21d52
fix default build tool tab
adpi2 Apr 12, 2023
5a43175
Rework introduction
adpi2 Apr 12, 2023
ae8cd40
Review MUnit
adpi2 Apr 12, 2023
09bc3aa
Review install boxes in intros
adpi2 Apr 12, 2023
956bc08
Review OS-Lib
adpi2 Apr 12, 2023
83db85c
Review upickle
adpi2 Apr 13, 2023
c9c9716
Review sttp
adpi2 Apr 14, 2023
da879bb
Update nums and pages
adpi2 Apr 14, 2023
5c1ac17
Finishing touches
adpi2 Apr 14, 2023
50f2e25
update Gemfile.lock for use on MacOS
SethTisue May 3, 2023
30ebba1
make overall intro a bit more concise
SethTisue May 3, 2023
a75e5ce
proofread MUnit sections
SethTisue May 3, 2023
60dc689
proofread uPickle sections
SethTisue May 3, 2023
9f39d90
rewrite the sttp intro pretty heavily
SethTisue May 3, 2023
93ee020
proofread entire sttp tutorial
SethTisue May 3, 2023
7ab0d4f
avoid talk of 'install'ing libraries
SethTisue May 3, 2023
2027f27
fix broken link
SethTisue May 3, 2023
79a4925
Update versions
adpi2 May 3, 2023
00f9511
small fixes in munit
adpi2 May 3, 2023
271bcb8
small fixes in uPickle
adpi2 May 3, 2023
f76106b
Rename files
adpi2 May 3, 2023
ae6e397
Run mdoc in http-client tutos
adpi2 May 3, 2023
680d2fc
Run mdoc on JSON tutorials
adpi2 May 4, 2023
5087957
Run mdoc in OS tutorials
adpi2 May 4, 2023
ef2e3c3
run mdoc in testing tutorials
adpi2 May 4, 2023
ba1a04d
fix mdoc
adpi2 May 4, 2023
850ec10
using dep, not using lib
SethTisue May 5, 2023
c53b084
Add toolkit in the index page and nav bar
adpi2 May 5, 2023
c0d9150
Use toolkit lib in all build tools
adpi2 May 5, 2023
ee6ffc9
Add index in intro
adpi2 May 5, 2023
a587ace
Use dep toolkit-test
adpi2 May 5, 2023
ed1932c
Fix install munit
adpi2 May 5, 2023
e51bd07
Merge remote-tracking branch 'origin/main' into toolkit
adpi2 May 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ defaults:
overview-name: "Scaladoc"
layout: multipage-overview
permalink: "/scala3/guides/scaladoc/:title.html"
-
scope:
path: "_overviews/toolkit"
values:
partof: toolkit
overview-name: "The Scala Toolkit"
layout: multipage-overview
permalink: "/toolkit/:title.html"
-
scope:
path: "scala3"
Expand All @@ -203,6 +211,6 @@ highlighter: rouge
permalink: /:categories/:title.html:output_ext
baseurl:
scala3ref: "https://docs.scala-lang.org/scala3/reference"
exclude: ["vendor"]
exclude: ["vendor", ".metals"]
plugins:
- jekyll-redirect-from
2 changes: 2 additions & 0 deletions _data/doc-nav-header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
url: "/tutorials/scala-on-android.html"
- title: Scala with Maven
url: "/tutorials/scala-with-maven.html"
- title: Using the Scala Toolkit
url: "/toolkit/introduction.html"
- title: Reference
url: "#"
submenu:
Expand Down
51 changes: 51 additions & 0 deletions _includes/_markdown/install-munit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% altDetails install-info-box 'Getting MUnit' %}

{% tabs munit-unit-test-1 class=tabs-build-tool %}
{% tab 'Scala CLI' %}
You can require the entire toolkit in a single line:
```scala
//> using dep "org.scala-lang::toolkit-test:0.1.7"
```

Alternatively, you can require just a specific version of MUnit:
```scala
//> using dep "org.scalameta::munit:1.0.0-M7"
```
{% endtab %}
{% tab 'sbt' %}
In your build.sbt file, you can add the dependency on toolkit-test:
```scala
lazy val example = project.in(file("example"))
.settings(
scalaVersion := "3.2.2",
libraryDependencies += "org.scala-lang" %% "toolkit-test" % "0.1.7" % Test
)
```
Here the `Test` configuration means that the dependency is only used by the source files in `example/src/test`.

Alternatively, you can require just a specific version of MUnit:
```scala
libraryDependencies += "org.scalameta" %% "munit" % "1.0.0-M7" % Test
```
{% endtab %}
{% tab 'Mill' %}
In your build.sc file, you can add a `test` object extending `Tests` and `TestModule.Munit`:
```scala
object example extends ScalaModule {
def scalaVersion = "3.2.2"
object test extends Tests with TestModule.Munit {
def ivyDeps =
Agg(
ivy"org.scala-lang::toolkit-test:0.1.7"
)
}
}
```

Alternatively, you can require just a specific version of MUnit:
```scala
ivy"org.scalameta::munit:1.0.0-M7"
```
{% endtab %}
{% endtabs %}
{% endaltDetails %}
46 changes: 46 additions & 0 deletions _includes/_markdown/install-os-lib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% altDetails require-info-box 'Getting OS-Lib' %}

{% tabs oslib-install class=tabs-build-tool %}
{% tab 'Scala CLI' %}
You can require the entire toolkit in a single line:
```scala
//> using toolkit "latest"
```

Alternatively, you can require just a specific version of OS-Lib:
```scala
//> using dep "com.lihaoyi::os-lib:0.9.1"
```
{% endtab %}
{% tab 'sbt' %}
In your `build.sbt`, you can add a dependency on the toolkit:
```scala
lazy val example = project.in(file("example"))
.settings(
scalaVersion := "3.2.2",
libraryDependencies += "org.scala-lang" %% "toolkit" % "0.1.7"
)
```
Alternatively, you can require just a specific version of OS-Lib:
```scala
libraryDependencies += "com.lihaoyi" %% "os-lib" % "0.9.1"
```
{% endtab %}
{% tab 'Mill' %}
In your `build.sc` file, you can add a dependency on the Toolkit:
```scala
object example extends ScalaModule {
def scalaVersion = "3.2.2"
def ivyDeps =
Agg(
ivy"org.scala-lang::toolkit:0.1.7"
)
}
```
Alternatively, you can require just a specific version of OS-Lib:
```scala
ivy"com.lihaoyi::os-lib:0.9.1"
```
{% endtab %}
{% endtabs %}
{% endaltDetails %}
47 changes: 47 additions & 0 deletions _includes/_markdown/install-sttp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% altDetails install-info-box 'Getting sttp' %}

{% tabs sttp-install-methods class=tabs-build-tool%}
{% tab 'Scala CLI' %}
You can require the entire toolkit in a single line:
```scala
//> using toolkit "latest"
```

Alternatively, you can require just a specific version of sttp:
```scala
//> using dep "com.softwaremill.sttp.client4::core:4.0.0-M1"
```
{% endtab %}
{% tab 'sbt' %}
In your build.sbt file, you can add a dependency on the Toolkit:
```scala
lazy val example = project.in(file("example"))
.settings(
scalaVersion := "3.2.2",
libraryDependencies += "org.scala-lang" %% "toolkit" % "0.1.7"
)
```

Alternatively, you can require just a specific version of sttp:
```scala
libraryDependencies += "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M1"
```
{% endtab %}
{% tab 'Mill' %}
In your build.sc file, you can add a dependency on the Toolkit:
```scala
object example extends ScalaModule {
def scalaVersion = "3.2.2"
def ivyDeps =
Agg(
ivy"org.scala-lang::toolkit:0.1.7"
)
}
```
Alternatively, you can require just a specific version of sttp:
```scala
ivy"com.softwaremill.sttp.client4::core:4.0.0-M1"
```
{% endtab %}
{% endtabs %}
{% endaltDetails %}
46 changes: 46 additions & 0 deletions _includes/_markdown/install-upickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% altDetails install-info-box 'Getting upickle' %}

{% tabs upickle-install-methods class=tabs-build-tool %}
{% tab 'Scala CLI' %}
Using Scala CLI, you can require the entire toolkit in a single line:
```scala
//> using toolkit "latest"
```

Alternatively, you can require just a specific version of UPickle:
```scala
//> using dep "com.lihaoyi::upickle:3.1.0
```
{% endtab %}
{% tab 'sbt' %}
In your build.sbt file, you can add the dependency on the Toolkit:
```scala
lazy val example = project.in(file("example"))
.settings(
scalaVersion := "3.2.2",
libraryDependencies += "org.scala-lang" %% "toolkit" % "0.1.7"
)
```
Alternatively, you can require just a specific version of UPickle:
```scala
libraryDependencies += "com.lihaoyi" %% "upickle" % "3.1.0"
```
{% endtab %}
{% tab 'Mill' %}
In your build.sc file, you can add the dependency to the upickle library:
```scala
object example extends ScalaModule {
def scalaVersion = "3.2.2"
def ivyDeps =
Agg(
ivy"org.scala-lang::toolkit:0.1.7"
)
}
```
Alternatively, you can require just a specific version of UPickle:
```scala
ivy"com.lihaoyi::upickle:3.1.0"
```
{% endtab %}
{% endtabs %}
{% endaltDetails %}
3 changes: 3 additions & 0 deletions _includes/markdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%if include.selector%}<{{include.selector}} {%if include.classes%}class="{{include.classes}}"{%endif%} {%if include.id%}id="{{include.id}}{%endif%}">{%endif%}
{% capture markdown %}{% include {{include.path}} %}{% endcapture %}{{ markdown | markdownify }}
{%if include.selector%}</{{include.selector}}>{%endif%}
29 changes: 29 additions & 0 deletions _overviews/toolkit/OrderedListOfMdFiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
introduction.md
testing-intro.md
testing-suite.md
testing-run.md
testing-run-only.md
testing-exceptions.md
testing-asynchronous.md
testing-resources.md
testing-what-else.md
os-intro.md
os-read-directory.md
os-read-file.md
os-write-file.md
os-run-process.md
os-what-else.md
json-intro.md
json-parse.md
json-modify.md
json-deserialize.md
json-serialize.md
json-files.md
json-what-else.md
http-client-intro.md
http-client-request.md
http-client-uris.md
http-client-request-body.md
http-client-json.md
http-client-upload-file.md
http-client-what-else.md
20 changes: 20 additions & 0 deletions _overviews/toolkit/http-client-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Sending HTTP requests with sttp
type: chapter
description: The introduction of the sttp library
num: 23
previous-page: json-what-else
next-page: http-client-request
---

sttp is a popular and feature-rich library for making HTTP requests to web servers.

It provides both a synchronous API and an asynchronous `Future`-based API. It also supports WebSockets.

Extensions are available that add capabilities such as streaming, logging, telemetry, and serialization.

sttp offers the same APIs on all platforms (JVM, Scala.js, and Scala Native).

sttp is a good choice for small synchronous scripts as well as large-scale, highly concurrent, asynchronous applications.

{% include markdown.html path="_markdown/install-sttp.md" %}
Loading