Finch 0.25
Our anniversary 50th release brings a lot of exciting changes. The biggest news is starting with 0.25 (this release) Finch is now completely agnostic to the underlying effect type (was Twitter Future before).
Polymorphic Endpoints
This is, perhaps, the biggest change in Finch since introduction of Endpoint
couple of years back. Locking our core APIs to a particular effect type (Twitter Future) never felt right yet, surely, was a reasonable thing to do at first. As Finch's API matured, we figured the major source of complains from our users was about this hard dependency to a Twitter's stack (think Twitter Util's).
With the 1.0 release of cats-effect, it became clear that Finch's path towards better interoperability with the rest of typelevel libraries (think Cats-based libraries) was adopting Effect
type classes in the Endpoint
API.
Long story short Endpoint[A]
now becomes Endpoint[F[_], A]
where F[_]
is anything that has an cats.effect.Effect
instance (think ZIO, Monix Task, Cats IO, Catbird Rerunnable, etc). This heroic effort was driven by @sergeykolbasov in #979.
This sounds scary at least - a LOT of API changes. To mitigate the impact we keep releasing normal Finch artifacts (Twitter Futures) under a previous name: finch-*
. This means you don't really have to migrate to a new endpoint API just now. The current plan is to keep supporting a previous version of Finch API for some time (at least 6 months) but keep its branch under feature freeze (commit only bug-fixes and dependency bumps).
If you're feeling adventurous, you can jump into polymorphic endpoints now by depending on finchx-*
artifacts instead.
libraryDependencies ++= Seq(
"com.github.finagle" %% "finchx-core" % "0.25.0",
"com.github.finagle" %% "finchx-circe" % "0.25.0",
)
There several ways how to instantiate polymorphic endpoints (see #988). Perhaps, the most standard way is via importing io.finch.catsEffect._
EndpointModule
(in case if you prefer Cats IO as your effect type).
import io.finch._
import io.finch.catsEffect._
val p: Endpoint[IO, Int] = param[Int]("foo")
You can also specify the F[_]
type constructor explicitly should you prefer other effect implementation.
import io.finch._
val p: Endpoint[MyIO, Int] = Endpoint[MyIO].param[Int]("foo")
Or via instantiating an EndpointModule
for your effect instance.
import io.finch._
object myIO extends Endpoint.Module[MyIO]
import myIO._
val p: Endpoint[MyIO, Int] = param[Int]("foo")
Notable Changes Accommodating cats-effect Integration
- Syntax Package became obsolete (do not need to import it) as we can now derive syntax based on
Effect
instance. - As we're no longer depending on Twitter Futures, other Twitter APIs (
Duration
,Try
) have been migrated to their Scala's counterparts.
Performance
We did some initial testing of new endpoints and the outcome looks optimistic. Essentially, we're observing similar performance gains as we did with Trane Arrows couple of releases back.
Auto Releases
Inspired by how Trane Arrows's build is setup, @arron-green kicked in a new releasing machinery for Finch. Now we can cut releases via a single commit that changes the version.sbt
file (see #995 and #1000 for more details). Everything is automated and requires no human supervision or interaction. This very release was performed this way.
This is quite an exciting and very necessary improvement as now any Finch maintainer (a person with a push access to a repository) can cut releases.