{"id":13880572,"url":"https://github.com/softwaremill/magnolia","last_synced_at":"2026-02-26T11:27:25.643Z","repository":{"id":36951061,"uuid":"93566457","full_name":"softwaremill/magnolia","owner":"softwaremill","description":"Easy, fast, transparent generic derivation of typeclass instances","archived":false,"fork":false,"pushed_at":"2026-02-24T17:31:44.000Z","size":2062,"stargazers_count":795,"open_issues_count":76,"forks_count":125,"subscribers_count":40,"default_branch":"scala3","last_synced_at":"2026-02-24T21:49:05.956Z","etag":null,"topics":["datatypes","derives-typeclasses","generic-derivation","generic-programming","implicit-search","magnolia-derivation","scala","typeclass","typeclass-derivation","typeclasses"],"latest_commit_sha":null,"homepage":"https://softwaremill.com/open-source/","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/softwaremill.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"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":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-06-06T21:43:05.000Z","updated_at":"2026-02-22T12:44:45.000Z","dependencies_parsed_at":"2023-12-20T13:23:08.620Z","dependency_job_id":"0dd8ced6-26a4-467d-8c65-72fda782ce48","html_url":"https://github.com/softwaremill/magnolia","commit_stats":{"total_commits":615,"total_committers":62,"mean_commits":9.919354838709678,"dds":0.7609756097560976,"last_synced_commit":"e046c3d997e6c3f9067a79692da52e64165e7553"},"previous_names":["propensive/magnolia"],"tags_count":105,"template":false,"template_full_name":null,"purl":"pkg:github/softwaremill/magnolia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fmagnolia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fmagnolia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fmagnolia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fmagnolia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwaremill","download_url":"https://codeload.github.com/softwaremill/magnolia/tar.gz/refs/heads/scala3","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fmagnolia/sbom","scorecard":{"id":747038,"data":{"date":"2025-08-11","repo":{"name":"github.com/softwaremill/magnolia","commit":"a7e78d9997eab5551519a3c5904117ae5b53748e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.5,"checks":[{"name":"Maintained","score":7,"reason":"7 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 7","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":7,"reason":"Found 16/21 approved changesets -- score normalized to 7","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":"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":"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:59: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:84: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/ci.yml/scala3?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/scala-steward.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/softwaremill/magnolia/scala-steward.yml/scala3?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 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/scala-steward.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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license.md:0","Info: FSF or OSI recognized license: Apache License 2.0: license.md: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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/ci.yml:49"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 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-22T19:08:20.007Z","repository_id":36951061,"created_at":"2025-08-22T19:08:20.007Z","updated_at":"2025-08-22T19:08:20.007Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29857330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T08:51:08.701Z","status":"ssl_error","status_checked_at":"2026-02-26T08:50:19.607Z","response_time":89,"last_error":"SSL_read: 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":["datatypes","derives-typeclasses","generic-derivation","generic-programming","implicit-search","magnolia-derivation","scala","typeclass","typeclass-derivation","typeclasses"],"created_at":"2024-08-06T08:03:13.750Z","updated_at":"2026-02-26T11:27:25.606Z","avatar_url":"https://github.com/softwaremill.png","language":"Scala","readme":"![Magnolia](https://github.com/softwaremill/magnolia/raw/scala3/banner.jpg)\n\n[\u003cimg alt=\"GitHub Workflow\" src=\"https://img.shields.io/github/actions/workflow/status/softwaremill/magnolia/ci.yml?branch=scala3\u0026style=for-the-badge\" height=\"24\"\u003e](https://github.com/softwaremill/magnolia/actions)\n[\u003cimg src=\"https://img.shields.io/badge/Discourse-ask%20question-blue?style=for-the-badge\" height=\"24\"\u003e](https://softwaremill.community/c/magnolia)\n[\u003cimg src=\"https://index.scala-lang.org/softwaremill/magnolia/magnolia/latest-by-scala-version.svg?color=2465cd\u0026style=for-the-badge\" height=\"24\"\u003e](https://index.scala-lang.org/softwaremill/magnolia/magnolia)\n\n# Magnolia\n\n__Magnolia__ is a generic macro for automatic materialization of typeclasses for datatypes composed from product types (e.g. case classes) and coproduct types (e.g. enums). It supports recursively-defined datatypes out-of-the-box, and incurs no significant time-penalty during compilation.\n\n## Features\n\n - derives typeclasses for case classes, case objects and sealed traits\n - offers a lightweight syntax for writing derivations without needing to understand complex parts of Scala\n - builds upon Scala 3's built-in generic derivation\n - works with recursive and mutually-recursive definitions\n - supports parameterized ADTs (GADTs), including those in recursive types\n - supports typeclasses whose generic type parameter is used in either covariant and contravariant positions\n\n## Getting Started\n\nGiven an ADT such as,\n```scala\nenum Tree[+T] derives Print:\n  case Branch(left: Tree[T], right: Tree[T])\n  case Leaf(value: T)\n```\nand provided a given instance of `Print[Int]` is in scope, and a Magnolia derivation for the `Print` typeclass\nhas been provided, we can automatically derive given typeclass instances of `Print[Tree[Int]]` on-demand, like\nso,\n```scala\nTree.Branch(Tree.Branch(Tree.Leaf(1), Tree.Leaf(2)), Tree.Leaf(3)).print\n```\nTypeclass authors may provide Magnolia derivations in the typeclass's companion object, but it is easy to create\nyour own.\n\nCreating a generic derivation with Magnolia requires implementing two methods on `magnolia1.Derivation`:\n\n* `join()` : create typeclasses for case classes ('product types')\n* `split()` : create typeclasses for sealed-traits/enums ('sum types')\n\n### Example derivations\n\nThere are many examples in the   [`examples`](examples/src/main/scala/magnolia1/examples) sub-project.\n\nThe definition of a `Print` typeclass with generic derivation might look like this\n(note we're using the [Lambda syntax for Single Abstract Method types](https://www.scala-lang.org/news/2.12.0/#lambda-syntax-for-sam-types)\nto instantiate the `Print` instances in `join` \u0026 `split` - that's possible because\n`Print` has only a single abstract method, `print`):\n```scala\nimport magnolia1.*\n\ntrait Print[T] {\n  extension (x: T) def print: String\n}\n\nobject Print extends AutoDerivation[Print]:\n  def join[T](ctx: CaseClass[Print, T]): Print[T] = value =\u003e\n    ctx.params.map { param =\u003e\n      param.typeclass.print(param.deref(value))\n    }.mkString(s\"${ctx.typeInfo.short}(\", \",\", \")\")\n\n  override def split[T](ctx: SealedTrait[Print, T]): Print[T] = value =\u003e\n    ctx.choose(value) { sub =\u003e sub.typeclass.print(sub.cast(value)) }\n  \n  given Print[Int] = _.toString\n```\n\nThe `AutoDerivation` trait provides a given `autoDerived` method which will attempt to construct a corresponding typeclass\ninstance for the type passed to it. Importing `Print.autoDerived` as defined in the example above will make generic\nderivation for `Print` typeclasses available in the scope of the import.\n\nWhile any object may be used to define a derivation, if you control the typeclass you are deriving for, the\ncompanion object of the typeclass is the obvious choice since it generic derivations for that typeclass will\nbe automatically available for consideration during contextual search.\n\nIf you don't want to make the automatic derivation available in the given scope, consider using the `Derivation` trait which provides semi-auto derivation with `derived` method, but also brings some additional limitations.\n## Limitations\n\nFor accessing default values for case class parameters we recommend compilation with `-Yretain-trees` on.\n\nFor a recursive structures it is required to assign the derived value to an implicit variable e.g.\n```Scala\ngiven instance: SemiPrint[Recursive] = SemiPrint.derived\n```  \n## Availability\n\nFor Scala 3:\n\n```scala\nval magnolia = \"com.softwaremill.magnolia1_3\" %% \"magnolia\" % \"1.3.16\"\n```\n\nFor Scala 2, see the [scala2 branch](https://github.com/softwaremill/magnolia/tree/scala2).\n\n## Package and artifact naming, versioning\n\nThe main magnolia package is `magnolia1`, so that magnolia 1.x can be used alongside magnolia 0.17 (which are binary-incompatible).\nFuture major releases of magnolia can change the package name for the same reason.\n\nThe group id for magnolia follows the naming scheme: `com.softwaremill.magnolia[major version]_[scala major version]`.\nThe scala major version suffix is necessary to allow evolving and publishing versions for Scala 2 \u0026 Scala 3 independently.\nThe magnolia major version is included for consistency with the package name, and so that future major releases may be\nused alongside this release.\n\n## Contributing\n\nContributors to Magnolia are welcome and encouraged. New contributors may like to look for issues marked\n\u003ca href=\"https://github.com/softwaremill/magnolia/labels/good%20first%20issue\"\u003e\u003cimg alt=\"label: good first issue\"\nsrc=\"https://img.shields.io/badge/-good%20first%20issue-67b6d0.svg\" valign=\"middle\"\u003e\u003c/a\u003e.\n\n## Credits\n\nMagnolia was originally designed and developed by [Jon Pretty](https://github.com/propensive), and is currently\nmaintained by [SoftwareMill](https://softwaremill.com).\n\n## License\n\nMagnolia is made available under the [Apache 2.0 License](/license.md).\n","funding_links":[],"categories":["Scala"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Fmagnolia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwaremill%2Fmagnolia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Fmagnolia/lists"}