{"id":15034650,"url":"https://github.com/scala/scala-async","last_synced_at":"2026-04-02T01:19:54.448Z","repository":{"id":7787461,"uuid":"9157414","full_name":"scala/scala-async","owner":"scala","description":"An asynchronous programming facility for Scala","archived":false,"fork":false,"pushed_at":"2026-03-24T22:01:47.000Z","size":1844,"stargazers_count":1161,"open_issues_count":12,"forks_count":86,"subscribers_count":53,"default_branch":"main","last_synced_at":"2026-03-26T03:44:28.981Z","etag":null,"topics":["asynchronous","concurrency","scala","scala-async"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scala.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-04-01T22:22:27.000Z","updated_at":"2026-03-24T22:01:53.000Z","dependencies_parsed_at":"2023-10-02T03:41:25.102Z","dependency_job_id":"4197e000-97ae-44f6-91ff-e42835b41de0","html_url":"https://github.com/scala/scala-async","commit_stats":{"total_commits":558,"total_committers":32,"mean_commits":17.4375,"dds":"0.48207885304659504","last_synced_commit":"8a6f91d8a20f9b3761063dfbf2b3a71a6606f6c4"},"previous_names":["scala/async"],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/scala/scala-async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala%2Fscala-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala%2Fscala-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala%2Fscala-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala%2Fscala-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scala","download_url":"https://codeload.github.com/scala/scala-async/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala%2Fscala-async/sbom","scorecard":{"id":803156,"data":{"date":"2025-08-11","repo":{"name":"github.com/scala/scala-async","commit":"d58d79d4aede0c64220341c85881b239b48405b9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":8,"reason":"10 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":9,"reason":"Found 20/22 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cla.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/cla.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/scala/scala-async/release.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/cla.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'","Warn: branch protection not enabled for branch '2.10.x'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T11:03:24.552Z","repository_id":7787461,"created_at":"2025-08-23T11:03:24.552Z","updated_at":"2025-08-23T11:03:24.552Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:05:07.454Z","status":"ssl_error","status_checked_at":"2026-04-02T00:56:46.496Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","concurrency","scala","scala-async"],"created_at":"2024-09-24T20:25:51.935Z","updated_at":"2026-04-02T01:19:54.430Z","avatar_url":"https://github.com/scala.png","language":"Scala","readme":"# scala-async [\u003cimg src=\"https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-async_2.12.svg?label=latest%20release%20for%202.12\"\u003e](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-async_2.12) [\u003cimg src=\"https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-async_2.13.svg?label=latest%20release%20for%202.13\"\u003e](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-async_2.13)\n\nA Scala DSL to enable a direct style of coding when composing `Future`s.\n\n## Usage\n\nAs of scala-async 1.0, Scala 2.12.12+ or 2.13.3+ are required.\n\n### Add dependency\n\n#### SBT Example\n\n```scala\nlibraryDependencies += \"org.scala-lang.modules\" %% \"scala-async\" % \"1.0.1\"\nlibraryDependencies += \"org.scala-lang\" % \"scala-reflect\" % scalaVersion.value % Provided\n```\n\nFor Maven projects add the following to your \u003cdependencies\u003e (make sure to use the correct Scala version suffix\nto match your project’s Scala binary version):\n\n#### Maven Example\n\n```scala\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.scala-lang.modules\u003c/groupId\u003e\n  \u003cartifactId\u003escala-async_2.13\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.scala-lang\u003c/groupId\u003e\n  \u003cartifactId\u003escala-reflect\u003c/artifactId\u003e\n  \u003cversion\u003e2.13.8\u003c/version\u003e\n  \u003cscope\u003eprovided\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### Enable compiler support for `async`\n\nAdd the `-Xasync` to the Scala compiler options.\n\n#### SBT Example\n\n```scala\nscalacOptions += \"-Xasync\"\n```\n\n#### Maven Example\n\n```xml\n\u003cproject\u003e\n  ...\n  \u003cplugin\u003e\n    \u003cgroupId\u003enet.alchim31.maven\u003c/groupId\u003e\n    \u003cartifactId\u003escala-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e4.4.0\u003c/version\u003e\n    \u003cconfiguration\u003e\n      \u003cargs\u003e\n        \u003carg\u003e-Xasync\u003c/arg\u003e\n      \u003c/args\u003e\n    \u003c/configuration\u003e\n  \u003c/plugin\u003e\n  ...\n\u003c/project\u003e\n```\n\n### Start coding\n\n```scala\nimport scala.concurrent.ExecutionContext.Implicits.global\nimport scala.async.Async.{async, await}\n\nval future = async {\n  val f1: Future[Boolean] = async { ...; true }\n  val f2 = async { ...; 42 }\n  if (await(f1)) await(f2) else 0\n}\n```\n\n## What is `async`?\n\n`async` marks a block of asynchronous code. Such a block usually contains\none or more `await` calls, which marks a point at which the computation\nwill be suspended until the awaited `Future` is complete.\n\nBy default, `async` blocks operate on `scala.concurrent.{Future, Promise}`.\nThe system can be adapted to alternative implementations of the\n`Future` pattern.\n\nConsider the following example:\n\n```scala\ndef slowCalcFuture: Future[Int] = ...             // 01\ndef combined: Future[Int] = async {               // 02\n  await(slowCalcFuture) + await(slowCalcFuture)   // 03\n}\nval x: Int = Await.result(combined, 10.seconds)   // 05\n```\n\nLine 1 defines an asynchronous method: it returns a `Future`.\n\nLine 2 begins an `async` block. During compilation,\nthe contents of this block will be analyzed to identify\nthe `await` calls, and transformed into non-blocking\ncode.\n\nControl flow will immediately pass to line 5, as the\ncomputation in the `async` block is not executed\non the caller's thread.\n\nLine 3 begins by triggering `slowCalcFuture`, and then\nsuspending until it has been calculated. Only after it\nhas finished, we trigger it again, and suspend again.\nFinally, we add the results and complete `combined`, which\nin turn will release line 5 (unless it had already timed out).\n\nIt is important to note that while lines 1-4 are non-blocking,\nthey are not parallel. If we wanted to parallelize the two computations,\nwe could rearrange the code as follows:\n\n```scala\ndef combined: Future[Int] = async {\n  val future1 = slowCalcFuture\n  val future2 = slowCalcFuture\n  await(future1) + await(future2)\n}\n```\n\n## Limitations\n\n### `await` must be directly in the control flow of the async expression\n\nThe `await` cannot be nested under a local method, object, class or lambda:\n\n```\nasync {\n  List(1).foreach { x =\u003e await(f(x) } // invalid\n}\n```\n\n### `await` must be not be nested within `try` / `catch` / `finally`.\n\nThis implementation restriction may be lifted in future versions.\n\n## Comparison with direct use of `Future` API\n\nThis computation could also be expressed by directly using the\nhigher-order functions of Futures:\n\n```scala\ndef slowCalcFuture: Future[Int] = ...\nval future1 = slowCalcFuture\nval future2 = slowCalcFuture\ndef combined: Future[Int] = for {\n  r1 \u003c- future1\n  r2 \u003c- future2\n} yield r1 + r2\n```\n\nThe `async` approach has two advantages over the use of\n`map` and `flatMap`:\n  1. The code more directly reflects the programmer's intent,\n     and does not require us to name the results `r1` and `r2`.\n     This advantage is even more pronounced when we mix control\n     structures in `async` blocks.\n  2. `async` blocks are compiled to a single anonymous class,\n     as opposed to a separate anonymous class for each closure\n     required at each generator (`\u003c-`) in the for-comprehension.\n     This reduces the size of generated code, and can avoid boxing\n     of intermediate results.\n","funding_links":[],"categories":["Table of Contents"],"sub_categories":["Extensions"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscala%2Fscala-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscala%2Fscala-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscala%2Fscala-async/lists"}