Scala
made by https://0x3d.site
GitHub - sksamuel/avro4s: Avro schema generation and serialization / deserialization for ScalaAvro schema generation and serialization / deserialization for Scala - sksamuel/avro4s
Visit Site
GitHub - sksamuel/avro4s: Avro schema generation and serialization / deserialization for Scala
This is a community project - PRs will be accepted and releases published by the maintainer
Avro4s is a schema/class generation and serializing/deserializing library for Avro written in Scala. The objective is to allow seamless use with Scala without the need to write boilerplate conversions yourself, and without the runtime overhead of reflection. Hence, this is a macro based library and generates code for use with Avro at compile time.
The features of the library are:
- Schema generation from classes at compile time
- Boilerplate free serialization of Scala types into Avro types
- Boilerplate free deserialization of Avro types to Scala types
Versioning
The master
branch contains version 5.0.x which is designed for Scala 3. PRs are welcome. This version may have minor breaking changes compared to previous major release in order to support the new features of Scala 3.
The previous major version is 4.0.x located at branch release/4.0.x
and is released for Scala 2.12 and Scala 2.13.
This version is in support mode only. Bug reports are welcome and bug fixes will be released. No new features will be
added.
Please raise PRs using branch names scala2/*
and scala3/*
depending on which version of Scala your work is
targeting.
Schemas
Unlike Json, Avro is a schema based format. You'll find yourself wanting to generate schemas frequently, and writing
these by hand or through the Java based SchemaBuilder
classes can be tedious for complex domain models. Avro4s allows
us to generate schemas directly from case classes at compile time via macros. This gives you both the convenience of
generated code, without the annoyance of having to run a code generation step, as well as avoiding the peformance
penalty of runtime reflection based code.
Let's define some classes.
case class Ingredient(name: String, sugar: Double, fat: Double)
case class Pizza(name: String, ingredients: Seq[Ingredient], vegetarian: Boolean, vegan: Boolean, calories: Int)
To generate an Avro Schema, we need to use the AvroSchema
object passing in the target type as a type parameter.
This will return an org.apache.avro.Schema
instance.
import com.sksamuel.avro4s.AvroSchema
val schema = AvroSchema[Pizza]
Where the generated schema is as follows:
{
"type":"record",
"name":"Pizza",
"namespace":"com.sksamuel",
"fields":[
{
"name":"name",
"type":"string"
},
{
"name":"ingredients",
"type":{
"type":"array",
"items":{
"type":"record",
"name":"Ingredient",
"fields":[
{
"name":"name",
"type":"string"
},
{
"name":"sugar",
"type":"double"
},
{
"name":"fat",
"type":"double"
}
]
}
}
},
{
"name":"vegetarian",
"type":"boolean"
},
{
"name":"vegan",
"type":"boolean"
},
{
"name":"calories",
"type":"int"
}
]
}
You can see that the schema generator handles nested case classes, sequences, primitives, etc. For a full list of supported object types, see the table later.
Overriding class name and namespace
Avro schemas for complex types (RECORDS) contain a name and a namespace. By default, these are the name of the class
and the enclosing package name, but it is possible to customize these using the annotations AvroName
and AvroNamespace
.
For example, the following class:
package com.sksamuel
case class Foo(a: String)
Would normally have a schema like this:
{
"type":"record",
"name":"Foo",
"namespace":"com.sksamuel",
"fields":[
{
"name":"a",
"type":"string"
}
]
}
However we can override the name and/or the namespace like this:
package com.sksamuel
@AvroName("Wibble")
@AvroNamespace("com.other")
case class Foo(a: String)
And then the generated schema looks like this:
{
"type":"record",
"name":"Wibble",
"namespace":"com.other",
"fields":[
{
"name":"a",
"type":"string"
}
]
}
Note: It is possible, but not necessary, to use both AvroName and AvroNamespace. You can just use either of them if you wish.
Overriding a field name
The AvroName
annotation can also be used to override field names. This is useful when the record instances you are generating or reading need to have field names different from the scala case classes. For example if you are reading data generated by another system, or another language.
Given the following class.
package com.sksamuel
case class Foo(a: String, @AvroName("z") b : String)
Then the generated schema would look like this:
{
"type":"record",
"name":"Foo",
"namespace":"com.sksamuel",
"fields":[
{
"name":"a",
"type":"string"
},
{
"name":"z",
"type":"string"
}
]
}
Notice that the second field is z
and not b
.
Note: @AvroName does not add an alternative name for the field, but an override. If you wish to have alternatives then you want to use @AvroAlias.
Adding properties and docs to a Schema
Avro allows a doc field, and arbitrary key/values to be added to generated schemas. Avro4s supports this through the use of AvroDoc
and AvroProp
annotations.
These properties works on either complex or simple types - in other words, on both fields and classes. For example:
package com.sksamuel
@AvroDoc("hello, is it me you're looking for?")
case class Foo(@AvroDoc("I am a string") str: String, @AvroDoc("I am a long") long: Long, int: Int)
Would result in the following schema:
{
"type": "record",
"name": "Foo",
"namespace": "com.sksamuel",
"doc":"hello, is it me you're looking for?",
"fields": [
{
"name": "str",
"type": "string",
"doc" : "I am a string"
},
{
"name": "long",
"type": "long",
"doc" : "I am a long"
},
{
"name": "int",
"type": "int"
}
]
}
An example of properties:
package com.sksamuel
@AvroProp("jack", "bruce")
case class Annotated(@AvroProp("richard", "ashcroft") str: String, @AvroProp("kate", "bush") long: Long, int: Int)
Would generate this schema:
{
"type": "record",
"name": "Annotated",
"namespace": "com.sksamuel",
"fields": [
{
"name": "str",
"type": "string",
"richard": "ashcroft"
},
{
"name": "long",
"type": "long",
"kate": "bush"
},
{
"name": "int",
"type": "int"
}
],
"jack": "bruce"
}
Overriding a Schema
Behind the scenes, AvroSchema
uses an implicit SchemaFor
. This is the core typeclass which generates an Avro schema for a given Java or Scala type. There are SchemaFor
instances for all the common JDK and SDK types, as well as macros that generate instances for case classes.
In order to override how a schema is generated for a particular type you need to bring into scope an implicit SchemaFor
for the type you want to override. As an example, lets say you wanted all integers to be encoded as Schema.Type.STRING
rather than the standard Schema.Type.INT
.
To do this, we just introduce a new instance of SchemaFor
and put it in scope when we generate the schema.
implicit val intOverride = SchemaFor[Int](SchemaBuilder.builder.stringType)
case class Foo(a: Int)
val schema = AvroSchema[Foo]
Note: If you create an override like this, be aware that schemas in Avro are mutable, so don't share the values that the typeclasses return.
Transient Fields
Avro4s does not support the @transient anotation to mark a field as ignored, but instead supports its own @AvroTransient annotation to do the same job. Any field marked with this will be excluded from the generated schema.
package com.sksamuel
case class Foo(a: String, @AvroTransient b: String)
Would result in the following schema:
{
"type": "record",
"name": "Foo",
"namespace": "com.sksamuel",
"fields": [
{
"name": "a",
"type": "string"
}
]
}
Field Mapping
If you are dealing with Avro data generated in other languages then it's quite likely the field names will reflect the style of that language. For example, Java may prefer camelCaseFieldNames
but other languages may use snake_case_field_names
or PascalStyleFieldNames
. By default the name of the field in the case class is what will be used, and you've seen earlier that you can override a specific field with @AvroName, but doing this for every single field would be insane.
So, avro4s provides a FieldMapper
for this. You simply bring into scope an instance of FieldMapper
that will convert the scala field names into a target type field names.
For example, lets take a scala case and generate a schema using snake case.
package com.sksamuel
case class Foo(userName: String, emailAddress: String)
implicit val snake: FieldMapper = SnakeCase
val schema = AvroSchema[Foo]
Would generate the following schema:
{
"type": "record",
"name": "Foo",
"namespace": "com.sksamuel",
"fields": [
{
"name": "user_name",
"type": "string"
},
{
"name": "email_address",
"type": "string"
}
]
}
You can also define your own field mapper:
package com.sksamuel
case class Foo(userName: String, emailAddress: String)
implicit val short: FieldMapper = {
case "userName" => "user"
case "emailAddress" => "email"
}
val schema = AvroSchema[Foo]
Would generate the following schema:
{
"type": "record",
"name": "Foo",
"namespace": "com.sksamuel",
"fields": [
{
"name": "user",
"type": "string"
},
{
"name": "email",
"type": "string"
}
]
}
Field Defaults
Avro4s will take into account default values on fields. For example, the following class case class Wibble(s: String = "foo")
would be serialized as:
{
"type": "record",
"name": "Wibble",
"namespace": "com.sksamuel.avro4s.schema",
"fields": [
{
"name": "s",
"type": "string",
"default" : "foo"
}
]
}
However if you wish the scala default to be ignored, then you can annotate the field with @AvroNoDefault. So this class case class Wibble(@AvroNoDefault s: String = "foo")
would be serialized as:
{
"type": "record",
"name": "Wibble",
"namespace": "com.sksamuel.avro4s.schema",
"fields": [
{
"name": "s",
"type": "string"
}
]
}
Enums and Enum Defaults
AVRO Enums from Scala Enums, Java Enums, and Sealed Traits
Avro4s maps scala enums, java enums, and scala sealed traits to the AVRO enum
type.
For example, the following scala enum:
object Colours extends Enumeration {
val Red, Amber, Green = Value
}
when referenced in a case class:
case class Car(colour: Colours.Value)
results in the following AVRO schema (e.g. using val schema = AvroSchema[Car]
):
{
"type" : "record",
"name" : "Car",
"fields" : [ {
"name" : "colour",
"type" : {
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green" ]
}
} ]
}
Avro4s will also convert a Java enum such as:
public enum Wine {
Malbec, Shiraz, CabSav, Merlot
}
into an AVRO enum
type:
{
"type": "enum",
"name": "Wine",
"symbols": [ "Malbec", "Shiraz", "CabSav", "Merlot" ]
}
And likewise, avro4s will convert a sealed trait such as:
sealed trait Animal
@AvroSortPriority(0) case object Cat extends Animal
@AvroSortPriority(-1) case object Dog extends Animal
into the following AVRO enum
schema:
{
"type" : "enum",
"name" : "Animal",
"symbols" : [ "Cat", "Dog" ]
}
With @AvroSortPriority
attribute, elements are sorted in descending order, by the priority specified
(the element with the highest priority will be put as first).
According to Avro specification, when an element is not found the first compatible element defined in the union is used. For this reason order of the elements should not be changed when compatibility is important. Add new elements at the end.
An alternative solution is to use the @AvroUnionPosition
attribute passing a number that will be sorted ascending,
from lower to upper:
sealed trait Fruit
@AvroUnionPosition(0)
case object Unknown extends Fruit
@AvroUnionPosition(1)
case class Orange(size: Int) extends Fruit
@AvroUnionPosition(2)
case class Mango(size: Int) extends Fruit
This will generate the following AVRO schema:
[
{
"type" : "record",
"name" : "Unknown",
"fields" : [ ]
},
{
"type" : "record",
"name" : "Orange",
"fields" : [ {
"name" : "size",
"type" : "int"
} ]
},
{
"type" : "record",
"name" : "Mango",
"fields" : [ {
"name" : "size",
"type" : "int"
} ]
}
]
Field Defaults vs. Enum Defaults
As with any AVRO field, you can specify an enum field's default value as follows:
case class Car(colour: Colours.Value = Colours.Red)
resulting in the following AVRO schema:
{
"type" : "record",
"name" : "Car",
"fields" : [ {
"name" : "colour",
"type" : {
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green" ]
},
"default": "Red"
} ]
}
One benefit of providing a field default is that the writer can later remove the field without
breaking existing readers. In the Car
example, if the writer doesn't provide a value for the
colour
field, the reader will default the colour
to Red
.
But what if the writer would like to extend the Colour
enumeration to include the colour Orange
:
object Colours extends Enumeration {
val Red, Amber, Green, Orange = Value
}
resulting in the following AVRO schema?
{
"type" : "record",
"name" : "Car",
"fields" : [ {
"name" : "colour",
"type" : {
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green", "Orange" ]
},
"default": "Red"
} ]
}
If a writer creates an Orange
Car
:
Car(colours = Colours.Orange)
readers using the older schema (the one without the new Orange
value), will fail with a backwards compatibility error.
I.e. readers using the previous version of the Car
schema don't know the colour Orange
, and therefore
can't read the new Car
record.
To enable writers to extend enums in a backwards-compatible way, AVRO allows you to specify a default enum value as part of the enum type's definition:
{
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green" ],
"default": "Amber"
}
Note that an enum's default isn't the same as an enum field's default as showed below,
where the enum default is Amber
and the field's default is Red
:
{
"type" : "record",
"name" : "Car",
"fields" : [ {
"name" : "colour",
"type" : {
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green" ],
"default": "Amber"
},
"default": "Red"
} ]
}
Note that the field's default and the enum's default need not be the same value.
The field's default answers the question:
- What value should the reader use if the writer didn't specify the field's value?
In the schema example above, the answer is Red
.
The enum's default value answers the question:
- What value should the reader use if the writer specifies an enum value that the reader doesn't recognize?
In the example above, the answer is Amber
.
In summary, as long as a writer specified a the default enum value in previous versions of an enum's schema, the writer can add
new enum values without breaking older readers. For example, we can add
the colour Orange
to the Colour
enum's list of symbol/values without breaking older readers:
{
"type" : "record",
"name" : "Car",
"fields" : [ {
"name" : "colour",
"type" : {
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green", "Orange" ],
"default": "Amber"
},
"default": "Red"
} ]
}
Specifically, given Amber
as the enum's default, an older AVRO reader that receives an Orange
Car
will
default the Car
's colour
to Amber
, the enum's default.
The following sections describe how to define enum defaults through avro4s for scala enums, java enums, and sealed traits.
Defining Enum Defaults for Scala Enums
For scala enums such as:
object Colours extends Enumeration {
val Red, Amber, Green = Value
}
avro4s gives you two options:
- You can define an implicit
SchemaFor
using theScalaEnumSchemaFor[E].apply(default: E)
method where the method'sdefault
argument is one of the enum's values or ... - You can use the
@AvroEnumDefault
annotation to declare the default enum value.
For example, to create an implicit SchemaFor
for an scala enum with a default enum value,
use the ScalaEnumSchemaFor[E].apply(default: E)
method as follows:
implicit val schemaForColours: SchemaFor[Colours.Value] = ScalaEnumSchemaFor[Colours.Value](default = Colours.Amber)
resulting in the following AVRO schema:
{
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green" ],
"default": "Amber"
}
Or, to declare the default enum value, you can use the @AvroEnumDefault
annotation as follows:
@AvroEnumDefault(Colours.Amber)
object Colours extends Enumeration {
val Red, Amber, Green = Value
}
resulting in the same AVRO schema:
{
"type" : "enum",
"name" : "Colours",
"symbols" : [ "Red", "Amber", "Green" ],
"default": "Amber"
}
You can also use the following avro4s annotations to change a scala enum's name, namespace, and to add additional properties:
@AvroName
@AvroNamespace
@AvroProp
For example:
@AvroName("MyColours")
@AvroNamespace("my.namespace")
@AvroEnumDefault(Colours.Green)
@AvroProp("hello", "world")
object Colours extends Enumeration {
val Red, Amber, Green = Value
}
resulting in the following AVRO schema:
{
"type" : "enum",
"name" : "MyColours",
"namespace" : "my.namespace",
"symbols" : [ "Red", "Amber", "Green" ],
"default": "Amber",
"hello" : "world"
}
Note that if you're using an enum from, for example, a 3rd party library and without access to the source code, you may
not be able to use the @AvroEnumDefault
annotation, in which case you'll need to use the
ScalaEnumSchemaFor[E].apply(default: E)
method instead.
Defining Enum Defaults for Java Enums
For java enums such as:
public enum Wine {
Malbec,
Shiraz,
CabSav,
Merlot
}
avro4s gives you two options to define an enum's default value:
- You can define an implicit
SchemaFor
using theJavaEnumSchemaFor[E].apply(default: E)
method where the method'sdefault
argument is one of the enum's values or ... - You can use the
@AvroJavaEnumDefault
annotation to declare the default enum value.
For example, to create an implicit SchemaFor
for an enum with a default enum value,
use the JavaEnumSchemaFor[E].apply(default: E)
method as follows:
implicit val schemaForWine: SchemaFor[Wine] = JavaEnumSchemaFor[Wine](default = Wine.Merlot)
Or, to declare the default enum value, use the @AvroJavaEnumDefault
annotation as follows:
public enum Wine {
Malbec,
Shiraz,
@AvroJavaEnumDefault CabSav,
Merlot
}
Avro4s also supports the following java annotations for java enums:
@AvroJavaName
@AvroJavaNamespace
@AvroJavaProp
Putting it all together, you can define a java enum with using avro4s's annotations as follows:
@AvroJavaName("MyWine")
@AvroJavaNamespace("my.namespace")
@AvroJavaProp(key = "hello", value = "world")
public enum Wine {
Malbec,
Shiraz,
@AvroJavaEnumDefault CabSav,
Merlot
}
resulting in the following AVRO schema:
{
"type": "enum",
"name": "MyWine",
"namespace": "my.namespace",
"symbols": [
"Malbec",
"Shiraz",
"CabSav",
"Merlot"
],
"default": "CabSav",
"hello": "world"
}
Defining Enum Defaults for Sealed Traits
For sealed traits, you can define the trait's default enum using the @AvroEnumDefault
annotation as follows:
@AvroEnumDefault(Dog)
sealed trait Animal
@AvroSortPriority(0) case object Cat extends Animal
@AvroSortPriority(-1) case object Dog extends Animal
resulting in the following AVRO schema:
{
"type" : "enum",
"name" : "Animal",
"symbols" : [ "Cat", "Dog" ],
"default" : "Dog"
}
Avro Fixed
Avro supports the idea of fixed length byte arrays. To use these we can either override the schema generated for a type to return Schema.Type.Fixed
. This will work for types like String or UUID. You can also annotate a field with @AvroFixed(size).
For example:
package com.sksamuel
case class Foo(@AvroFixed(7) mystring: String)
val schema = AvroSchema[Foo]
Will generate the following schema:
{
"type": "record",
"name": "Foo",
"namespace": "com.sksamuel",
"fields": [
{
"name": "mystring",
"type": {
"type": "fixed",
"name": "mystring",
"size": 7
}
}
]
}
If you have a value type that you always want to be represented as fixed, then rather than annotate every single location it is used, you can annotate the value type itself.
package com.sksamuel
@AvroFixed(4)
case class FixedA(bytes: Array[Byte]) extends AnyVal
case class Foo(a: FixedA)
val schema = AvroSchema[Foo]
And this would generate:
{
"type": "record",
"name": "Foo",
"namespace": "com.sksamuel",
"fields": [
{
"name": "a",
"type": {
"type": "fixed",
"name": "FixedA",
"size": 4
}
}
]
}
Finally, these annotated value types can be used as top level schemas too:
package com.sksamuel
@AvroFixed(6)
case class FixedA(bytes: Array[Byte]) extends AnyVal
val schema = AvroSchema[FixedA]
{
"type": "fixed",
"name": "FixedA",
"namespace": "com.sksamuel",
"size": 6
}
Controlling order of types in generated union schemas
The order of types in a union is significant in Avro, e.g the schemas type: ["int", "float"]
and type: ["float", "int"]
are different. This can cause problems when generating schemas for sealed trait hierarchies. Ideally we would generate schemas using the source code declaration order of the types. So for example:
sealed trait Animal
case class Dog(howFriendly: Float) extends Animal
case class Fish(remembersYou: Boolean) extends Animal
Should generate a schema where the order of types in the unions is Dog, Fish
. Unfortunately, the SchemaFor
macro can sometimes lose track of what the declaration order is - especially with larger hierarchies. In any situation where this is happening you can use the @AvroSortPriority
annotation to explicitly control what order the types appear in. @AvroSortPriority
takes a single float argument, which is the priority this field should be treated with, higher priority means closer to the beginning of the union. For example:
sealed trait Animal
@AvroSortPriority(1)
case class Dog(howFriendly: Float) extends Animal
@AvroSortPriority(2)
case class Fish(remembersYou: Boolean) extends Animal
Would output the types in the union as Fish,Dog
.
Recursive Schemas
Avro4s supports recursive schemas. Customizing them requires some thought, so if you can stick with the out-of-the-box provided schemas and customization via annotations.
Customizing Recursive Schemas
The simplest way to customize schemas for recursive types is to provide custom SchemaFor
instances for all types that
form the recursion. Given for example the following recursive Tree
type,
sealed trait Tree[+T]
case class Branch[+T](left: Tree[T], right: Tree[T]) extends Tree[T]
case class Leaf[+T](value: T) extends Tree[T]
it is easy to customize recursive schemas by providing a SchemaFor
for both Tree
and Branch
:
import scala.collection.JavaConverters._
val leafSchema = AvroSchema[Leaf[Int]]
val branchSchema = Schema.createRecord("CustomBranch", "custom schema", "custom", false)
val treeSchema = Schema.createUnion(leafSchema, branchSchema)
branchSchema.setFields(Seq(new Schema.Field("left", treeSchema), new Schema.Field("right", treeSchema)).asJava)
val treeSchemaFor: SchemaFor[Tree[Int]] = SchemaFor(treeSchema)
val branchSchemaFor: SchemaFor[Branch[Int]] = SchemaFor(branchSchema)
If you want to customize the schema for one type that is part of a type recursion (e.g., Branch[Int]
) while using
generated schemas, this can be done as follows (sticking with the above example):
// 1. Use implicit def here so that this SchemaFor gets summoned for Branch[Int] in steps 6. and 10. below
// 2. Implement a ResolvableSchemaFor instead of SchemaFor directly so that SchemaFor creation can be deferred
implicit def branchSchemaFor: SchemaFor[Branch[Int]] = new ResolvableSchemaFor[Branch[Int]] {
def schemaFor(env: DefinitionEnvironment[SchemaFor], update: SchemaUpdate): SchemaFor[Branch[Int]] =
// 3. first, check whether SchemaFor[Branch[Int]] is already defined and return that if it is
env.get[Branch[Int]].getOrElse {
// 4. otherwise, create an incomplete SchemaFor (it initially lacks fields)
val record: SchemaFor[Branch[Int]] = SchemaFor(Schema.createRecord("CustomBranch", "custom schema", "custom", false))
// 5. extend the definition environment with the created SchemaFor[Branch[Int]]
val nextEnv = env.updated(record)
// 6. summon a schema for Tree[Int] (using the Branch[Int] from step 1. through implicits)
// 7. resolve the schema to get a finalized schema for Tree[Int]
val treeSchema = SchemaFor[Tree[Int]].resolveSchemaFor(nextEnv, NoUpdate).schema
// 8. close the reference cycle between Branch[Int] and Tree[Int]
val fields = Seq(new Schema.Field("left", treeSchema), new Schema.Field("right", treeSchema))
record.schema.setFields(fields.asJava)
// 9. return the final SchemaFor[Branch[Int]]
record
}
}
// 10. summon Schema for tree and kick off encoder resolution.
val treeSchema = AvroSchema[Tree[Int]]
Input / Output
Serializing
Avro4s allows us to easily serialize case classes using an instance of AvroOutputStream
which we write to, and close, just like you would any regular output stream.
An AvroOutputStream
can be created from a File
, Path
, or by wrapping another OutputStream
.
When we create one, we specify the type of objects that we will be serializing and provide a writer schema.
For example, to serialize instances of our Pizza class:
import java.io.File
import com.sksamuel.avro4s.AvroOutputStream
val pepperoni = Pizza("pepperoni", Seq(Ingredient("pepperoni", 12, 4.4), Ingredient("onions", 1, 0.4)), false, false, 598)
val hawaiian = Pizza("hawaiian", Seq(Ingredient("ham", 1.5, 5.6), Ingredient("pineapple", 5.2, 0.2)), false, false, 391)
val schema = AvroSchema[Pizza]
val os = AvroOutputStream.data[Pizza].to(new File("pizzas.avro")).build()
os.write(Seq(pepperoni, hawaiian))
os.flush()
os.close()
Deserializing
We can easily deserialize a file back into case classes.
Given the pizzas.avro
file we generated in the previous section on serialization, we will read this back in using the AvroInputStream
class.
We first create an instance of the input stream specifying the types we will read back, the source file, and then build it using a reader schema.
Once the input stream is created, we can invoke iterator
which will return a lazy iterator that reads on demand the data in the file.
In this example, we'll load all data at once from the iterator via toSet
.
import com.sksamuel.avro4s.AvroInputStream
val schema = AvroSchema[Pizza]
val is = AvroInputStream.data[Pizza].from(new File("pizzas.avro")).build(schema)
val pizzas = is.iterator.toSet
is.close()
println(pizzas.mkString("\n"))
Will print out:
Pizza(pepperoni,List(Ingredient(pepperoni,12.2,4.4), Ingredient(onions,1.2,0.4)),false,false,500)
Pizza(hawaiian,List(Ingredient(ham,1.5,5.6), Ingredient(pineapple,5.2,0.2)),false,false,500)
Binary and JSON Formats
You can serialize as binary or json
by specifying the format when creating the input or output stream. In the earlier example we use data
which is considered the "default" for Avro.
To use json or binary, you can do the following:
AvroOutputStream.binary.to(...).build(...)
AvroOutputStream.json.to(...).build(...)
AvroInputStream.binary.from(...).build(...)
AvroInputStream.json.from(...).build(...)
Note: Binary serialization does not include the schema in the output.
Avro Records
In Avro there are two container interfaces designed for complex types - GenericRecord
, which is the most commonly used, along with the lesser used SpecificRecord
.
These record types are used with a schema of type Schema.Type.RECORD
.
To interface with the Avro Java API or with third party frameworks like Kafka it is sometimes desirable to convert between your case classes and these records, rather than using the input/output streams that avro4s provides.
To perform conversions, use the RecordFormat
typeclass which converts to/from case classes and Avro records.
Note: In Avro, GenericRecord
and SpecificRecord
don't have a common Record interface (just a Container
interface which simply provides for a schema without any methods for accessing values), so
avro4s has defined a Record
trait, which is the union of the GenericRecord
and SpecificRecord
interfaces. This allows avro4s to generate records which implement both interfaces at the same time.
To convert from a class into a record:
case class Composer(name: String, birthplace: String, compositions: Seq[String])
val ennio = Composer("ennio morricone", "rome", Seq("legend of 1900", "ecstasy of gold"))
val schema: Schema = AvroSchema[Composer]
implicit val toRecord: ToRecord[Composer] = ToRecord.apply[Composer](schema)
implicit val fromRecord: FromRecord[Composer] = FromRecord.apply[Composer](schema)
val format: RecordFormat[Composer] = RecordFormat.apply[Composer](schema)
// record is a type that implements both GenericRecord and Specific Record
val record = format.to(ennio)
And to go from a record back into a type:
// given some record from earlier
val record = ...
val format = RecordFormat[Composer]
val ennio = format.from(record)
Usage as a Kafka Serde
The com.sksamuel.avro4s.kafka.GenericSerde class can be used as a Kafka Serdes to serialize/deserialize case classes into Avro records with Avro4s. Note that this class is not integrated with the schema registry.
import java.util.Properties
import org.apache.kafka.clients.CommonClientConfigs
import org.apache.kafka.clients.producer.ProducerConfig
import com.sksamuel.avro4s.BinaryFormat
case class TheKafkaKey(id: String)
case class TheKafkaValue(name: String, location: String)
val producerProps = new Properties();
producerProps.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, "...")
producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, new GenericSerde[TheKafkaKey](BinaryFormat))
producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, new GenericSerde[TheKafkaValue](BinaryFormat))
new ProducerConfig(producerProps)
Type Mappings
Avro4s defines two typeclasses, Encoder
and Decoder
which do the work
of mapping between scala values and Avro compatible values. Avro has no understanding of Scala types, or anything outside of it's built in set of supported types, so all values must be converted to something that is compatible with Avro. There are built in encoders and decoders for all the common JDK and Scala SDK types, including macro generated instances for case classes.
For example a java.sql.Timestamp
is usually encoded as a Long, and a java.util.UUID
is encoded as a String.
Decoders do the same work, but in reverse. They take an Avro value, such as null and return a scala value, such as Option
.
Some values can be mapped in multiple ways depending on how the schema was generated. For example a String, which is usually encoded as
org.apache.avro.util.Utf8
could also be encoded as an array of bytes if the generated schema for that field was Schema.Type.BYTES
. Therefore some encoders will take into account the schema passed to them when choosing the avro compatible type. In the schemas section you saw how you could influence which schema is generated for types.
Built in Type Mappings
import scala.collection.{Array, List, Seq, Iterable, Set, Map, Option, Either}
import shapeless.{:+:, CNil}
The following table shows how types used in your code will be mapped / encoded in the generated Avro schemas and files. If a type can be mapped in multiple ways, it is listed more than once.
Scala Type | Schema Type | Logical Type | Encoded Type |
---|---|---|---|
String | STRING | Utf8 | |
String | FIXED | GenericFixed | |
String | BYTES | ByteBuffer | |
Boolean | BOOLEAN | java.lang.Boolean | |
Long | LONG | java.lang.Long | |
Int | INT | java.lang.Integer | |
Short | INT | java.lang.Integer | |
Byte | INT | java.lang.Integer | |
Double | DOUBLE | java.lang.Double | |
Float | FLOAT | java.lang.Float | |
UUID | STRING | UUID | Utf8 |
LocalDate | INT | Date | java.lang.Int |
LocalTime | INT | time-millis | java.lang.Int |
LocalDateTime | LONG | timestamp-nanos | java.lang.Long |
java.sql.Date | INT | Date | java.lang.Int |
Instant | LONG | Timestamp-Millis | java.lang.Long |
Timestamp | LONG | Timestamp-Millis | java.lang.Long |
BigDecimal | BYTES | Decimal<8,2> | ByteBuffer |
BigDecimal | FIXED | Decimal<8,2> | GenericFixed |
BigDecimal | STRING | Decimal<8,2> | String |
Option[T] | UNION<null,T> | null, T | |
Array[Byte] | BYTES | ByteBuffer | |
Array[Byte] | FIXED | GenericFixed | |
ByteBuffer | BYTES | ByteBuffer | |
Seq[Byte] | BYTES | ByteBuffer | |
List[Byte] | BYTES | ByteBuffer | |
Vector[Byte] | BYTES | ByteBuffer | |
Array[T] | ARRAY | Array[T] | |
Vector[T] | ARRAY | Array[T] | |
Seq[T] | ARRAY | Array[T] | |
List[T] | ARRAY | Array[T] | |
Set[T] | ARRAY | Array[T] | |
sealed trait of case classes | UNION<A,B,..> | A, B, ... | |
sealed trait of case objects | ENUM<A,B,..> | GenericEnumSymbol | |
Map[String, V] | MAP | java.util.Map[String, V] | |
Either[A,B] | UNION<A,B> | A, B | |
A :+: B :+: C :+: CNil | UNION<A,B,C> | A, B, ... | |
case class T | RECORD | GenericRecord with SpecificRecord | |
Scala enumeration | ENUM | GenericEnumSymbol | |
Java enumeration | ENUM | GenericEnumSymbol | |
Scala tuples | RECORD | GenericRecord with SpecificRecord | |
Option[Either[A,B]] | UNION<null,A,B> | null, A, B | |
option of sealed trait of case classes | UNION<null,A,B,..> | null, A, B, ... | |
option of sealed trait of case objects | UNION<null,A,B,..> | null, GenericEnumSymbol |
To select the encoding in case multiple encoded types exist, create a new Encoder
with a corresponding SchemaFor
instance to the via withSchema
. For example, creating a string encoder that uses target type BYTES
works like this:
val stringSchemaFor = SchemaFor[String](Schema.create(Schema.Type.BYTES))
val stringEncoder = Encoder[String].withSchema(stringSchemaFor)
Custom Type Mappings
It is very easy to add custom type mappings. To do this, we bring into scope a custom implicit of Encoder[T]
and/or Decoder[T]
.
For example, to create a custom type mapping for a type Foo which writes out the contents in upper case, but always reads the contents in lower case, we can do the following:
case class Foo(a: String, b: String)
implicit object FooEncoder extends Encoder[Foo] {
override val schemaFor = SchemaFor[Foo]
override def encode(foo: Foo) = {
val record = new GenericData.Record(schema)
record.put("a", foo.a.toUpperCase)
record.put("b", foo.b.toUpperCase)
record
}
}
implicit object FooDecoder extends Decoder[Foo] {
override val schemaFor = SchemaFor[Foo]
override def decode(value: Any) = {
val record = value.asInstanceOf[GenericRecord]
Foo(record.get("a").toString.toLowerCase, record.get("b").toString.toLowerCase)
}
}
Another example is changing the way we serialize LocalDateTime
to store these dates as ISO strings. In this case, we are
writing out a String rather than the default Long so we must also change the schema type. Therefore, we must add an implicit SchemaFor
as well as the encoders
and decoders.
implicit val LocalDateTimeSchemaFor = SchemaFor[LocalDateTime](Schema.create(Schema.Type.STRING))
implicit object DateTimeEncoder extends Encoder[LocalDateTime] {
override val schemaFor = LocalDateTimeSchemaFor
override def encode(value: LocalDateTime) =
ISODateTimeFormat.dateTime().print(value)
}
implicit object DateTimeDecoder extends Decoder[LocalDateTime] {
override val schemaFor = LocalDateTimeSchemaFor
override def decode(value: Any) =
ISODateTimeFormat.dateTime().parseDateTime(value.toString)
}
These typeclasses must be implicit and in scope when you use AvroSchema
or RecordFormat
.
Coproducts
Avro supports generalised unions, eithers of more than two values.
To represent these in scala, we use shapeless.:+:
, such that A :+: B :+: C :+: CNil
represents cases where a type is A
OR B
OR C
.
See shapeless' documentation on coproducts for more on how to use coproducts.
Sealed hierarchies
Scala sealed traits/classes are supported both when it comes to schema generation and conversions to/from GenericRecord
.
Generally sealed hierarchies are encoded as unions - in the same way like Coproducts.
Under the hood, shapeless Generic
is used to derive Coproduct representation for sealed hierarchy.
When all descendants of sealed trait/class are singleton objects, optimized, enum-based encoding is used instead.
Decimal scale, precision and rounding mode
In order to customize the scale and precision used by BigDecimal
schema generators, bring an implicit ScalePrecision
instance into scope.before using AvroSchema
.
import com.sksamuel.avro4s.ScalePrecision
case class MyDecimal(d: BigDecimal)
implicit val sp = ScalePrecision(4, 20)
val schema = AvroSchema[MyDecimal]
{
"type":"record",
"name":"MyDecimal",
"namespace":"com.foo",
"fields":[{
"name":"d",
"type":{
"type":"bytes",
"logicalType":"decimal",
"scale":"4",
"precision":"20"
}
}]
}
When encoding values, it may be necessary to round values if they need to be converted to the scale used by the schema. By default this is RoundingMode.UNNECESSARY
which will throw an exception if rounding is required.
In order to change this, add an implicit RoundingMode
value before the Encoder
is generated.
case class MyDecimal(d: BigDecimal)
implicit val sp = ScalePrecision(4, 20)
val schema = AvroSchema[MyDecimal]
implicit val roundingMode = RoundingMode.HALF_UP
val encoder = Encoder[MyDecimal]
Type Parameters
When serializing a class with one or more type parameters, the avro name used in a schema is the name of the raw type, plus the actual type parameters. In other words, it would be of the form rawtype__typeparam1_typeparam2_..._typeparamN
. So for example, the schema for a type Event[Foo]
would have the avro name event__foo
.
You can disable this by annotating the class with @AvroErasedName
which uses the JVM erased name - in other words, it drops type parameter information. So the aforementioned Event[Foo]
would be simply event
.
Selective Customisation
You can selectively customise the way Avro4s generates certain parts of your hierarchy, thanks to implicit precedence. Suppose you have the following classes:
case class Product(name: String, price: Price, litres: BigDecimal)
case class Price(currency: String, amount: BigDecimal)
And you want to selectively use different scale/precision for the price
and litres
quantities. You can do this by forcing the implicits in the corresponding companion objects.
object Price {
implicit val sp = ScalePrecision(10, 2)
implicit val schema = SchemaFor[Price]
}
object Product {
implicit val sp = ScalePrecision(8, 4)
implicit val schema = SchemaFor[Product]
}
This will result in a schema where both BigDecimal
quantities have their own separate scale and precision.
Cats Support
If you use cats in your domain objects, then Avro4s provides a cats module with schemas, encoders and decoders for some cats types.
Just import import com.sksamuel.avro4s.cats._
before calling into the macros.
case class Foo(list: NonEmptyList[String], vector: NonEmptyVector[Boolean])
val schema = AvroSchema[Foo]
Refined Support
If you use refined in your domain objects, then Avro4s provides a refined module with schemas, encoders and decoders for refined types.
Just import import com.sksamuel.avro4s.refined._
before calling into the macros.
case class Foo(nonEmptyStr: String Refined NonEmpty)
val schema = AvroSchema[Foo]
Mapping Recursive Types
Avro4s supports encoders and decoders for recursive types. Customizing them is possible, but involved. As with customizing SchemaFor instances for recursive types, the simplest way to customize encoders and decoders is to provide a custom encoder and decoder for all types that form the recursion.
If that isn't possible, you can customize encoders / decoders for one single type and participate in creating a cyclic graph of encoders / decoders. To give an example, consider the following recursive type for trees.
sealed trait Tree[+T]
case class Branch[+T](left: Tree[T], right: Tree[T]) extends Tree[T]
case class Leaf[+T](value: T) extends Tree[T]
For this, a custom Branch[Int]
encoder can be defined as follows.
// 1. use implicit def so that Encoder.apply[Tree[Int]] in step 7. and 10. below picks this resolvable encoder for branches.
// 2. implement a ResolvableEncoder instead of Encoder directly so that encoder creation can be deferred
implicit def branchEncoder: Encoder[Branch[Int]] = new ResolvableEncoder[Branch[Int]] {
def encoder(env: DefinitionEnvironment[Encoder], update: SchemaUpdate): Encoder[Branch[Int]] =
// 3. lookup in the definition environment whether we already have created an encoder for branch.
env.get[Branch[Int]].getOrElse {
// 4. use var here to first create an acyclic graph and close it later.
var treeEncoder: Encoder[Tree[Int]] = null
// 5. create a partially initialized encoder for branches (it lacks a value for treeEncoder on creation).
val encoder = new Encoder[Branch[Int]] {
val schemaFor: SchemaFor[Branch[Int]] = SchemaFor[Branch[Int]]
def encode(value: Branch[Int]): AnyRef =
ImmutableRecord(schema, Seq(treeEncoder.encode(value.left), treeEncoder.encode(value.right)))
}
// 6. extend the definition environment with the newly created encoder so that subsequent lookups (step 3.) can return it
val nextEnv = env.updated(encoder)
// 7. resolve the tree encoder with the extended environment; the extended env will be passed back to the lookup
// performed in step 3. above.
// 9. complete the initialization by closing the reference cycle: the branch encoder and tree encoder now
// reference each other.
treeEncoder = Encoder.apply[Tree[Int]].resolveEncoder(nextEnv, NoUpdate)
encoder
}
}
// 10. summon encoder for tree and kick off encoder resolution.
val toRecord = ToRecord[Tree[Int]]
Why is this so complicated? Glad you asked! Turns out that caring for performance, providing customization via annotations, and using Magnolia for automatic typeclass derivation (which is great in itself) are three constraints that aren't easy to combine. This design is the best we came up with; if you have a better design for this, please contribute it!
Using avro4s in your project
Gradle
compile 'com.sksamuel.avro4s:avro4s-core_2.12:xxx'
SBT
libraryDependencies += "com.sksamuel.avro4s" %% "avro4s-core" % "xxx"
Maven
<dependency>
<groupId>com.sksamuel.avro4s</groupId>
<artifactId>avro4s-core_2.12</artifactId>
<version>xxx</version>
</dependency>
Check the latest released version on Maven Central
Contributions
Contributions to avro4s are always welcome. Good ways to contribute include:
- Raising bugs and feature requests
- Fixing bugs and enhancing the DSL
- Improving the performance of avro4s
- Adding to the documentation
More Resourcesto explore the angular.
mail [email protected] to add your project or resources here 🔥.
- 1A toolkit for servicing HTTP requests in Scala
https://github.com/unfiltered/unfiltered
A toolkit for servicing HTTP requests in Scala. Contribute to unfiltered/unfiltered development by creating an account on GitHub.
- 2A Scala DSL for talking with databases with minimum verbosity and maximum type safety
https://github.com/squeryl/squeryl
A Scala DSL for talking with databases with minimum verbosity and maximum type safety - squeryl/squeryl
- 3Apache Flink
https://github.com/apache/flink
Apache Flink. Contribute to apache/flink development by creating an account on GitHub.
- 4Vert.x for Scala
https://github.com/vert-x3/vertx-lang-scala
Vert.x for Scala. Contribute to vert-x3/vertx-lang-scala development by creating an account on GitHub.
- 5Chromaprint/AcoustID audio fingerprinting for the JVM
https://github.com/mgdigital/Chromaprint.scala
Chromaprint/AcoustID audio fingerprinting for the JVM - mgdigital/Chromaprint.scala
- 6A macro library that converts native imperative syntax to scalaz's monadic expressions
https://github.com/ThoughtWorksInc/each
A macro library that converts native imperative syntax to scalaz's monadic expressions - ThoughtWorksInc/each
- 7Incredibly simple DI Scala library.
https://github.com/yakivy/jam
Incredibly simple DI Scala library. Contribute to yakivy/jam development by creating an account on GitHub.
- 8Security library for Play framework 2 in Java and Scala: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
https://github.com/pac4j/play-pac4j
Security library for Play framework 2 in Java and Scala: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT... - pac4j/play-pac4j
- 9laserdisc-io/mysql-binlog-stream
https://github.com/laserdisc-io/mysql-binlog-stream
Contribute to laserdisc-io/mysql-binlog-stream development by creating an account on GitHub.
- 10GNU Gettext .po file loader for Scala
https://github.com/xitrum-framework/scaposer
GNU Gettext .po file loader for Scala. Contribute to xitrum-framework/scaposer development by creating an account on GitHub.
- 11Light-weight convenience wrapper around Lucene to simplify complex tasks and add Scala sugar.
https://github.com/outr/lucene4s
Light-weight convenience wrapper around Lucene to simplify complex tasks and add Scala sugar. - outr/lucene4s
- 12Workflow engine for exploration of simulation models using high throughput computing
https://github.com/openmole/openmole
Workflow engine for exploration of simulation models using high throughput computing - openmole/openmole
- 13PostgreSQL protocol support for Finagle
https://github.com/finagle/finagle-postgres
PostgreSQL protocol support for Finagle. Contribute to finagle/finagle-postgres development by creating an account on GitHub.
- 14Simple play module for authenticating against Google
https://github.com/guardian/play-googleauth
Simple play module for authenticating against Google - guardian/play-googleauth
- 15Extensible JOSE library for Scala
https://github.com/blackdoor/jose
Extensible JOSE library for Scala. Contribute to blackdoor/jose development by creating an account on GitHub.
- 16Large off-heap arrays and mmap files for Scala and Java
https://github.com/xerial/larray
Large off-heap arrays and mmap files for Scala and Java - xerial/larray
- 17A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side.
https://github.com/debasishg/scala-redis
A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side. - debasishg/scala-redis
- 18Idiomatic, typesafe, and reactive Scala client for Apache Pulsar
https://github.com/CleverCloud/pulsar4s
Idiomatic, typesafe, and reactive Scala client for Apache Pulsar - CleverCloud/pulsar4s
- 19Purely functional JSON parser and library in scala.
https://github.com/argonaut-io/argonaut
Purely functional JSON parser and library in scala. - argonaut-io/argonaut
- 20Modern Load Testing as Code
https://github.com/gatling/gatling
Modern Load Testing as Code. Contribute to gatling/gatling development by creating an account on GitHub.
- 21A Scala ORM library
https://github.com/kostaskougios/mapperdao
A Scala ORM library. Contribute to kostaskougios/mapperdao development by creating an account on GitHub.
- 22Docker containers for testing in scala
https://github.com/testcontainers/testcontainers-scala
Docker containers for testing in scala. Contribute to testcontainers/testcontainers-scala development by creating an account on GitHub.
- 23A scala diff/patch library for Json
https://github.com/gnieh/diffson
A scala diff/patch library for Json. Contribute to gnieh/diffson development by creating an account on GitHub.
- 24Testing tool in Scala for HTTP JSON API
https://github.com/agourlay/cornichon
Testing tool in Scala for HTTP JSON API. Contribute to agourlay/cornichon development by creating an account on GitHub.
- 25If you don't agree with the data
https://github.com/splink/veto
If you don't agree with the data. Contribute to splink/veto development by creating an account on GitHub.
- 26Software Specifications for Scala
https://github.com/etorreborre/specs2
Software Specifications for Scala. Contribute to etorreborre/specs2 development by creating an account on GitHub.
- 27The Couchbase Monorepo for JVM Clients: Java, Scala, io-core…
https://github.com/couchbase/couchbase-jvm-clients
The Couchbase Monorepo for JVM Clients: Java, Scala, io-core… - couchbase/couchbase-jvm-clients
- 28Salat is a simple serialization library for case classes.
https://github.com/salat/salat
Salat is a simple serialization library for case classes. - salat/salat
- 29Practical effect composition library based on abstract wrapping type and the free monad
https://github.com/ISCPIF/freedsl
Practical effect composition library based on abstract wrapping type and the free monad - ISCPIF/freedsl
- 30SevenZip library for Scala, easy to use.
https://github.com/gonearewe/SevenZ4S
SevenZip library for Scala, easy to use. . Contribute to gonearewe/SevenZ4S development by creating an account on GitHub.
- 31The super light testing library for Scala and Scala.js
https://github.com/monix/minitest
The super light testing library for Scala and Scala.js - monix/minitest
- 32A module that provides OAuth, OAuth2 and OpenID authentication for Play Framework applications
https://github.com/jaliss/securesocial
A module that provides OAuth, OAuth2 and OpenID authentication for Play Framework applications - jaliss/securesocial
- 33Compile-time Language Integrated Queries for Scala
https://github.com/zio/zio-quill
Compile-time Language Integrated Queries for Scala - zio/zio-quill
- 34Scala Scripting
https://github.com/com-lihaoyi/Ammonite
Scala Scripting. Contribute to com-lihaoyi/Ammonite development by creating an account on GitHub.
- 35Slick (Scala Language Integrated Connection Kit) is a modern database query and access library for Scala
https://github.com/slick/slick
Slick (Scala Language Integrated Connection Kit) is a modern database query and access library for Scala - slick/slick
- 36Property-based testing for Scala
https://github.com/typelevel/scalacheck
Property-based testing for Scala. Contribute to typelevel/scalacheck development by creating an account on GitHub.
- 37Simpler DynamoDB access for Scala
https://github.com/scanamo/scanamo
Simpler DynamoDB access for Scala. Contribute to scanamo/scanamo development by creating an account on GitHub.
- 38Type-Safe framework for defining, modifying, and querying SQL databases
https://github.com/outr/scalarelational
Type-Safe framework for defining, modifying, and querying SQL databases - outr/scalarelational
- 39ScalaFX simplifies creation of JavaFX-based user interfaces in Scala
https://github.com/scalafx/scalafx
ScalaFX simplifies creation of JavaFX-based user interfaces in Scala - scalafx/scalafx
- 40Performant database access in Scala
https://github.com/lucidsoftware/relate
Performant database access in Scala. Contribute to lucidsoftware/relate development by creating an account on GitHub.
- 41Scala library for boilerplate-free validation
https://github.com/krzemin/octopus
Scala library for boilerplate-free validation. Contribute to krzemin/octopus development by creating an account on GitHub.
- 42Connect a Scala REPL to running JVM processes without any prior setup
https://github.com/xitrum-framework/scalive
Connect a Scala REPL to running JVM processes without any prior setup - xitrum-framework/scalive
- 43A ZIO-based redis client
https://github.com/zio/zio-redis
A ZIO-based redis client. Contribute to zio/zio-redis development by creating an account on GitHub.
- 44Tiny Scala high-performance, async web framework, inspired by Sinatra
https://github.com/scalatra/scalatra
Tiny Scala high-performance, async web framework, inspired by Sinatra - scalatra/scalatra
- 45Reactive data-binding for Scala
https://github.com/ThoughtWorksInc/Binding.scala
Reactive data-binding for Scala. Contribute to ThoughtWorksInc/Binding.scala development by creating an account on GitHub.
- 46The Anorm database library
https://github.com/playframework/anorm
The Anorm database library. Contribute to playframework/anorm development by creating an account on GitHub.
- 47A module for the Play Framework to build highly modular applications
https://github.com/splink/pagelets
A module for the Play Framework to build highly modular applications - splink/pagelets
- 48I/O and Microservice library for Scala
https://github.com/tumblr/colossus
I/O and Microservice library for Scala. Contribute to tumblr/colossus development by creating an account on GitHub.
- 49Scala library to sign HTTP requests to AWS services.
https://github.com/ticofab/aws-request-signer
Scala library to sign HTTP requests to AWS services. - ticofab/aws-request-signer
- 50Next generation user interface and application development in Scala and Scala.js for web, mobile, and desktop.
https://github.com/outr/youi
Next generation user interface and application development in Scala and Scala.js for web, mobile, and desktop. - outr/youi
- 51Statistical Machine Intelligence & Learning Engine
https://github.com/haifengl/smile
Statistical Machine Intelligence & Learning Engine - haifengl/smile
- 52Microbenchmarking and performance regression testing framework for the JVM platform.
https://github.com/scalameter/scalameter
Microbenchmarking and performance regression testing framework for the JVM platform. - scalameter/scalameter
- 53A testing tool for Scala and Java developers
https://github.com/scalatest/scalatest
A testing tool for Scala and Java developers. Contribute to scalatest/scalatest development by creating an account on GitHub.
- 54:monorail: "Scala on Rails" - A full-stack web app framework for rapid development in Scala
https://github.com/skinny-framework/skinny-framework
:monorail: "Scala on Rails" - A full-stack web app framework for rapid development in Scala - skinny-framework/skinny-framework
- 55Molecule translates custom Scala code to database queries for multiple databases.
https://github.com/scalamolecule/molecule
Molecule translates custom Scala code to database queries for multiple databases. - scalamolecule/molecule
- 56Cryptographic primitives for Scala
https://github.com/input-output-hk/scrypto
Cryptographic primitives for Scala. Contribute to input-output-hk/scrypto development by creating an account on GitHub.
- 57A lightweight framework for writing REST services in Scala.
https://github.com/mesosphere/chaos
A lightweight framework for writing REST services in Scala. - mesosphere/chaos
- 58Async and clustered Scala web framework and HTTP(S) server
https://github.com/xitrum-framework/xitrum
Async and clustered Scala web framework and HTTP(S) server - xitrum-framework/xitrum
- 59A distributed tracing extension for Akka. Provides integration with Play framework, Spray and Akka HTTP.
https://github.com/levkhomich/akka-tracing
A distributed tracing extension for Akka. Provides integration with Play framework, Spray and Akka HTTP. - levkhomich/akka-tracing
- 60A simple FRP library and a web UI framework built on it
https://github.com/nafg/reactive
A simple FRP library and a web UI framework built on it - nafg/reactive
- 61Facebook's React on Scala.JS
https://github.com/japgolly/scalajs-react
Facebook's React on Scala.JS. Contribute to japgolly/scalajs-react development by creating an account on GitHub.
- 62Figaro Programming Language and Core Libraries
https://github.com/charles-river-analytics/figaro
Figaro Programming Language and Core Libraries. Contribute to charles-river-analytics/figaro development by creating an account on GitHub.
- 63Optimus is a mathematical programming library for Scala.
https://github.com/vagmcs/Optimus
Optimus is a mathematical programming library for Scala. - vagmcs/Optimus
- 64Fast JSON parser/generator for Scala
https://github.com/gzoller/ScalaJack
Fast JSON parser/generator for Scala. Contribute to gzoller/ScalaJack development by creating an account on GitHub.
- 65Apache Spark - A unified analytics engine for large-scale data processing
https://github.com/apache/spark
Apache Spark - A unified analytics engine for large-scale data processing - apache/spark
- 66scala SQL api
https://github.com/wangzaixiang/scala-sql
scala SQL api. Contribute to wangzaixiang/scala-sql development by creating an account on GitHub.
- 67Scala support library for integrating the JSON API spec with Spray, Play! or Circe
https://github.com/scala-jsonapi/scala-jsonapi
Scala support library for integrating the JSON API spec with Spray, Play! or Circe - scala-jsonapi/scala-jsonapi
- 68Scala code generator for Avro schemas.
https://github.com/malcolmgreaves/avro-codegen
Scala code generator for Avro schemas. Contribute to malcolmgreaves/avro-codegen development by creating an account on GitHub.
- 69Protocol buffer compiler for Scala.
https://github.com/scalapb/ScalaPB
Protocol buffer compiler for Scala. Contribute to scalapb/ScalaPB development by creating an account on GitHub.
- 70Functional JDBC layer for Scala.
https://github.com/tpolecat/doobie
Functional JDBC layer for Scala. Contribute to tpolecat/doobie development by creating an account on GitHub.
- 71CPU and GPU-accelerated Machine Learning Library
https://github.com/BIDData/BIDMach
CPU and GPU-accelerated Machine Learning Library. Contribute to BIDData/BIDMach development by creating an account on GitHub.
- 72Graph for Scala is intended to provide basic graph functionality seamlessly fitting into the Scala Collection Library. Like the well known members of scala.collection, Graph for Scala is an in-memory graph library aiming at editing and traversing graphs, finding cycles etc. in a user-friendly way.
https://github.com/scala-graph/scala-graph
Graph for Scala is intended to provide basic graph functionality seamlessly fitting into the Scala Collection Library. Like the well known members of scala.collection, Graph for Scala is an in-memo...
- 73Axle Domain Specific Language for Scientific Cloud Computing and Visualization
https://github.com/axlelang/axle
Axle Domain Specific Language for Scientific Cloud Computing and Visualization - axlelang/axle
- 74Lightweight and fast serialization library for Scala 2/3 based on Protocol Buffers with macros
https://github.com/zero-deps/proto
Lightweight and fast serialization library for Scala 2/3 based on Protocol Buffers with macros - zero-deps/proto
- 75Scala Uniquely Bound Classes Under Traits
https://github.com/dickwall/subcut
Scala Uniquely Bound Classes Under Traits. Contribute to dickwall/subcut development by creating an account on GitHub.
- 76Highly available distributed strong eventual consistent and sequentially consistent storage with feeds, sorting and search
https://github.com/zero-deps/kvs
Highly available distributed strong eventual consistent and sequentially consistent storage with feeds, sorting and search - zero-deps/kvs
- 77Single Page Applications running on the server side.
https://github.com/fomkin/korolev
Single Page Applications running on the server side. - fomkin/korolev
- 78A foundational framework for distributed programming.
https://github.com/reactors-io/reactors
A foundational framework for distributed programming. - reactors-io/reactors
- 79A dimensional analysis library based on dependent types
https://github.com/to-ithaca/libra
A dimensional analysis library based on dependent types - to-ithaca/libra
- 80CSV handling library for Scala
https://github.com/nrinaudo/kantan.csv
CSV handling library for Scala. Contribute to nrinaudo/kantan.csv development by creating an account on GitHub.
- 81MessagePack serializer implementation for Scala / msgpack.org[Scala]
https://github.com/msgpack/msgpack-scala
MessagePack serializer implementation for Scala / msgpack.org[Scala] - msgpack/msgpack-scala
- 82uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala
https://github.com/com-lihaoyi/upickle
uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala - com-lihaoyi/upickle
- 83a simple Scala CLI parsing library
https://github.com/scallop/scallop
a simple Scala CLI parsing library. Contribute to scallop/scallop development by creating an account on GitHub.
- 84Add-on module for Jackson (https://github.com/FasterXML/jackson) to support Scala-specific datatypes
https://github.com/FasterXML/jackson-module-scala
Add-on module for Jackson (https://github.com/FasterXML/jackson) to support Scala-specific datatypes - FasterXML/jackson-module-scala
- 85Type-safe data migration tool for Slick, Git and beyond.
https://github.com/lastland/scala-forklift
Type-safe data migration tool for Slick, Git and beyond. - lastland/scala-forklift
- 86A tidy SQL-based DB access library for Scala developers. This library naturally wraps JDBC APIs and provides you easy-to-use APIs.
https://github.com/scalikejdbc/scalikejdbc
A tidy SQL-based DB access library for Scala developers. This library naturally wraps JDBC APIs and provides you easy-to-use APIs. - scalikejdbc/scalikejdbc
- 87Scala compiler plugin that acts like GNU xgettext command to extract i18n strings in Scala source code files to Gettext .po file
https://github.com/xitrum-framework/scala-xgettext
Scala compiler plugin that acts like GNU xgettext command to extract i18n strings in Scala source code files to Gettext .po file - xitrum-framework/scala-xgettext
- 88REScala - distributed and reactive programming embedded in OO and FP programs.
https://github.com/rescala-lang/REScala
REScala - distributed and reactive programming embedded in OO and FP programs. - rescala-lang/REScala
- 89Scala classpath scanner
https://github.com/xitrum-framework/sclasner
Scala classpath scanner. Contribute to xitrum-framework/sclasner development by creating an account on GitHub.
- 90Iteratees for Cats
https://github.com/travisbrown/iteratee
Iteratees for Cats. Contribute to travisbrown/iteratee development by creating an account on GitHub.
- 91Fast, secure JSON library with tight ZIO integration.
https://github.com/zio/zio-json
Fast, secure JSON library with tight ZIO integration. - zio/zio-json
- 92Schema registry for CSV, TSV, JSON, AVRO and Parquet schema. Supports schema inference and GraphQL API.
https://github.com/indix/schemer
Schema registry for CSV, TSV, JSON, AVRO and Parquet schema. Supports schema inference and GraphQL API. - indix/schemer
- 93Play2.x Authentication and Authorization module
https://github.com/t2v/play2-auth
Play2.x Authentication and Authorization module. Contribute to t2v/play2-auth development by creating an account on GitHub.
- 94Jawn is for parsing jay-sawn (JSON)
https://github.com/typelevel/jawn
Jawn is for parsing jay-sawn (JSON). Contribute to typelevel/jawn development by creating an account on GitHub.
- 95An ONNX (Open Neural Network eXchange) API and backend for typeful, functional deep learning and classical machine learning in Scala 3
https://github.com/EmergentOrder/onnx-scala
An ONNX (Open Neural Network eXchange) API and backend for typeful, functional deep learning and classical machine learning in Scala 3 - EmergentOrder/onnx-scala
- 96Labeled records for Scala based on structural refinement types and macros.
https://github.com/scala-records/scala-records
Labeled records for Scala based on structural refinement types and macros. - scala-records/scala-records
- 97Breeze is a numerical processing library for Scala.
https://github.com/scalanlp/breeze
Breeze is a numerical processing library for Scala. - scalanlp/breeze
- 98Scala Library for Reading Flat File Data (CSV/TSV/XLS/XLSX)
https://github.com/frugalmechanic/fm-flatfile
Scala Library for Reading Flat File Data (CSV/TSV/XLS/XLSX) - frugalmechanic/fm-flatfile
- 99Platform to build distributed, scalable, enterprise-wide business applications
https://github.com/annetteplatform/annette
Platform to build distributed, scalable, enterprise-wide business applications - annetteplatform/annette
- 100Cassovary is a simple big graph processing library for the JVM
https://github.com/twitter/cassovary
Cassovary is a simple big graph processing library for the JVM - twitter/cassovary
- 101A concurrent reactive programming framework.
https://github.com/storm-enroute/reactors
A concurrent reactive programming framework. Contribute to storm-enroute/reactors development by creating an account on GitHub.
- 102Library to register and lookup actors by names in an Akka cluster
https://github.com/xitrum-framework/glokka
Library to register and lookup actors by names in an Akka cluster - xitrum-framework/glokka
- 103:cake: doddle-model: machine learning in Scala.
https://github.com/picnicml/doddle-model
:cake: doddle-model: machine learning in Scala. Contribute to picnicml/doddle-model development by creating an account on GitHub.
- 104A Scala API for Apache Beam and Google Cloud Dataflow.
https://github.com/spotify/scio
A Scala API for Apache Beam and Google Cloud Dataflow. - spotify/scio
- 105A mini Scala utility library
https://github.com/scala-hamsters/hamsters
A mini Scala utility library. Contribute to scala-hamsters/hamsters development by creating an account on GitHub.
- 106Powerful new number types and numeric abstractions for Scala.
https://github.com/typelevel/spire
Powerful new number types and numeric abstractions for Scala. - typelevel/spire
- 107A Persistence Framework for Scala and NoSQL
https://github.com/longevityframework/longevity
A Persistence Framework for Scala and NoSQL. Contribute to longevityframework/longevity development by creating an account on GitHub.
- 108Async lightweight Scala web framework
https://github.com/dvarelap/peregrine
Async lightweight Scala web framework. Contribute to dvarelap/peregrine development by creating an account on GitHub.
- 109CSV Reader/Writer for Scala
https://github.com/tototoshi/scala-csv
CSV Reader/Writer for Scala. Contribute to tototoshi/scala-csv development by creating an account on GitHub.
- 110A Thrift parser/generator
https://github.com/twitter/scrooge
A Thrift parser/generator. Contribute to twitter/scrooge development by creating an account on GitHub.
- 111N-dimensional / multi-dimensional arrays (tensors) in Scala 3. Think NumPy ndarray / PyTorch Tensor but type-safe over shapes, array/axis labels & numeric data types
https://github.com/SciScala/NDScala
N-dimensional / multi-dimensional arrays (tensors) in Scala 3. Think NumPy ndarray / PyTorch Tensor but type-safe over shapes, array/axis labels & numeric data types - SciScala/NDScala
- 112A JSR-310 port of nscala_time
https://github.com/chronoscala/chronoscala
A JSR-310 port of nscala_time. Contribute to chronoscala/chronoscala development by creating an account on GitHub.
- 113Lightweight Scala Dependency Injection Library
https://github.com/scaldi/scaldi
Lightweight Scala Dependency Injection Library. Contribute to scaldi/scaldi development by creating an account on GitHub.
- 114A fault tolerant, protocol-agnostic RPC system
https://github.com/twitter/finagle
A fault tolerant, protocol-agnostic RPC system. Contribute to twitter/finagle development by creating an account on GitHub.
- 115Scala library for accessing various file, batch systems, job schedulers and grid middlewares.
https://github.com/openmole/gridscale
Scala library for accessing various file, batch systems, job schedulers and grid middlewares. - openmole/gridscale
- 116JVM - Java, Kotlin, Scala image processing library
https://github.com/sksamuel/scrimage
JVM - Java, Kotlin, Scala image processing library - sksamuel/scrimage
- 117A group of neural-network libraries for functional and mainstream languages
https://github.com/mrdimosthenis/Synapses
A group of neural-network libraries for functional and mainstream languages - mrdimosthenis/Synapses
- 118Alpakka Kafka connector - Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
https://github.com/akka/alpakka-kafka
Alpakka Kafka connector - Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka. - akka/alpakka-kafka
- 119Productivity-oriented collection of lightweight fancy stuff for Scala toolchain
https://github.com/7mind/izumi
Productivity-oriented collection of lightweight fancy stuff for Scala toolchain - 7mind/izumi
- 120Real Time Analytics and Data Pipelines based on Spark Streaming
https://github.com/Stratio/sparta
Real Time Analytics and Data Pipelines based on Spark Streaming - Stratio/sparta
- 121C4E, a JVM friendly library written in Scala for both local and distributed (Spark) Clustering.
https://github.com/Clustering4Ever/Clustering4Ever
C4E, a JVM friendly library written in Scala for both local and distributed (Spark) Clustering. - Clustering4Ever/Clustering4Ever
- 122Scala extensions for Google Guice
https://github.com/codingwell/scala-guice
Scala extensions for Google Guice. Contribute to codingwell/scala-guice development by creating an account on GitHub.
- 123Purely functional genetic algorithms for multi-objective optimisation
https://github.com/openmole/mgo
Purely functional genetic algorithms for multi-objective optimisation - openmole/mgo
- 124A composable command-line parser for Scala.
https://github.com/bkirwi/decline
A composable command-line parser for Scala. Contribute to bkirwi/decline development by creating an account on GitHub.
- 125ABANDONED Pure Scala serialization library with annotations
https://github.com/fomkin/pushka
ABANDONED Pure Scala serialization library with annotations - fomkin/pushka
- 126Modify deeply nested case class fields
https://github.com/softwaremill/quicklens
Modify deeply nested case class fields. Contribute to softwaremill/quicklens development by creating an account on GitHub.
- 127Non-blocking, ultra-fast Scala Redis client built on top of Akka IO, used in production at Livestream
https://github.com/Livestream/scredis
Non-blocking, ultra-fast Scala Redis client built on top of Akka IO, used in production at Livestream - Livestream/scredis
- 128RxScala – Reactive Extensions for Scala – a library for composing asynchronous and event-based programs using observable sequences
https://github.com/ReactiveX/RxScala
RxScala – Reactive Extensions for Scala – a library for composing asynchronous and event-based programs using observable sequences - ReactiveX/RxScala
- 129Asynchronous, Reactive Programming for Scala and Scala.js.
https://github.com/monix/monix
Asynchronous, Reactive Programming for Scala and Scala.js. - monix/monix
- 130Easy way to create Free Monad using Scala macros with first-class Intellij support.
https://github.com/Thangiee/Freasy-Monad
Easy way to create Free Monad using Scala macros with first-class Intellij support. - Thangiee/Freasy-Monad
- 131Eff monad for cats - https://atnos-org.github.io/eff
https://github.com/atnos-org/eff
Eff monad for cats - https://atnos-org.github.io/eff - atnos-org/eff
- 132The missing MatPlotLib for Scala + Spark
https://github.com/vegas-viz/Vegas
The missing MatPlotLib for Scala + Spark. Contribute to vegas-viz/Vegas development by creating an account on GitHub.
- 133Scala extensions for the Kryo serialization library
https://github.com/twitter/chill
Scala extensions for the Kryo serialization library - twitter/chill
- 134Minimal, type-safe RPC Scala library.
https://github.com/yakivy/poppet
Minimal, type-safe RPC Scala library. Contribute to yakivy/poppet development by creating an account on GitHub.
- 135Reactive Microservices for the JVM
https://github.com/lagom/lagom
Reactive Microservices for the JVM. Contribute to lagom/lagom development by creating an account on GitHub.
- 136A scala extension for Project Reactor's Flux and Mono
https://github.com/spring-attic/reactor-scala-extensions
A scala extension for Project Reactor's Flux and Mono - spring-attic/reactor-scala-extensions
- 137Scala testing library with actionable errors and extensible APIs
https://github.com/scalameta/munit
Scala testing library with actionable errors and extensible APIs - scalameta/munit
- 138Scala wrapper for SnakeYAML
https://github.com/jcazevedo/moultingyaml
Scala wrapper for SnakeYAML. Contribute to jcazevedo/moultingyaml development by creating an account on GitHub.
- 139SynapseGrid is a framework for constructing dynamic low latency data flow systems.
https://github.com/Primetalk/SynapseGrid
SynapseGrid is a framework for constructing dynamic low latency data flow systems. - Primetalk/SynapseGrid
- 140Distributed NoSQL Database
https://github.com/stephenmcd/curiodb
Distributed NoSQL Database. Contribute to stephenmcd/curiodb development by creating an account on GitHub.
- 141Abstract Algebra for Scala
https://github.com/twitter/algebird
Abstract Algebra for Scala. Contribute to twitter/algebird development by creating an account on GitHub.
- 142Spark package to "plug" holes in data using SQL based rules ⚡️ 🔌
https://github.com/indix/sparkplug
Spark package to "plug" holes in data using SQL based rules ⚡️ 🔌 - GitHub - indix/sparkplug: Spark package to "plug" holes in data using SQL based rules ⚡️ 🔌
- 143A simple testing framework for Scala
https://github.com/com-lihaoyi/utest
A simple testing framework for Scala. Contribute to com-lihaoyi/utest development by creating an account on GitHub.
- 144Scalable Image Analysis and Shape Modelling
https://github.com/unibas-gravis/scalismo
Scalable Image Analysis and Shape Modelling. Contribute to unibas-gravis/scalismo development by creating an account on GitHub.
- 145Web-based notebook that enables data-driven, interactive data analytics and collaborative documents with SQL, Scala and more.
https://github.com/apache/zeppelin
Web-based notebook that enables data-driven, interactive data analytics and collaborative documents with SQL, Scala and more. - apache/zeppelin
- 146Mutation testing for Scala
https://github.com/stryker-mutator/stryker4s
Mutation testing for Scala. Contribute to stryker-mutator/stryker4s development by creating an account on GitHub.
- 147Streaming MapReduce with Scalding and Storm
https://github.com/twitter/summingbird
Streaming MapReduce with Scalding and Storm. Contribute to twitter/summingbird development by creating an account on GitHub.
- 148A library that toggles Scala code at compile-time, like #if in C/C++
https://github.com/ThoughtWorksInc/enableIf.scala
A library that toggles Scala code at compile-time, like #if in C/C++ - ThoughtWorksInc/enableIf.scala
- 149Casbah is now officially end-of-life (EOL).
https://github.com/mongodb/casbah
Casbah is now officially end-of-life (EOL). Contribute to mongodb/casbah development by creating an account on GitHub.
- 150Build highly concurrent, distributed, and resilient message-driven applications on the JVM
https://github.com/akka/akka
Build highly concurrent, distributed, and resilient message-driven applications on the JVM - akka/akka
- 151A framework to create embedded Domain-Specific Languages in Scala
https://github.com/ThoughtWorksInc/Dsl.scala
A framework to create embedded Domain-Specific Languages in Scala - ThoughtWorksInc/Dsl.scala
- 152Scala library for boilerplate-free, type-safe data transformations
https://github.com/scalalandio/chimney
Scala library for boilerplate-free, type-safe data transformations - scalalandio/chimney
- 153Interactive and Reactive Data Science using Scala and Spark.
https://github.com/spark-notebook/spark-notebook
Interactive and Reactive Data Science using Scala and Spark. - spark-notebook/spark-notebook
- 154TensorFlow API for the Scala Programming Language
https://github.com/eaplatanios/tensorflow_scala
TensorFlow API for the Scala Programming Language. Contribute to eaplatanios/tensorflow_scala development by creating an account on GitHub.
- 155numsca is numpy for scala
https://github.com/botkop/numsca
numsca is numpy for scala. Contribute to botkop/numsca development by creating an account on GitHub.
- 156A cohesive & pragmatic framework of FP centric Scala libraries
https://github.com/frees-io/freestyle
A cohesive & pragmatic framework of FP centric Scala libraries - frees-io/freestyle
- 157Build software better, together
https://github.com/Sciss/ScalaCollider
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
- 158A lightweight, clean and simple JSON implementation in Scala
https://github.com/spray/spray-json
A lightweight, clean and simple JSON implementation in Scala - spray/spray-json
- 159A new Scala wrapper for Joda Time based on scala-time
https://github.com/nscala-time/nscala-time
A new Scala wrapper for Joda Time based on scala-time - nscala-time/nscala-time
- 160Convenient and performant logging library for Scala wrapping SLF4J.
https://github.com/lightbend-labs/scala-logging
Convenient and performant logging library for Scala wrapping SLF4J. - lightbend-labs/scala-logging
- 161Blindsight is a Scala logging API with DSL based structured logging, fluent logging, semantic logging, flow logging, and context aware logging.
https://github.com/tersesystems/blindsight
Blindsight is a Scala logging API with DSL based structured logging, fluent logging, semantic logging, flow logging, and context aware logging. - tersesystems/blindsight
- 162Command Line Interface Scala Toolkit
https://github.com/backuity/clist
Command Line Interface Scala Toolkit. Contribute to backuity/clist development by creating an account on GitHub.
- 163command line options parsing for Scala
https://github.com/scopt/scopt
command line options parsing for Scala. Contribute to scopt/scopt development by creating an account on GitHub.
- 164Schema safe, type-safe, reactive Scala driver for Cassandra/Datastax Enterprise
https://github.com/outworkers/phantom
Schema safe, type-safe, reactive Scala driver for Cassandra/Datastax Enterprise - outworkers/phantom
- 165A Scala API for Cascading
https://github.com/twitter/scalding
A Scala API for Cascading. Contribute to twitter/scalding development by creating an account on GitHub.
- 166The fastest logging library in the world. Built from scratch in Scala and programmatically configurable.
https://github.com/outr/scribe
The fastest logging library in the world. Built from scratch in Scala and programmatically configurable. - outr/scribe
- 167State of the Art Natural Language Processing
https://github.com/JohnSnowLabs/spark-nlp
State of the Art Natural Language Processing. Contribute to JohnSnowLabs/spark-nlp development by creating an account on GitHub.
- 168Essential Building Blocks for Scala
https://github.com/wvlet/airframe
Essential Building Blocks for Scala. Contribute to wvlet/airframe development by creating an account on GitHub.
- 169ZIO — A type-safe, composable library for async and concurrent programming in Scala
https://github.com/zio/zio
ZIO — A type-safe, composable library for async and concurrent programming in Scala - zio/zio
- 170Lightweight, modular, and extensible library for functional programming.
https://github.com/typelevel/cats
Lightweight, modular, and extensible library for functional programming. - typelevel/cats
- 171Scala validation library
https://github.com/jap-company/fields
Scala validation library. Contribute to jap-company/fields development by creating an account on GitHub.
- 172Cask: a Scala HTTP micro-framework
https://github.com/com-lihaoyi/cask
Cask: a Scala HTTP micro-framework. Contribute to com-lihaoyi/cask development by creating an account on GitHub.
- 173Slick extensions for PostgreSQL
https://github.com/tminglei/slick-pg
Slick extensions for PostgreSQL. Contribute to tminglei/slick-pg development by creating an account on GitHub.
- 174First class syntax support for type classes in Scala
https://github.com/typelevel/simulacrum
First class syntax support for type classes in Scala - typelevel/simulacrum
- 175Persist-Json, a Fast Json Parser Written in Scala
https://github.com/nestorpersist/json
Persist-Json, a Fast Json Parser Written in Scala. Contribute to nestorpersist/json development by creating an account on GitHub.
- 176Refinement types for Scala
https://github.com/fthomas/refined
Refinement types for Scala. Contribute to fthomas/refined development by creating an account on GitHub.
- 177Generic programming for Scala
https://github.com/milessabin/shapeless
Generic programming for Scala. Contribute to milessabin/shapeless development by creating an account on GitHub.
- 178Lift Framework
https://github.com/lift/framework
Lift Framework. Contribute to lift/framework development by creating an account on GitHub.
- 179Fast, testable, Scala services built on TwitterServer and Finagle
https://github.com/twitter/finatra
Fast, testable, Scala services built on TwitterServer and Finagle - twitter/finatra
- 180Build software better, together
https://github.com/wireapp/wire-signals
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
- 181The Opinionated RabbitMQ Library for Scala and Akka
https://github.com/SpinGo/op-rabbit
The Opinionated RabbitMQ Library for Scala and Akka - SpinGo/op-rabbit
- 182JSON typeclasses that know the difference between null and absent fields
https://github.com/nrktkt/ninny-json
JSON typeclasses that know the difference between null and absent fields - nrktkt/ninny-json
- 183Scala macros for compile-time generation of safe and ultra-fast JSON codecs + circe booster
https://github.com/plokhotnyuk/jsoniter-scala
Scala macros for compile-time generation of safe and ultra-fast JSON codecs + circe booster - plokhotnyuk/jsoniter-scala
- 184LoMRF is an open-source implementation of Markov Logic Networks
https://github.com/anskarl/LoMRF
LoMRF is an open-source implementation of Markov Logic Networks - anskarl/LoMRF
- 185property based testing library for Scala
https://github.com/scalaprops/scalaprops
property based testing library for Scala. Contribute to scalaprops/scalaprops development by creating an account on GitHub.
- 186Yet another JSON library for Scala
https://github.com/circe/circe
Yet another JSON library for Scala. Contribute to circe/circe development by creating an account on GitHub.
- 187Native Scala mocking framework
https://github.com/paulbutcher/ScalaMock
Native Scala mocking framework. Contribute to paulbutcher/ScalaMock development by creating an account on GitHub.
- 188OAuth 2.0 server-side implementation written in Scala
https://github.com/nulab/scala-oauth2-provider
OAuth 2.0 server-side implementation written in Scala - nulab/scala-oauth2-provider
- 189A small, convenient, dependency-free library for command-line argument parsing in Scala
https://github.com/com-lihaoyi/mainargs
A small, convenient, dependency-free library for command-line argument parsing in Scala - com-lihaoyi/mainargs
- 190Scala + Druid: Scruid. A library that allows you to compose queries in Scala, and parse the result back into typesafe classes.
https://github.com/ing-bank/scruid
Scala + Druid: Scruid. A library that allows you to compose queries in Scala, and parse the result back into typesafe classes. - ing-bank/scruid
- 191akka-persistence-gcp-datastore is a journal and snapshot store plugin for akka-persistence using google cloud firestore in datastore mode.
https://github.com/innFactory/akka-persistence-gcp-datastore
akka-persistence-gcp-datastore is a journal and snapshot store plugin for akka-persistence using google cloud firestore in datastore mode. - GitHub - innFactory/akka-persistence-gcp-datastore: akk...
- 192Mirror of Apache Kafka
https://github.com/apache/kafka
Mirror of Apache Kafka. Contribute to apache/kafka development by creating an account on GitHub.
- 193:leaves: Non-blocking, Reactive MongoDB Driver for Scala
https://github.com/ReactiveMongo/ReactiveMongo
:leaves: Non-blocking, Reactive MongoDB Driver for Scala - ReactiveMongo/ReactiveMongo
- 194Scala GraphQL implementation
https://github.com/sangria-graphql/sangria
Scala GraphQL implementation. Contribute to sangria-graphql/sangria development by creating an account on GitHub.
- 195Functional, stream-based CSV processor for Scala
https://github.com/fingo/spata
Functional, stream-based CSV processor for Scala. Contribute to fingo/spata development by creating an account on GitHub.
- 196ActiveRecord-like ORM library for Scala
https://github.com/aselab/scala-activerecord
ActiveRecord-like ORM library for Scala. Contribute to aselab/scala-activerecord development by creating an account on GitHub.
- 197A Future-free Fs2 native pure FP Redis client
https://github.com/laserdisc-io/laserdisc
A Future-free Fs2 native pure FP Redis client. Contribute to laserdisc-io/laserdisc development by creating an account on GitHub.
- 198Scala framework for building beautiful and maintainable web applications.
https://github.com/UdashFramework/udash-core
Scala framework for building beautiful and maintainable web applications. - UdashFramework/udash-core
- 199Main Portal page for the Jackson project
https://github.com/FasterXML/jackson
Main Portal page for the Jackson project. Contribute to FasterXML/jackson development by creating an account on GitHub.
- 200Library to read, analyze, transform and generate Scala programs
https://github.com/scalameta/scalameta
Library to read, analyze, transform and generate Scala programs - scalameta/scalameta
- 201Compositional, streaming I/O library for Scala
https://github.com/typelevel/fs2
Compositional, streaming I/O library for Scala. Contribute to typelevel/fs2 development by creating an account on GitHub.
- 202The Community Maintained High Velocity Web Framework For Java and Scala.
https://github.com/playframework/playframework
The Community Maintained High Velocity Web Framework For Java and Scala. - playframework/playframework
- 203Scala lightweight, type-safe, asynchronous driver for neo4j
https://github.com/neotypes/neotypes
Scala lightweight, type-safe, asynchronous driver for neo4j - GitHub - neotypes/neotypes: Scala lightweight, type-safe, asynchronous driver for neo4j
- 204Type-safe general-cryptography library - https://jmcardon.github.io/tsec/
https://github.com/jmcardon/tsec
Type-safe general-cryptography library - https://jmcardon.github.io/tsec/ - jmcardon/tsec
- 205JSON library
https://github.com/json4s/json4s
JSON library. Contribute to json4s/json4s development by creating an account on GitHub.
- 206Web & mobile client-side akka-http sessions, with optional JWT support
https://github.com/softwaremill/akka-http-session
Web & mobile client-side akka-http sessions, with optional JWT support - softwaremill/akka-http-session
- 207Lightweight and Nonintrusive Scala Dependency Injection Library
https://github.com/softwaremill/macwire
Lightweight and Nonintrusive Scala Dependency Injection Library - softwaremill/macwire
- 208Rings: efficient JVM library for polynomial rings
https://github.com/PoslavskySV/rings
Rings: efficient JVM library for polynomial rings. Contribute to PoslavskySV/rings development by creating an account on GitHub.
- 209Typesafe, purely functional Computational Intelligence
https://github.com/ciren/cilib
Typesafe, purely functional Computational Intelligence - ciren/cilib
- 210An experimental library for Functional Reactive Programming in Scala
https://github.com/lihaoyi/scala.rx
An experimental library for Functional Reactive Programming in Scala - lihaoyi/scala.rx
- 211New ReactiveCouchbase driver using reactive-streams
https://github.com/ReactiveCouchbase/reactivecouchbase-rs-core
New ReactiveCouchbase driver using reactive-streams - ReactiveCouchbase/reactivecouchbase-rs-core
- 212Simple, safe and intuitive Scala I/O
https://github.com/pathikrit/better-files
Simple, safe and intuitive Scala I/O. Contribute to pathikrit/better-files development by creating an account on GitHub.
- 213Reactive type-safe Scala driver for SQL databases
https://github.com/outworkers/morpheus
Reactive type-safe Scala driver for SQL databases. Contribute to outworkers/morpheus development by creating an account on GitHub.
- 214Lamma schedule generator for Scala is a professional schedule generation library for periodic schedules like fixed income coupon payment, equity deravitive fixing date generation etc.
https://github.com/maxcellent/lamma
Lamma schedule generator for Scala is a professional schedule generation library for periodic schedules like fixed income coupon payment, equity deravitive fixing date generation etc. - GitHub - m...
- 215Tiny High Performance HTTP Server for Scala
https://github.com/analogweb/analogweb-scala
Tiny High Performance HTTP Server for Scala . Contribute to analogweb/analogweb-scala development by creating an account on GitHub.
- 216A test framework that runs everything in parallel.
https://github.com/disneystreaming/weaver-test
A test framework that runs everything in parallel. - GitHub - disneystreaming/weaver-test: A test framework that runs everything in parallel.
- 217Clickhouse Scala Client with Reactive Streams support
https://github.com/crobox/clickhouse-scala-client
Clickhouse Scala Client with Reactive Streams support - crobox/clickhouse-scala-client
- 218Memcached client for Scala
https://github.com/monix/shade
Memcached client for Scala. Contribute to monix/shade development by creating an account on GitHub.
- 219A schema-aware Scala library for data transformation
https://github.com/galliaproject/gallia-core
A schema-aware Scala library for data transformation - galliaproject/gallia-core
- 220Efficient CBOR and JSON (de)serialization in Scala
https://github.com/sirthias/borer
Efficient CBOR and JSON (de)serialization in Scala - sirthias/borer
- 221A purely functional Scala client for CouchDB
https://github.com/beloglazov/couchdb-scala
A purely functional Scala client for CouchDB. Contribute to beloglazov/couchdb-scala development by creating an account on GitHub.
- 222The Play JSON library
https://github.com/playframework/play-json
The Play JSON library. Contribute to playframework/play-json development by creating an account on GitHub.
- 223Image comparison by hash codes
https://github.com/poslegm/scala-phash
Image comparison by hash codes. Contribute to poslegm/scala-phash development by creating an account on GitHub.
- 224Avro schema generation and serialization / deserialization for Scala
https://github.com/sksamuel/avro4s
Avro schema generation and serialization / deserialization for Scala - sksamuel/avro4s
- 225Scala combinator library for working with binary data
https://github.com/scodec/scodec
Scala combinator library for working with binary data - scodec/scodec
- 226Minimal, idiomatic, customizable validation Scala library.
https://github.com/yakivy/dupin
Minimal, idiomatic, customizable validation Scala library. - yakivy/dupin
- 227An implementation of an OAuth2 server designed for mocking/testing
https://github.com/zalando-stups/OAuth2-mock-play
An implementation of an OAuth2 server designed for mocking/testing - zalando-stups/OAuth2-mock-play
- 228A type-safe, reflection-free, powerful enumeration implementation for Scala with exhaustive pattern match warnings and helpful integrations.
https://github.com/lloydmeta/enumeratum
A type-safe, reflection-free, powerful enumeration implementation for Scala with exhaustive pattern match warnings and helpful integrations. - lloydmeta/enumeratum
- 229Optics library for Scala
https://github.com/optics-dev/Monocle
Optics library for Scala. Contribute to optics-dev/Monocle development by creating an account on GitHub.
- 230Scala etcd client implementing V3 APIs
https://github.com/mingchuno/etcd4s
Scala etcd client implementing V3 APIs. Contribute to mingchuno/etcd4s development by creating an account on GitHub.
- 231An asynchronous programming facility for Scala
https://github.com/scala/scala-async
An asynchronous programming facility for Scala. Contribute to scala/scala-async development by creating an account on GitHub.
- 232Accord: A sane validation library for Scala
https://github.com/wix/accord
Accord: A sane validation library for Scala. Contribute to wix-incubator/accord development by creating an account on GitHub.
- 233A data access library for Scala + Postgres.
https://github.com/tpolecat/skunk
A data access library for Scala + Postgres. Contribute to typelevel/skunk development by creating an account on GitHub.
- 234tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android
https://github.com/tinylog-org/tinylog
tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android - tinylog-org/tinylog
- 235A purely functional library to build distributed and event-driven systems
https://github.com/parapet-io/parapet
A purely functional library to build distributed and event-driven systems - parapet-io/parapet
- 236Non-blocking, Reactive Redis driver for Scala (with Sentinel support)
https://github.com/etaty/rediscala
Non-blocking, Reactive Redis driver for Scala (with Sentinel support) - etaty/rediscala
- 237Wonderful reusable code from Twitter
https://github.com/twitter/util
Wonderful reusable code from Twitter. Contribute to twitter/util development by creating an account on GitHub.
- 238The Scala API for Quantities, Units of Measure and Dimensional Analysis
https://github.com/typelevel/squants
The Scala API for Quantities, Units of Measure and Dimensional Analysis - typelevel/squants
- 239Squid – type-safe metaprogramming and compilation framework for Scala
https://github.com/epfldata/squid
Squid – type-safe metaprogramming and compilation framework for Scala - epfldata/squid
- 240Principled Functional Programming in Scala
https://github.com/scalaz/scalaz
Principled Functional Programming in Scala. Contribute to scalaz/scalaz development by creating an account on GitHub.
- 241sbt plugin that generates Scala case classes for easy, statically typed and implicit access of JSON data e.g. from API responses
https://github.com/battermann/sbt-json
sbt plugin that generates Scala case classes for easy, statically typed and implicit access of JSON data e.g. from API responses - battermann/sbt-json
- 242Accelerate local LLM inference and finetuning (LLaMA, Mistral, ChatGLM, Qwen, Baichuan, Mixtral, Gemma, Phi, MiniCPM, etc.) on Intel CPU and GPU (e.g., local PC with iGPU, discrete GPU such as Arc, Flex and Max); seamlessly integrate with llama.cpp, Ollama, HuggingFace, LangChain, LlamaIndex, GraphRAG, DeepSpeed, vLLM, FastChat, Axolotl, etc.
https://github.com/intel-analytics/BigDL
Accelerate local LLM inference and finetuning (LLaMA, Mistral, ChatGLM, Qwen, Baichuan, Mixtral, Gemma, Phi, MiniCPM, etc.) on Intel CPU and GPU (e.g., local PC with iGPU, discrete GPU such as Arc,...
- 243Mockito for Scala language
https://github.com/mockito/mockito-scala
Mockito for Scala language. Contribute to mockito/mockito-scala development by creating an account on GitHub.
- 244High-performance SLF4J wrapper for Scala.
https://github.com/Log4s/log4s
High-performance SLF4J wrapper for Scala. Contribute to Log4s/log4s development by creating an account on GitHub.
- 245🔍 Elasticsearch Scala Client - Reactive, Non Blocking, Type Safe, HTTP Client
https://github.com/sksamuel/elastic4s
🔍 Elasticsearch Scala Client - Reactive, Non Blocking, Type Safe, HTTP Client - Philippus/elastic4s
- 246aossie / Agora · GitLab
https://gitlab.com/aossie/Agora/
An Electronic Voting Library implemented in Scala
- 247aossie / Scavenger · GitLab
https://gitlab.com/aossie/Scavenger
A theorem prover based on the conflict resolution calculus
- 248SBT plugin for tweaking various IDE settings
https://github.com/JetBrains/sbt-ide-settings
SBT plugin for tweaking various IDE settings. Contribute to JetBrains/sbt-ide-settings development by creating an account on GitHub.
- 249An HTTP Server and Client library for Scala.
https://github.com/criteo/lolhttp
An HTTP Server and Client library for Scala. Contribute to criteo/lolhttp development by creating an account on GitHub.
- 250Scalafmt · Code formatter for Scala
https://scalameta.org/scalafmt/
Code formatter for Scala
- 251sbt plugin that can check Maven and Ivy repositories for dependency updates
https://github.com/rtimush/sbt-updates
sbt plugin that can check Maven and Ivy repositories for dependency updates - rtimush/sbt-updates
- 252Scala command-line wrapper around ffmpeg, ffprobe, ImageMagick, and other tools relating to media.
https://github.com/outr/media4s
Scala command-line wrapper around ffmpeg, ffprobe, ImageMagick, and other tools relating to media. - outr/media4s
- 253friendly little parsers
https://github.com/tpolecat/atto
friendly little parsers. Contribute to tpolecat/atto development by creating an account on GitHub.
- 254simple combinator-based parsing for Scala. formerly part of the Scala standard library, now a separate community-maintained module
https://github.com/scala/scala-parser-combinators
simple combinator-based parsing for Scala. formerly part of the Scala standard library, now a separate community-maintained module - scala/scala-parser-combinators
Related Articlesto learn about angular.
- 1Introduction to Scala: Beginner’s Guide
- 2Understanding Scala’s Type System: Types and Generics
- 3Functional Programming with Scala
- 4Advanced Functional Programming in Scala: Monads, Functors, and More
- 5Building RESTful APIs with Scala and Akka HTTP: A Beginner’s Guide
- 6Play Framework for Scala Web Development: A Step-by-Step Guide
- 7Concurrency in Scala: Mastering Futures and Promises
- 8Optimizing Scala Performance: Tips for High-Performance Scala Applications
- 9Developing a Scala-based Chat Application: From Concept to Deployment
- 10Creating a Scala-based Data Processing Pipeline: Handling Big Data Efficiently
FAQ'sto learn more about Angular JS.
mail [email protected] to add more queries here 🔍.
- 1
can scala do functional programming
- 2
is scala worth learning in 2023
- 3
is scala popular
- 4
is scala a popular language
- 5
why was scala created
- 6
is scala better than python
- 7
can scala use java libraries
- 8
what is the paradigm of the scala programming language
- 9
why use scala programming language
- 10
should i learn scala
- 11
is scala a good language
- 12
is scala a programming language
- 13
where is la scala opera house located
- 14
when was scala created
- 15
how does scala work
- 16
where is scala installed on windows
- 17
why scala is called functional programming language
- 18
does scala use jvm
- 19
where is scala programming language used
- 20
what is scala software
- 21
why learn scala
- 22
why scala over java
- 23
why scala over python
- 24
- 25
where scala is used
- 26
how to learn scala programming
- 27
is scala a popular programming language
- 28
where is la scala located
- 30
who developed scala
- 31
what is scala code
- 32
why scala is not popular
- 33
- 34
- 35
which of the following programming paradigm does scala support
- 36
- 37
can i use scala code in java
- 38
how is scala different from python
- 39
who created scala
- 40
when scala spark
- 41
is scala dead 2023
- 42
who invented scala
- 43
where is la scala located in italy
- 44
- 45
why scala is functional programming language
- 46
is scala open source
- 47
what is scala mostly used for
- 48
is scala written in java
- 49
is scala a dying language
- 50
what is scala programming language used for
- 51
is scala a good programming language
- 52
why scala is better than java
- 53
what is scala programming
- 54
when to use scala
- 55
can i learn scala without java
- 56
does scala compile to java
- 57
why scala is used
- 58
what is functional programming in scala
- 59
should i learn scala reddit
- 60
should i learn java or scala
- 61
how to pronounce scala programming language
- 63
does scala run on jvm
- 64
what is scala programming used for
- 65
who uses scala programming language
- 66
is scala functional programming
More Sitesto check out once you're finished browsing here.
https://www.0x3d.site/
0x3d is designed for aggregating information.
https://nodejs.0x3d.site/
NodeJS Online Directory
https://cross-platform.0x3d.site/
Cross Platform Online Directory
https://open-source.0x3d.site/
Open Source Online Directory
https://analytics.0x3d.site/
Analytics Online Directory
https://javascript.0x3d.site/
JavaScript Online Directory
https://golang.0x3d.site/
GoLang Online Directory
https://python.0x3d.site/
Python Online Directory
https://swift.0x3d.site/
Swift Online Directory
https://rust.0x3d.site/
Rust Online Directory
https://scala.0x3d.site/
Scala Online Directory
https://ruby.0x3d.site/
Ruby Online Directory
https://clojure.0x3d.site/
Clojure Online Directory
https://elixir.0x3d.site/
Elixir Online Directory
https://elm.0x3d.site/
Elm Online Directory
https://lua.0x3d.site/
Lua Online Directory
https://c-programming.0x3d.site/
C Programming Online Directory
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
https://r-programming.0x3d.site/
R Programming Online Directory
https://perl.0x3d.site/
Perl Online Directory
https://java.0x3d.site/
Java Online Directory
https://kotlin.0x3d.site/
Kotlin Online Directory
https://php.0x3d.site/
PHP Online Directory
https://react.0x3d.site/
React JS Online Directory
https://angular.0x3d.site/
Angular JS Online Directory