Releases: zio/zio
2.0.0-M2
This next milestone release contains bug fixes and performance improvements., bringing us one step closer to the first release candidate for ZIO 2.0. Please let us know your feedback!
1.0.11
This minor release contains big fixes and various improvements. In particular, ZLayer#flatMap has now been implemented to make it easier to build layers dynamically based on inputs such as configuration information. Smart assertions get better with improved diffing and more accurate source locations thanks to work by @kitlangton. And @khajavi has continued his work of building out the website by adding documentation for ZIO ecosystem libraries.
As always, thank you for your continued support.
ZIO Core
- Update documentation example corresponding to zio-slick-interop 0.4 (#5419) @khajavi
- Implement NonEmptyChunk#fromIterableOption (#5371) @adamgfraser
- Introduction to community libraries (#5318) @khajavi
- Backport ZLayer#flatmap To ZIO 1.0 (#5372) @adamgfraser
- Introduction to the ZIO libraries (#5272) @khajavi
- Implement ZManaged.memoize (#5347) @adamgfraser
- Complete Takers After On Queue Empty Space (#5365) @adamgfraser
- Add Default Value For Yield On Start (#5370) @adamgfraser
- Remove Illegal Reflective Access (#5364) @adamgfraser
- [Doc] FiberRef: fix the doc example which demonstrates inheritRefs and join (#5367) @antivanov
- Update basic_operations.md (#5331) @AlekseiLitkovetc
ZIO Stream
- Fixed typo in ZTransducer docs (#5401) @amitayh
- Implement Specialized Version Of Register Function For ZStream.effectAsync (#5397) @adamgfraser
- fix typo in zstream qeuue => queue (#5376) @txdv
ZIO Test
- Multiline string diffing (#5379) @kitlangton
- Use SourceLocation for assertTrue (#5363) @kitlangton
- Improve PrettyPrint for Smart Assertions (#5361) @kitlangton
- Generalize Signature Of Test Aspect Before (#5351) @adamgfraser
2.0.0-M1
We are excited to share with you the first milestone release of ZIO 2.0, the next generation of concurrent programming in Scala.
ZIO 2.0 is the culmination of years of work by more than four hundred contributors and changes the game in four key areas.
Performance
ZIO has always been laser-focused on performance and ZIO 2.0 is no exception. The core runtime system has been hand-optimized to eliminate unnecessary work, getting you as close to bare metal as possible, while still providing the guarantees you have come to expect. This includes a new optimized interpreter for short, synchronous workloads to make it easy to run ZIO workflows in mixed applications without compromising performance.
ZIO 2.0 also features a new fiber-aware scheduler that automatically shifts work between underlying operating system threads to maximize fiber thread affinity, while using all the cores on your machine. This increases cache-locality and improves the performance of ZIO applications, without you having to do anything. With these changes, ZIO continues its history of bringing ZIO users leading performance.
Finally, ZIO 2.0 features optimized handling of blocking operations, avoiding unnecessary shifting between thread pools. Even if you write your code with many individual blocking operations, the ZIO runtime can eliminate most of these thread pool shifts. If you do blocking at a higher level, your code gets even faster.
ZIO.blocking {
for {
result1 <- ZIO.blocking(ZIO.attempt(doIO1()))
result2 <- ZIO.blocking(ZIO.attempt(doIO2()))
result3 <- ZIO.blocking(ZIO.attempt(doIO3()))
} yield result1 + result2 + result3
}Ergonomics
Ergonomics has always been a strong point for ZIO with its focus on concrete operators on concrete data types. And we're taking this to the next level in ZIO 2.0.
First, layers are getting easier to use. Layers have become the go-to solution for architecting large-scale applications, allowing teams to build functionality in a modular way with resource-safety, with more accessibility and less ramp-up time than alternative approaches. With the module pattern in ZIO 2.0, you can define services the way you would normal Java interfaces and implementation classes. Then you can wire them together with no boilerplate with built-in automatic layer construction, which is type-safe and happens at compile-time.
trait UserRepo {
def getUserById(userId: UserId): Task[User]
}
final case class UserRepoRDBMS(database: Database) extends UserRepo {
def getUserById(userId: UserId): Task[User] = ...
}
val userRepoDBMS =
(for {
database <- ZIO.service[Database]
} yield UserRepoRDMS(database)).toLayer
...
myApp.inject(UserRepoDBMS.live, MySqlDatabase.live, ...)Second, the entire API has been polished and refined. Every operator describes what it does in as clear a way as possible. Instead of console.putStrLn think Console.printLine. Instead of ZIO.effect think ZIO.succeed. These changes make ZIO more accessible and enjoyable for developers of all backgrounds.
Third, we are introducing a new set of smart constructors that will automatically lift any data type into a ZIO, ZManaged, or ZStream. Don't remember the operator name for constructing a ZIO from an Either particular value? No problem, just use ZIO.from(either). This is particularly helpful for quickly getting new developers productive with ZIO.
ZIO.from {
println("Entering example")
for {
result1 <- ZIO.from(Future.successful(1))
result2 <- ZIO.from(Right(2))
result3 <- ZIO.from(ZIO.from(3))
result4 <- ZIO.from(Try(4))
} yield result1 + result2 + result3 + result4
}Operations
As more and more large organizations have adopted ZIO for mission critical applications, we have consistently heard the need for high quality, out-of-the-box solutions for logging, metrics, and tracing.
When ZIO 2.0 is released, it will have logging and metrics built-in, a first for any functional effect system in Scala. This will let you write an application and immediately have logging and metrics for free. Of course, you will also be able to plug in any existing logging or metrics system you are using and have it automatically work with ZIO.
Not yet available in this milestone release, ZIO 2.0 will also optimize execution tracing. ZIO pioneered execution traces for asynchronous code and we are building on this legacy by making execution traces even lower cost and even more useful, pointing directly to the section of user code that failed in the event of an error, and showing execution tracing in way that interfaces with existing debugging tooling.
Streaming
ZIO 2.0 is realizing the vision of what streams can be. Streaming has always been an extremely attractive paradigm for defining data flows in a compositional way, but for performance-sensitive applications that high level interface can turn into an obstacle when that streaming code is just too slow.
We believe that streams can be both principled and highly performant and we are making that a reality in ZIO 2.0 with a new encoding of streams based on the idea of conduits that fundamentally unifies streams and sinks. In this model, a conduit is essentially just a mutable asynchronous channel when it is run, much like the ones we might work with from the java.nio package. This lets us build all of the high level streaming abstractions from ZIO 1.0 while keeping that low level performance. It also gives users the flexibility to drop down to that lower level layer if necessary for implementing their own streaming operators.
This new vision of streams is backed up by optimized data structures. In particular, ZIO 2.0 features a highly optimized asynchronous message hub that is dramatically faster than equivalent data structures in other streaming libraries, supporting extremely fast broadcast operations. Data structures like hubs and queues give us the building blocks to implement many of these streaming operators in a highly performant way.
Thank you all for your support and we look forward to your feedback as we prepare for the final release of ZIO 2.0. For intrepid users who are aware of the costs of doing so, trying out an early release is extremely valuable to help us refine the changes we are making.
We expect to push quickly for an initial release candidate, with the goal of doing a final release of ZIO 2.0 in October assuming there have been no significant issues reported with the latest release candidate.
There has never been a more exciting time to be programming with Scala. We hope you enjoy using ZIO as much as we have developing it and can't wait to see what you build with it!
1.0.10
This minor release contains bug fixes and additional documentation. It also includes diffing for smart assertions.
ZIO Core
- Fix Bug In ZStream#flatMapPar (#5325) @adamgfraser
- Fix Signature of ZManaged.makeEffectTotal_ (#5327) @adamgfraser
- YieldOnStart: Configuration (#5328) @tusharmath
- Fix Signature Of ZStream.FromJavaStream (#5322) @adamgfraser
- Inherit FiberRefs in ForEachPar_ (#5323) @adamgfraser
- Start documenting migration from cats effect to ZIO (#5279) @zhrebicek
- Fix documentation (#5296) @dannashirn
- Fix typo in documentation. (#5315) @sergey-lagutin
- Fixed #5288 - correcting wrong partially applied value class instantiated (#5307) @remiguittaut
- Fixed #5288 - Adding serviceWithManaged to ZManaged constructors (#5291) @remiguittaut
- Update ref.md (#5283) @yisraelU
- Added munit-zio to community libraries list (#5278) @poslegm
- Introduce Schedule.upTo operator (#5274) @agarella
- Update officials.md (#5216) @mkows
- Improve Cats Effect Interop Documentation (#5251) @khajavi
- Turns out Scalac is using ZIO (#5258) @jczuchnowski
- Implement Boolean Operators for ZIO (#5252) @adamgfraser
- Avoid exception caused by very long durations (#5255) @vigoo
- Fix #5152: include .sjsir files when publishing for scalajs on scala 3 (#5238) @roald-di
- Implement ZIO#tapDefect (#5214) @adamgfraser
- WIP: Improve interop with cats effect documentation (#4965) @khajavi
- Adds reference to ZIO.tupled and ZIO.tupledPar (#5247) @erikvanoosten
- Documentation of ZIO Interruption (#5235) @khajavi
- Cause: Then distributes over Both even in the presence of Empty (#5242) @sideeffffect
- Add Concurrency Stress Test (#5232) @adamgfraser
- Harden ZHub Implementation (#5231) @adamgfraser
- [resource/managed][documentation] Fix minor documentation typo Managed -> ZManaged (#5230) @antivanov
- Custom Runtime Documentation (#5211) @khajavi
- fix typo (#5223) @ibraheemdev
- Add zio-redis to official libs (#5220) @mijicd
- Update List Of ZIO Libraries (#5219) @adamgfraser
- Generalize ZIO.debug (#5218) @adamgfraser
- Fix wrong link name (#5213) @mijicd
- Add YourKit To Sponsors (#5209) @adamgfraser
- Deprecating
.bimap, adding.mapBothinstead (#5208) @hmemcpy - ZIO Runtime System Documentation (#5200) @khajavi
- Implement Chunk.unapplySeq (#5180) @adamgfraser
ZIO Stream
- Fix Signature Of ZStream.FromJavaStream (#5322) @adamgfraser
- Bug fix:
ZStream#timeoutErrorhas a by-name error parameter that is eagerly evaluated (#5260) @harveywi - Improve Connection API - address and shutdownWrite (#5228) @searler
- ZIO Streams documentation (#5102) @khajavi
- Fixing issue #5057 - ZStream collectType operator (#5058) @remiguittaut
ZIO Test
- Fix smart assert diff bug (#5317) @kitlangton
- Support Combining Specs (#5100) @adamgfraser
- Smart assert diffing (#5295) @kitlangton
- Smart assert bug-fix and better array equality (#5294) @kitlangton
- Fix SmartAssertions for isInstanceOf (#5292) @kitlangton
- Fix
Assertion.isFailurename (#5286) @guizmaii - Fix #5244: don't expand package definitions in the assertTrue macro for scala 3 (#5245) @roald-di
- Make TestAspect.fibers public (#5210) @joroKr21
- Fix flaky mockable spec (#5227) (#5233) @vigoo
- Show all failures in the presence of a mock exception in the report (#5193) @vigoo
- Adding missing && to some assertions in MyersDiffSpec (#5195) @hmemcpy
- Fix broken link in docs/howto/mock-services.md (#5188) @axtsnee
- Display Warning If Test Clock Is Being Advanced But Fiber Is Not Suspending (#5179) @adamgfraser
1.0.9
In addition to various other improvements, this release introduces smart assertions for ZIO Test. Smart assertions allow you to make assertions about expected behavior using ordinary Scala expressions that return Boolean values instead of specialized assertion operators.
For example, instead of this:
assert(Option(3))(isSome(equalTo(2)))You would do this:
assertTrue(Option(3).get == 2)These expressions will automatically be translated to provide detailed messages pointing you to exactly what went wrong if a test does fail.
We are currently making smart assertions available through the assertTrue operator along with the existing assertions. However, we are considering replacing the existing assertions entirely with smart assertions in ZIO 2.0 (with an automated migration tool) so we would appreciate any feedback you have on this new feature.
Thanks to @kitlangton for his work on this as well as to @girishkolantra for his work on implementing the string diffing functionality that is included with the new smart assertions.
And as always thanks to all of you for your continued support!
ZIO Core
- Implement Validate Variants for NonEmptyChunk (#5035) @adamgfraser
- Add Additional Operators to NonEmptyChunk (#5154) @adamgfraser
- Support Transforming TRef Values with STM effects (#5167) @adamgfraser
- Fix dead test (#5149) @kazchimo
- Implement ZManaged#firstSuccessOf (#5119) @adamgfraser
- clarify ZLayer.identity (in relation to >>> as opposed to ++) (#5143) @phderome
- Accessible trait rename and implicit hints (#5133) @kitlangton
- Implement ZIO.debug (#5131) @adamgfraser
- Implement Accessor trait for simple macro-less accessor methods (#5130) @kitlangton
- Implement ! As Symbolic Operator For orDie (#5128) @adamgfraser
- Generate accessors for "flat" service #3217 (#5122) @DmytroOrlov-flixbus
- Implement ZIO.exists, ZIO.forall, and ZIO.collectFirst (#5120) @adamgfraser
ZIO Stream
- Implement ZStream.fromHubManaged (#5048) @adamgfraser
- Add methods to access socket addresses on Connection (#5157) @searler
ZIO Test
- Support Converting ScalaCheck Generators To ZIO Test Generators (#5042) @adamgfraser
- Smart assertions (#5036) @kitlangton
- First cut of the Myers diff algorithm (#5158) @girishkolantra
- Implement Refined Gen instances (#4602) (#5144) @kazchimo
- Javatime generators (#5082) @igrebenik
- feat(zio-test): include duration in JUnit test reports (#4972) @MichalPawlicki
1.0.8
This release contains support for Scala 3 on both the JVM and Scala.js platforms.
ZIO Core
- Add ZIO#tapEither and tests (#5105) @2ne1ugly
- Fix publishing on Scala 3 + Scala.js (#5104) @ghostdogpr
- Upgrade to Scala 3 and publish for Scala.js (#5101) @ghostdogpr
- Docs: Fixing misc typos (#5098) @hmemcpy
- prefer def over val for abstract data members (#5060) @phderome
- eg over ie (wording) (#5059) @phderome
- add support for validatePar_ and validate_ (#5054) @phderome
- Docs: fixing dead links (#5043) @hmemcpy
- Expose Error Type In Console Operators (#5034) @adamgfraser
- Contextual Data Types Documentation (#5003) @khajavi
- Add updateLocally & updateSomeLocally (#5030) @kitlangton
- Update README.md (#5024) @apeshimam
- Handle careless use in bracket (#4961) @regiskuckaertz
- Fix inference issue with FunctionToLayerOps (#5019) @kitlangton
ZIO Streams
- Implement ZStream.fromBlockingIterator (#5067) @luis3m
- Update Documentation Regarding ZStream#runHead (#5078) @adamgfraser
- Implement ZStream#lock (#5068) @adamgfraser
- Remove dead links in documentation - howto mock section (#5008) @esthomw
- Fix broken stream page (#5023) @khajavi
- Fix aggregateAsyncWithinEither schedule behavior (#5017) @luis3m
ZIO Test
- Add test assertions for infinite/nan values (#5049) @fsarradin
- Test layer is not shared between tests anymore (#5016) @fokot
1.0.7
This release contains support for Scala 3.0.0-RC3. It is binary compatible with v1.0.0.
Notable changes
ZIO Core
- Scala 3.0.0-RC3 (#5005) @sideeffffect
- Revert "Support use of @accessible macro with implicits (#4466)" (#5001) @nadenf
- Resource Safety Documentation (#4978) @khajavi
- Introduction page for ZIO STM (#4957) @khajavi
- Back Port STM Bug Fix (#4964) @adamgfraser
- Update ZIO Talks (#4958) @khajavi
- Implement SingleThreadedRingBuffer#toChunk (#4951) @adamgfraser
- introduction page for concurrency primitives. (#4934) @khajavi
ZIO Streams
- Supporting Chunking in ZStream.fromIterator (#4834) @adamgfraser
ZIO Test
- Fix WhitespaceChars Generator (#4999) @adamgfraser
- ZIO Test: Annotate Timing On Test Failure (#4988) @adamgfraser
- Fix mock combinators with atMost 0 (#4986) @jupposessho
1.0.6
This release brings support for Scala 3.0.0-RC2 as well as a variety of bug fixes and other improvements.
In particular, this is the first release to include features back ported from ZIO 2.0 with the addition of ZHub, a new concurrent data structure supporting extremely fast broadcast operations. ZHub now powers the broadcast operators in ZStream and the SubscriptionRef data type, as well as being available as a standalone data structure. Check out the documentation for additional information and please let us know what you think!
This release is binary compatible with v1.0.0.
Notable changes
ZIO Core
- Implement serviceWith (#4937) (by @kitlangton)
- Make ZHub A Sealed Abstract Class For Improved Binary Compatibility (#4925) (by @adamgfraser)
- Fix array reference in foldWhileM (#4929) (by @mikearnaldi)
- fix typeCheck macro expansion should use fully qualified names (#4928) (by @TobiasPfeifer)
- Make Hub Serializable (#4920) (by @adamgfraser)
- Reimplement SubscriptionRef in Terms of ZHub (#4916) (by @adamgfraser)
- Make Values In Bootstrap Runtime Lazy (#4917) (by @adamgfraser)
- Annotation for throwing (#4837) (by @octavz)
- Use modern sbt conventions (#4915) (by @sideeffffect)
- Optimize Hub Implementations (#4913) (by @adamgfraser)
- WIP: Documentation (#4872) (by @khajavi)
- Back Port ZHub To ZIO 1.0 (#4900) (by @adamgfraser)
- Implement noneOrFail #4841 (#4851) (by @tyrcho)
- Scala 3.0.0-RC2 (#4874) (by @sideeffffect)
- Update future.md (missing logging/println) (#4831) (by @phderome)
- Add Simple ZIO ScalaJS Skeleton to learning resources (#4878) (by @sb-dev)
- Die In Bounded Parallelism Operators If Maximum Parallelism Is Less Than One (#4875) (by @adamgfraser)
- Update scala-java-time versions in docs (#4871) (by @kitlangton)
- Data type organization (#4824) (by @khajavi)
- typo correction in README (#4860) (by @softinio)
- Add Type Alias For Intersection Types On Scala 2 (#4845) (by @adamgfraser)
- Add ZSTM.collectAll for Option (#4846) (by @mijicd)
- Implement ZIO#debug and related methods (#4818) (by @kitlangton)
- Rename await variable to prevent JS exceptions (#4843) (by @nightscape)
- fix zipPars doc (#4842) (by @kazchimo)
- Add type-inferrable toLayer extension on functions (#4811)(by @kitlangton)
- Add migrating from Monix guide (#4822) (by @kitlangton)
- add alias for CompletableFuture (#4836) (by @sken77)
- Correctly Handle Queue#TakeUpTo Int.MaxValue (#4833) (by @adamgfraser)
- Implement Random.nextUUID (#4828) (by @adamgfraser)
- Fix doc (#4821) (by @kazchimo)
- Added new resources to docs (#4817) (by @softinio)
- Replace buildFromAny with buildFromNothing (#4815) (by @joroKr21)
- Handle Interruption After Fatal Error In FiberContext (#4812) (by @adamgfraser)
- Implement ZManaged.blocking (#4807) (by @adamgfraser)
- Add missing lift combinators for ZManaged (#4798) (by @ioleo)
- Support use of @accessible macro with implicits (#4466) (#4467) (by @nadenf)
- Remove Test Dependency From ZIO Macros (#4795) (by @adamgfraser)
ZIO Streams
- Add Documentation Regarding SubscriptionRef (#4944) (by @adamgfraser)
- Simplify Signature of ZStream#broadcastDynamic (#4946) (by @adamgfraser)
- Handle Concurrent Unsubscribes in SubscriptionRef (#4940) (by @adamgfraser)
- ZIO Stream: Implement ZStream#changes (#4697) (by @adamgfraser)
ZIO Test
- Support adding aspects to top level suite in MutableRunnableSpec (#4838) (by @vladimirkl)
- ZIO Test: Implement Gen#concatAll (#4801) (by @adamgfraser)
1.0.5
This maintenance release contains support for Scala 3.0.0-RC1 as well as improved support for Scala Native and various bug fixes. This release is binary compatible with v1.0.0.
Notable changes
ZIO Core
- Update to Scala 2.13.5 and 3.0.0-RC1 (#4770) (by @sideeffffect)
- Fix TMap.toChunk ArrayIndexOutOfBoundsException (#4776) (by @alextoth)
- Fix deprecated empty argument list auto-application in macros (#4773) (by @ioleo)
- Optimize ZIO.forkAll (#4764)(by @adamgfraser)
- Add ZIO#tapSome (#4676) (by @kubukoz)
- assertCompletesM (#4740) (by @emarx)
- Flatten exit in supervisor unsafeOnEnd (#4752) (by @mikearnaldi)
- Cleanup useless type parameter (#4738) (by @regiskuckaertz)
- Implement ZIO#cachedInvalidate (#4710) (by @adamgfraser)
- Check That Both Queues Are Shutdown In Implementation of isShutdown in Queue#bothWithM (#4635) (by @adamgfraser)
- Allow chaining multiple aspects to MutuableRunnableSpec suite (#4703) (by @hmemcpy)
- Implement ZQueue#filterOutput (#4639) (by @adamgfraser)
- Retrieve Current Executor in ZIO#runtime and ZIO#executor (#4660) (by @adamgfraser)
- Implement ZManaged.lock (#4662) (by @adamgfraser)
- Fix error in Chunk#zipWithIndex (#4675) (by @simpadjo)
- Prevent Interruption During Queue Shutdown (#4644) (by @adamgfraser)
- Improve Scala Native integration (#4653) (by @lolgab)
- Deprecate ZQueue#both Operators (#4638) (by @adamgfraser)
ZIO Streams
ZIO Test
- Add support for polymorphic service types to mockable macro (#4718) (by @ollyw)
- Retain object body when using @mockable (#4716) (by @ollyw)
- Extract Gen implement (#4742) (by @jxnu-liguobin)
- Upstream Generators From ZIO Test Refined Module(#4723) (by @maxim092001)
- Implement Gen#collect (#4668) (by @adamgfraser)
- ZIO test sbt runner for Scala Native (#4671) (by @sideeffffect)
- ZIO Mock: Empty mock services asserting no calls are made to them (#4673) (by @ioleo)
v1.0.4-2
This minor release contains a fix to a dependency issue regarding the SBT test runner for ZIO Test . Upgrading is recommended for all users. This release is binary compatible with v1.0.0.