Zio-py

Latest version: v0.0.16

Safety actively analyzes 630305 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 20

2.0.4

This release brings a range of bug fixes, performance improvements and new features. Most notably:

1. **Regional Metric Tags.** This feature enables you to locally, either at the level of your main function, or any other level, add a set of tags to all ZIO metrics. This is convenient for tagging metrics based on web server or other parameters.
2. **Disable Work Stealing**. Work stealing degrades performance without a large stack size, so the optimizationo is disabled by default. You should notice improved performance versus 2.0.3.
3. **Add Integrated Config**. ZIO 2 now directly supports both defining configuration, as well as loading it from a configuration provider. Two built in configuration providers are based on environment variables and system properties.
4. **Metric Listeners**. For better integration with monitoring solutions such as DataDog, you can now install a metric listener for fine-grained (non-snapshot) based metric update notifications.

What's Changed

* Fix Flaky Test (7538) adamgfraser
* Metric listeners (7474) petoalbert
* ZIO Test: Scope Dependencies of Shared Service to Lifetime of Suite (7533) adamgfraser
* Micro-optimization for Schedule (7532) ollyw
* ZIO Stream: Execute Acquire Uninterrupibly (7527) adamgfraser
* Fixing iterate example and adding repeat example (7524) michelchan
* Make Tags A Region Setting (7498) adamgfraser
* Use Specific Versions for Docs Dependencies (7523) khajavi
* Turn on config (+ final tweaks) (7522) jdegoes
* Disable Work Stealing By Default (7519) adamgfraser
* Propagate Defects In ZStreamtoQueueOfElements (7520) adamgfraser
* Website: Integrate Some Other Official Libraries (7516) khajavi
* ignoreLogged does not log fix (7515) piotrga
* Print test timing annotation before failures (7509) swoogles
* Fix Intellij assertion failure link click behavior (7512) swoogles
* Website: Integrate zio-logging and zio-connect Documents (7507) khajavi
* fix typo (7508) markusheilig
* Preserve Cause in ZIOrefineToOrDie (7504) adamgfraser
* Extend documentation for `jittered` (7505) erikvanoosten
* Update manual-layer-construction.md (7502) ouertani
* Prevent Extremely Large Stack Traces (7501) adamgfraser
* Optimize Zlayer >+> (7500) adamgfraser
* Make Secret Package Private (7492) adamgfraser
* Yield After Repeatedly Generating Stack Traces (7495) adamgfraser
* Upgrade Binary Compatibility Version (7491) adamgfraser
* Upgrade Izumi Reflect Version (7490) adamgfraser

2.0.3

This release contains a variety of optimizations and bug fixes. In particular asynchronous operations in the runtime are significantly faster based on work by [jdegoes](https://github.com/jdegoes). As always, thanks for using ZIO and we're so excited to see everything that you are building with ZIO!

Performance Improvements

The performance of many core operations, including interruptible async operations and joining fibers, have been greatly improved, by a combination of micro-optimization and interning. A new "gen 3" optimization allows the ZIO 2 runtime system to avoid stack unwinding for fast asynchronous operations, and work stealing enables one run loop suspended by an async operation to steal a bit of work on behalf of another fiber. The weak concurrent bag for root fibers has been completely re-written with massive performance improvements in forkDaemon-heavy scenarios. Overall, these performance improvements make the ZIO 2 runtime system faster than it's ever been.

Future areas of improvement include additional micro-optimizations in the runtime system, lower overhead for the fiber actor machinery, and intelligent auto-tuning for JVM stack or reified stack run modes.

2.0.2

This release contains a fix for an issue that could cause a memory leak for some ZIO Kafka users.

It also removes all ZIO Test services from the environment. This change brings ZIO Test in line with ZIO and frees up the environment to be used exclusively by user defined services. The main impact of this change is that you never have to "leave behind" the `TestEnvironment` and all usages of `provideCustom(layer)` can be replaced by `provide(layer)`. All references to ZIO Test services in the environment can be deleted. So for example `Gen[Sized, A]` can be rewritten as`Gen[Any, A]`.

What's Changed
* Improve Randomness Of TestAspect.nondeterministic by adamgfraser in https://github.com/zio/zio/pull/7220
* Fix unsafeCompat deprecated since version by swoogles in https://github.com/zio/zio/pull/7223
* Bunch of fixes to the documentation. by Wosin in https://github.com/zio/zio/pull/7225
* Modify smart assertion to handle nulls correctly. by Wosin in https://github.com/zio/zio/pull/7226
* Documentation: Reorganize Property Testing Section by khajavi in https://github.com/zio/zio/pull/7231
* Documentation: New Section on Dependency Injection by khajavi in https://github.com/zio/zio/pull/7204
* Align Cron Like Schedules by adamgfraser in https://github.com/zio/zio/pull/7212
* Fix ZIOtapSomeError Type Signature And Update Binary Compatibility Version by adamgfraser in https://github.com/zio/zio/pull/7222
* Remove Finalizer From Scope When Fiber Completes Execution by adamgfraser in https://github.com/zio/zio/pull/7234
* Implement ZStreamchunksWith by adamgfraser in https://github.com/zio/zio/pull/7116
* Fix schedule docs typo by mijicd in https://github.com/zio/zio/pull/7245
* Documentation: Dynamic Test Generation by khajavi in https://github.com/zio/zio/pull/7246
* ZIO Test: Include Console Output In Test Summary by adamgfraser in https://github.com/zio/zio/pull/7252
* Fix Flaky Stream Test by adamgfraser in https://github.com/zio/zio/pull/7254
* Interrupt Children in ZIOraceWith by adamgfraser in https://github.com/zio/zio/pull/7253
* Documentation: Fix Publishing Error on Dynamic Test Generation by khajavi in https://github.com/zio/zio/pull/7255
* Add more bounded generators for time variations (7249) by jdsalchow in https://github.com/zio/zio/pull/7250
* Documentation: Reorganize ZIO Streams by khajavi in https://github.com/zio/zio/pull/7238
* ZIO Stream: Eagerly Release Resources in ZStream.aggregateAsync by adamgfraser in https://github.com/zio/zio/pull/7256
* ZIO Test: Implement TestAspect.silentLogging by adamgfraser in https://github.com/zio/zio/pull/7248
* Delete ZIO Test Services From Environment by adamgfraser in https://github.com/zio/zio/pull/7243
* fix 7258 add ZSinkensuring by robmwalsh in https://github.com/zio/zio/pull/7259
* Documentation: Make All Introduction Titles Consistent and SEO Friendly by khajavi in https://github.com/zio/zio/pull/7247
* Accept Unsafe Capability Implicitly in Fiber.currentFiber by adamgfraser in https://github.com/zio/zio/pull/7261
* docs: Typo by ouertani in https://github.com/zio/zio/pull/7267
* docs : Typo hide comment by ouertani in https://github.com/zio/zio/pull/7268
* doc: just update a version by ouertani in https://github.com/zio/zio/pull/7269
* docs: Just update version by ouertani in https://github.com/zio/zio/pull/7270
* Update installation.md by amiralies in https://github.com/zio/zio/pull/7271
* Handle Fatal Errors by adamgfraser in https://github.com/zio/zio/pull/7262

New Contributors
* amiralies made their first contribution in https://github.com/zio/zio/pull/7271

**Full Changelog**: https://github.com/zio/zio/compare/v2.0.1...v2.0.2

2.0.1

This release contains miscellaneous bug fixes.

What's Changed
* Add Prezi to adopters list by bmateusz in https://github.com/zio/zio/pull/6864
* Fix ZIO 1.x sidebars by khajavi in https://github.com/zio/zio/pull/6863
* issue 5878 - Backport ThreadLocalBridge by dkarlinsky in https://github.com/zio/zio/pull/5980
* add 7 and 8 arg for check, checkM, checkAll and checkAllM by strokyl in https://github.com/zio/zio/pull/6916
* Fix frontmatters by vigoo in https://github.com/zio/zio/pull/6949
* Series2.x/consolidate docs by atooni in https://github.com/zio/zio/pull/6952
* Remove provideCustom from migration guide by senia-psm in https://github.com/zio/zio/pull/6954
* Make docs jdk8 compatible by vigoo in https://github.com/zio/zio/pull/6955
* Series2/polish docs by atooni in https://github.com/zio/zio/pull/6973
* Get rid of the rest of the toSeconds by vigoo in https://github.com/zio/zio/pull/6975
* Update Migration Guide: Unsafe Marker by khajavi in https://github.com/zio/zio/pull/6972
* Remove Scope from writeFile Env by kitlangton in https://github.com/zio/zio/pull/6985
* Update cause.md by felix-hedenstrom in https://github.com/zio/zio/pull/6988
* Fix trigger branches by mijicd in https://github.com/zio/zio/pull/6989
* Replace References To Transducer With Pipeline by adamgfraser in https://github.com/zio/zio/pull/6983
* Migration Guide: Runtimeunsafe* methods by khajavi in https://github.com/zio/zio/pull/6990
* Scala Native on Scala 3 by sideeffffect in https://github.com/zio/zio/pull/6310
* Fix sbt exit issue by kitlangton in https://github.com/zio/zio/pull/6995
* Add Remember The Milk to adopters list. by omarkilani in https://github.com/zio/zio/pull/6993
* Scala Native 0.4.5 by sideeffffect in https://github.com/zio/zio/pull/6996
* Migration Guide Cleanup by khajavi in https://github.com/zio/zio/pull/7001
* Fix scaladoc for FiberRef by landlockedsurfer in https://github.com/zio/zio/pull/6997
* Make Migration Guide Regarding unsafe Methods More Accurate by khajavi in https://github.com/zio/zio/pull/7005
* Unify Unsafe Operators by adamgfraser in https://github.com/zio/zio/pull/7010
* Tutorial: How to Run Our First ZIO Project With IntelliJ IDEA? by khajavi in https://github.com/zio/zio/pull/7014
* Update MIMA Version by adamgfraser in https://github.com/zio/zio/pull/6977
* Compile tests on Scala Native by sideeffffect in https://github.com/zio/zio/pull/6283
* Update REPL Settings by adamgfraser in https://github.com/zio/zio/pull/6981
* Fix multiple acquire-releases in ZIOSpecAbstract by kitlangton in https://github.com/zio/zio/pull/7020
* Remove Renovate by adamgfraser in https://github.com/zio/zio/pull/6984
* Fix `ZIOApp<>` producing an invalid tag by neko-kai in https://github.com/zio/zio/pull/7026
* Merge 1.x to 2.x by sideeffffect in https://github.com/zio/zio/pull/7021
* Scala Native: compile and package as JS and JVM by sideeffffect in https://github.com/zio/zio/pull/7027
* izumi-reflect 2.1.3 (series/1.x) by sideeffffect in https://github.com/zio/zio/pull/7025
* Revert "Merge 1.x to 2.x (7021)" by sideeffffect in https://github.com/zio/zio/pull/7033
* Rts work by jdegoes in https://github.com/zio/zio/pull/7034
* Use Report Fatal by adamgfraser in https://github.com/zio/zio/pull/7028
* Improve ZEnvironment Rendering by adamgfraser in https://github.com/zio/zio/pull/7018
* Merge 1.x to 2.x (second try) by sideeffffect in https://github.com/zio/zio/pull/7036
* Rewrite overview by jdegoes in https://github.com/zio/zio/pull/7035
* Implement ZEnvironment Apply With No Arguments by adamgfraser in https://github.com/zio/zio/pull/7017
* Documentation: Sharing Services Between Multiple Specs by khajavi in https://github.com/zio/zio/pull/6999
* Increase swap size as a safety net in case of sudden surge of memory demand by sideeffffect in https://github.com/zio/zio/pull/7043
* "Runtime" entry already appears in "Core Data Types" list by bataillec in https://github.com/zio/zio/pull/7038
* Preserve Throwable Stack Trace by adamgfraser in https://github.com/zio/zio/pull/7016
* Build all projects for Scala Native by sideeffffect in https://github.com/zio/zio/pull/7048
* Pull out some non-essential pieces of the Shared Layer examples by swoogles in https://github.com/zio/zio/pull/7040
* Doc: Scala 3.x instead of dotty by ouertani in https://github.com/zio/zio/pull/7051
* Doc: input is the event param by ouertani in https://github.com/zio/zio/pull/7050
* Reverse arrow direction in Layer Mermaid diagram by swoogles in https://github.com/zio/zio/pull/7047
* Make `ZChannelembedInput` Private by khajavi in https://github.com/zio/zio/pull/7052
* Doc fix for Rezilience - libraryDependencies by m-kalai in https://github.com/zio/zio/pull/7055
* Allow aspects to be used by ZStreams using by calvinlfer in https://github.com/zio/zio/pull/7042
* Backport 6743 to 1.x by kubukoz in https://github.com/zio/zio/pull/6991
* Fix missing trace information when throwing outside of ZIO.attempt by kitlangton in https://github.com/zio/zio/pull/6994
* Fix SmartAssertionOps match for Scala 3.1.3 by andrzejressel in https://github.com/zio/zio/pull/7057
* Log Errors Inside Scope Of Bootstrap Layer In ZIOApp by adamgfraser in https://github.com/zio/zio/pull/7046
* Cleanup Migration Guide: Monix and Cats Effect by khajavi in https://github.com/zio/zio/pull/7062
* Update Migration Guide Regarding `ZIO.access` and `ZIO.fromFunction` by khajavi in https://github.com/zio/zio/pull/7061
* Update zio-config version number by DaniRey in https://github.com/zio/zio/pull/7059
* Tutorial: How to Debug a ZIO Application? by khajavi in https://github.com/zio/zio/pull/7060
* CI: split compile step by Scala version by sideeffffect in https://github.com/zio/zio/pull/7049
* Documentation of ZChannel by khajavi in https://github.com/zio/zio/pull/7041
* Documentation: Remove Built-in Services From Examples by khajavi in https://github.com/zio/zio/pull/7030
* Add fail-fast assertion to ZIO test by guersam in https://github.com/zio/zio/pull/6923
* Update Documentation For ZIO.suspendSucceed by adamgfraser in https://github.com/zio/zio/pull/7070
* Fix Typo In Documentation by adamgfraser in https://github.com/zio/zio/pull/7071
* Remove Observer If Awaiting Fiber Is Interrupted by adamgfraser in https://github.com/zio/zio/pull/7069
* Start Test Clock Warning When Time Is Accessed by adamgfraser in https://github.com/zio/zio/pull/7054
* Start Test Clock Warning When Time Is Accessed by adamgfraser in https://github.com/zio/zio/pull/7073
* Redo concurrency section by jdegoes in https://github.com/zio/zio/pull/7039
* Make ZIO Mock Documentation Accessible by khajavi in https://github.com/zio/zio/pull/7075
* Documentation: Rename "Data Types" to "References" and "ZIO Test" to "Testing" by khajavi in https://github.com/zio/zio/pull/7076
* Documentation: Add Installation Section for ZIO Concurrent by khajavi in https://github.com/zio/zio/pull/7077
* Prevent Snippet Evaluation by khajavi in https://github.com/zio/zio/pull/7080
* Remove Spurious Warning by adamgfraser in https://github.com/zio/zio/pull/7083
* Remove Debug Statements by adamgfraser in https://github.com/zio/zio/pull/7081
* Update contributing.md by ouertani in https://github.com/zio/zio/pull/7086
* Documentation: Update Index Page of The Reference Section by khajavi in https://github.com/zio/zio/pull/7087
* Publish Sets To SubscriptionRef by adamgfraser in https://github.com/zio/zio/pull/7088
* Separate unidoc and mdoc Commands by khajavi in https://github.com/zio/zio/pull/7092
* Upgrade: sbt version from 1.6.2 -> 1.7.1 silencer and scala 2.12 by ouertani in https://github.com/zio/zio/pull/7090
* Tutorial: How to Build a RESTful Web Service by khajavi in https://github.com/zio/zio/pull/7065
* Add Documentation To Contributors Guide Regarding Unsafe by adamgfraser in https://github.com/zio/zio/pull/7078
* Upgrade: scala version from 3.1.2 -> 3.1.3 by ouertani in https://github.com/zio/zio/pull/7089
* Make Unsafe Operators Package Private by adamgfraser in https://github.com/zio/zio/pull/7079
* Remove unidoc Command Temporary by khajavi in https://github.com/zio/zio/pull/7093
* Do Not Inherit InterruptedCause On Fork by adamgfraser in https://github.com/zio/zio/pull/7094
* Implement Schedulepassthrough by adamgfraser in https://github.com/zio/zio/pull/7095
* Add methods to convert `Chunk[Byte]` and `Chunk[Char]` to a string by 987Nabil in https://github.com/zio/zio/pull/7023
* Increase Heap Size by khajavi in https://github.com/zio/zio/pull/7096
* Fix Website Build Errors by khajavi in https://github.com/zio/zio/pull/7097
* Make `Chunk.IsText` serializable by extending `Serializable` by 987Nabil in https://github.com/zio/zio/pull/7099
* Check The Whole Website on Pull Requests by khajavi in https://github.com/zio/zio/pull/7098
* Merge 1.x to 2.x / July by sideeffffect in https://github.com/zio/zio/pull/7100
* Make Tutorials Type-Safe by khajavi in https://github.com/zio/zio/pull/7091
* Fix: `equalTo` compare CharSequence type by gciuloaica in https://github.com/zio/zio/pull/7104
* Fix Chunk Packed Boolean Hash Code by adamgfraser in https://github.com/zio/zio/pull/7109
* Prevent 2nd TestRunnerJVM instantiation causing a shutdown hook error by swoogles in https://github.com/zio/zio/pull/7110
* Tutorial: How to Build GraphQL Web Service by khajavi in https://github.com/zio/zio/pull/7112
* Improve Stack Traces Of Die Failures by adamgfraser in https://github.com/zio/zio/pull/7114
* Make ConcurrentMap.compute consistent with Java implementation by mhodovaniuk in https://github.com/zio/zio/pull/7106
* Documentation: Reorganize Sidebars by khajavi in https://github.com/zio/zio/pull/7113
* Preserve Cause In ZIOmapError by adamgfraser in https://github.com/zio/zio/pull/7122
* Clean docs space and links by ouertani in https://github.com/zio/zio/pull/7125
* Documentation: Replace DefaultRunnableSpec with ZIOSpecDefault in zio-test package docs by blaz-kranjc in https://github.com/zio/zio/pull/7126
* Fix ZStreammapZIOPar Implementation by adamgfraser in https://github.com/zio/zio/pull/7132
* ZLayer: Memoize FiberRef Values by adamgfraser in https://github.com/zio/zio/pull/7131
* Documentation: Simplify Conceptual Model of ZIO by khajavi in https://github.com/zio/zio/pull/7133
* Documentation: Add The State Management Section by khajavi in https://github.com/zio/zio/pull/7124
* Documentation: Write a Note on Runnable Tests by khajavi in https://github.com/zio/zio/pull/7140
* Spec layer initialization defects by swoogles in https://github.com/zio/zio/pull/7142
* Add Chunk Size Parameter To Additional Stream Constructors by adamgfraser in https://github.com/zio/zio/pull/7146
* Fix code block ending in migration guide by grouzen in https://github.com/zio/zio/pull/7145
* Fix MIMA Checks by adamgfraser in https://github.com/zio/zio/pull/7148
* Update Migration Guide: ZSpec by khajavi in https://github.com/zio/zio/pull/7155
* Fork friendly test output by swoogles in https://github.com/zio/zio/pull/7154
* Fix Link by adamgfraser in https://github.com/zio/zio/pull/7152
* Increase Resiliency Of Adaptive Scheduling For Occasional Slowdowns by adamgfraser in https://github.com/zio/zio/pull/7119
* Apply Fork Patch When A Fiber Is Unsafely Forked by adamgfraser in https://github.com/zio/zio/pull/7151
* fix: drop obsolete N in error message by aleksandr-vin in https://github.com/zio/zio/pull/7160
* README: Represent The Latest Snapshot Based on Scala 3 by khajavi in https://github.com/zio/zio/pull/7162
* Documentation: FiberRef Usecases by khajavi in https://github.com/zio/zio/pull/7149
* Documentation: Make Scheduling Section More Accessible by khajavi in https://github.com/zio/zio/pull/7139
* Doc: Fix typo in the ZLayer document by Al-assad in https://github.com/zio/zio/pull/7164
* Optimize PinchableArrayappendAll by adamgfraser in https://github.com/zio/zio/pull/7166
* Delete Extraneous Type Parameter by adamgfraser in https://github.com/zio/zio/pull/7129
* Handle Very Large Collections In ZStream.fromIterable by adamgfraser in https://github.com/zio/zio/pull/7161
* Documentation: Split Error Management Section Into Smaller Parts by khajavi in https://github.com/zio/zio/pull/7167
* Add refineOrDie and refineOrDieWith to ZSink by adrianfilip in https://github.com/zio/zio/pull/7165
* Preserve Uninterruptibility in ZIOtimeout by adamgfraser in https://github.com/zio/zio/pull/7171
* Fix typo in code example by kluen in https://github.com/zio/zio/pull/7176
* Documentation: Make Built-in services Section Top-level by khajavi in https://github.com/zio/zio/pull/7178
* Align Traces by adamgfraser in https://github.com/zio/zio/pull/7177
* Documentation: Restructure ZIO Testing by khajavi in https://github.com/zio/zio/pull/7179
* Update sampleprojects.md by psisoyev in https://github.com/zio/zio/pull/7183
* Optimize ZIO.collectAllPar For Very Small Collections by adamgfraser in https://github.com/zio/zio/pull/7135
* Update debug-a-zio-application.md by pooriatgh in https://github.com/zio/zio/pull/7181
* fix doc typos in several sections by tnielens in https://github.com/zio/zio/pull/7186
* Promote bootstrap layer sharing in migration guide by swoogles in https://github.com/zio/zio/pull/7187
* Documentation: Use Built-in Admonitions by khajavi in https://github.com/zio/zio/pull/7190
* ZIO Website: Add Google Analytics Support by khajavi in https://github.com/zio/zio/pull/7189
* Minor typo in failures.md document by jpablo in https://github.com/zio/zio/pull/7191
* Documentation: Make Service Pattern Section More Accessible by khajavi in https://github.com/zio/zio/pull/7194
* Documentation: Structured Concurrency and Background Processes by khajavi in https://github.com/zio/zio/pull/7188
* ZIO Website: Add GTag Support by khajavi in https://github.com/zio/zio/pull/7196
* Add tapSomeError function by dylandoamaral in https://github.com/zio/zio/pull/7193
* Update index.md by jon-strayer in https://github.com/zio/zio/pull/7205
* Implement ZChannelcontramapErr by adamgfraser in https://github.com/zio/zio/pull/7203
* Implement ZChannel.never by adamgfraser in https://github.com/zio/zio/pull/7208
* Capture and report test output for failures by swoogles in https://github.com/zio/zio/pull/7200
* Clarify Documentation Regarding FoldCauseZIO by adamgfraser in https://github.com/zio/zio/pull/7213

New Contributors
* bmateusz made their first contribution in https://github.com/zio/zio/pull/6864
* strokyl made their first contribution in https://github.com/zio/zio/pull/6916
* felix-hedenstrom made their first contribution in https://github.com/zio/zio/pull/6988
* omarkilani made their first contribution in https://github.com/zio/zio/pull/6993
* landlockedsurfer made their first contribution in https://github.com/zio/zio/pull/6997
* bataillec made their first contribution in https://github.com/zio/zio/pull/7038
* ouertani made their first contribution in https://github.com/zio/zio/pull/7051
* m-kalai made their first contribution in https://github.com/zio/zio/pull/7055
* andrzejressel made their first contribution in https://github.com/zio/zio/pull/7057
* DaniRey made their first contribution in https://github.com/zio/zio/pull/7059
* gciuloaica made their first contribution in https://github.com/zio/zio/pull/7104
* mhodovaniuk made their first contribution in https://github.com/zio/zio/pull/7106
* blaz-kranjc made their first contribution in https://github.com/zio/zio/pull/7126
* Al-assad made their first contribution in https://github.com/zio/zio/pull/7164
* pooriatgh made their first contribution in https://github.com/zio/zio/pull/7181
* jpablo made their first contribution in https://github.com/zio/zio/pull/7191
* dylandoamaral made their first contribution in https://github.com/zio/zio/pull/7193
* jon-strayer made their first contribution in https://github.com/zio/zio/pull/7205

**Full Changelog**: https://github.com/zio/zio/compare/v2.0.0...v2.0.1

2.0.0

The future of asynchronous and concurrent programming is finally here. We are excited to announce the release of ZIO 2.0!

Since we started on the journey to ZIO 2.0 we have focused on four key themes:

- **Performance** - Frameworks such as ZIO are the base layer that higher level solutions are built on so they must be extremely efficient so you can build high performance applications on top of them.
- **Developer Experience** - Just as important, you must be able to quickly and joyfully write clear, bug free code with ZIO.
- **Operations** - ZIO must scale with you to support the needs of the most complex industry scale application with support for logging, metrics, and execution tracing.
- **Streams** - Streaming is a fundamental paradigm for describing data flow pipelines and ZIO must provide support for it in a way that is both highly performant and deeply principled.

We believe we have achieved all of these goals to a greater extent than we could have hoped for when we started this journey.

These release notes will provide a high level overview of what we have done with regard to each of these points but when you are upgrading to ZIO 2.0 we would encourage you to check out the detailed migration guide available [here](https://zio.dev/guides/migrate/zio-2.x-migration-guide). The migration guide also contains information about the automated migration tool you can use to do most of the heavy lifting for you.

Performance

ZIO 2.0 ships with the first ever "third generation" runtime that breaks new ground, avoiding use of the JVM stack whenever possible. This delivers dramatically higher performance than other runtimes for synchronous code, as shown in the following benchmark between ZIO 1.0, Cats Effect 3, and ZIO 2.0 that is typically used to compare runtimes.


[info] Benchmark (depth) Mode Cnt Score Error Units
[info] ZIO 1.x 20 thrpt 20 647.268 ± 12.892 ops/s
[info] Cats Effect 3.x 20 thrpt 20 947.935 ± 124.824 ops/s
[info] ZIO 2 20 thrpt 20 1903.838 ± 21.224 ops/s


This runtime is highly optimized for Project Loom because in a post-Loom world there is never a need for asynchronous operations.

We will be continuing to optimize the performance of the new runtime for asynchronous operations and publish additional information regarding the new runtime. Until then, you can check out [this](https://degoes.net/articles/zio-2.0) blog post by John De Goes to learn more about the motivations and development process for the new runtime.

ZIO 2.0 also comes with a variety of other optimizations to improve performance of your application and prevent bottlenecks.

For example, appropriately managing blocking code is a typical "gotcha" for developers.

Runtimes such as ZIO typically perform all work on a small number of threads, typically equal to the number of operating system threads, to minimize contention and context switching. However, this means that if blocking work is inadvertently run on the core threadpool it can have a very negative impact on application performance, potentially resulting in deadlock.

ZIO 1.0 was the first runtime to provide tools to manage this through its `Blocking` service, which was later copied by other runtimes. However, this still required users to manually identify blocking work, which could be an error prone process, especially when legacy APIs did not clearly document blocking code.

ZIO 2.0 takes another giant leap forward here with the introduction of autoblocking. Now the ZIO runtime will automatically identify blocking work for you and safely shift it to a dedicated blocking thread pool. You can still use `ZIO.blocking` to provide a "hint" to the runtime that a certain section of code is blocking, but this is now merely an optimization. Early users have reported dramatic simplifications to their code by replacing all previous manual usages of blocking with this functionality.

Developer Experience

The speed of writing high quality code and onboarding developers can often be just as or more important than the speed of the code itself.

ZIO 1.0 broke new ground in developer productivity and teachability by taking a highly principled approach while eschewing unnecessary abstractions and jargon.

However, as we innovated in many areas in ZIO 1.0 such as the introduction of the environment type and support for dependency injection there were inevitably learning opportunities. We incorporated all that feedback and poured it back into ZIO 2.0 to make ZIO easier to use than ever before.

The area this is most visible is in the way you build your application’s required dependencies. This process is dramatically simplified in ZIO 2.0 with the deletion of the `Has` data type, automatic construction of layers, and a new more straightforward design pattern for defining layers.

scala
trait MyService {
def doSomething: ZIO[Any, MyDomainError, MyValue]
}

final case class MyServiceImplementation(dependency1: Dependency1, dependency2: Dependency2) extends MyService {
def doSomething: ZIO[Any, MyDomainError, MyValue] =
???
}

val layer: ZLayer[Dependency1 & Dependency2, Nothing, MyService] =
ZLayer {
for {
dependency1 <- ZIO.service[Dependency]
dependency2 <- ZIO.service[Dependency2]
... <- // do any necessary setup and finalization here
} yield MyServiceImplementation(dependency1, dependency2)


In this way, layers leverage everything you already know about constructor based dependency injection while giving you the ability to perform ZIO workflows to setup and finalize your services in a principled way.

Even better, once you define these layers you can use automatic layer construction to assemble them together with extremely helpful compiler messages to help you as you go.

scala
object MyApp extends ZIOAppDefault {

val myAppLogic: ZIO[MyService, Nothing, Unit] =
???

val run: ZIO[Any, Nothing, Unit] =
myAppLogic.provide(layer)
// compiler message guides you to provide layers for required dependencies
}


Another area where ZIO 2.0 is dramatically simplifying the user experience is around resources. ZIO 1.0 pioneered safe, powerful resource management with the `ZManaged` data type, which was the first to describe a resource as a value with powerful composition operators such as parallel acquisition of resources.

However, as great as `ZManaged` was, it was "one more thing to learn" and could create issues when users had to mix `ZIO` data types with `ZManaged` data types.

ZIO 2.0 makes this a thing of the past by deleting `ZManaged` and introducing the concept of a `Scope`, which is just something that we can add finalizers to and eventually close to run all those finalizers. A resource in ZIO 2.0 is now just represented as a scoped ZIO:

scala
val resource: ZIO[R with Scope, E, A] = ???


This is a workflow that requires a `Scope`, indicating that part of this workflow requires finalization and needs a `Scope` to add that finalizer to. To remove the requirement for a `Scope`, the equivalent of `ZManageduse` in ZIO 1.0, we simply use the `ZIO.scoped` operator:

scala
ZIO.scoped {
resource.flatMap(doSomethingWithIt)
}


In this way ZIO workflows that require finalization compose seamlessly with other ZIO workflows, because they all are just ZIO workflows. During the development process of ZIO 2.0 almost every ZIO ecosystem library has migrated to using scopes exclusively, typically resulting in dramatic simplifications to code.

We have also made significant efforts to simplify naming conventions, focusing on consistency of naming and accessibility.

For example, the constructor for creating a `ZIO` from a block of code that could throw exceptions was called `effect` in ZIO 1.0, which was really a holdover from a more Haskell / category theoretic perspective where throwing exceptions was a "side effect" versus a pure function (never mind that there are a variety of other "side effects" that do not consist of throwing exceptions).

In contrast, in ZIO 2.0 this constructor is simply called `attempt`. We "attempt" to do something which might fail, safely capturing the possibility of failure.

Similarly the constructor for creating a resource in ZIO 1.0 was `bracket`, which was another holdover from Haskell. While it has a certain metaphorical appeal (we are "bracketing" the use of a resource with acquire and release actions) it does not really tell us what is going on. In contrast in ZIO 2.0 this is called `acquireRelease`, saying precisely what it is.

Operations

While ZIO 2.0 makes it easier than ever to write correct code, it is inevitable in large applications that issues will arise, and you will need to be able to quickly diagnose and fix those issues.

ZIO 1.0 took significant steps to address these needs, including introducing asynchronous execution traces and providing support for logging and metrics through libraries such as ZIO Logging and ZIO Metrics.

However, there were some problems. While execution traces allowed you to see the trace for an asynchronous program in a way you never could before, traces could be hard to read and contained a lot of unnecessary information. Libraries such as ZIO Logging required you to add and integrate another dependency for what should be table stakes.

ZIO 2.0 is taking this to another level.

Execution traces now look just like JVM stack traces, letting you translate everything you know about reading stack traces into reading execution traces.

Logging is now build directly into ZIO so logging a line is as simple as:

scala
val myAppLogic: ZIO[Any, Nothing, Unit] =
ZIO.logInfo("Hello logging!")


Of course you can use operators like `logLevel`, `logSpan`, and `logAnnotate` just like you would with any other logging solution.

ZIO Logging is now focused on providing connectors to various existing logging frameworks, which can be installed with a single line of code.

scala
import zio.logging.backend.SLF4J

object MyApp extends ZIOAppDefault {
val bootstrap = SLF4J.slf4j(logLevel, logFormat, rootLoggerName)

val run =
myAppLogic


We have taken the same approach to metrics.

Defining a metric is as simple as:

scala
val counter = Metric.counter("myCounter")

val myAppcounter.increment


ZIO ZMX provides connectors to Metrics backends such as Prometheus, StatsD, and New Relic that you install with a single line of code just like you do for loggers.

ZIO also includes integrated fiber dumps you can get by simply calling `dump` on any fiber so when something is not working as expected you can see what a fiber is doing and what it is waiting on.

Streams

Streaming has been fundamental to ZIO since ZIO 1.0 and we are building in that commitment in ZIO 2.0 with a new, more principled encoding of streams.

As a user most operators work exactly the same way and if you are just using existing stream operators you shouldn't notice much difference other than more straightforward names as discussed above and the replacement of `ZTransducer` with `ZPipeline`.

However, if you are doing more advanced work with streams you will find that your life just got easier because under the hood streams, sinks, and pipelines are all the same data type!

scala
trait ZChannel[-Env, -InErr, -InElem, -InDone, +OutErr, +OutElem, +OutDone]]


A `Channel` is a description of a data transformation pipeline that requires an environment of type `Env` and accepts as input zero or more values of type `InElem` along with one terminal value of type `InErr` or `InDone`. It produces zero or more values of type `OutElem` along with one terminal value of type `OutErr` or `OutDone`.

In this way, you can think of a `Channel` as the functional version of a low level channel such as an asynchronous file channel or a generalization of a publisher and a subscriber in the Reactive Streams protocol.

The great thing is that we can use channels to describe streams, sinks, and pipelines.

scala
final case class ZStream[-R, +E, +A](channel: ZChannel[R, Any, Any, Any, E, Chunk[A], Any])


A stream is a producer that does not require any input but produces chunks of elements, terminating with either an error or an end of stream signal. It represents the "beginning" of a data transformation pipeline

scala
final case class ZSink[-R, +E, -In, +L, +Z](channel: ZChannel[R, ZNothing, Chunk[In], Any, E, Chunk[L], Z])


A sink accepts as inputs the chunks of elements produced by a stream and either produces a summary value or fails with an error, along with potentially emitting a chunk of leftovers not consumed by the sink. It represents the "end" of a data transformation pipeline.

scala
final case class ZPipeline[-Env, +Err, -In, +Out](channel: ZChannel[Env, ZNothing, Chunk[In], Any, Err, Chunk[Out], Any])


A pipeline consumes chunks of stream elements and emits new chunks of stream elements. It represents the "middle" of a data processing pipeline.

Streams, sinks, and pipelines are each their own data types so they have all the same powerful operators as they did in ZIO 1.0. But fundamentally they are all the same thing, which makes it much easier to compose them and makes it much easier for you to build your own solutions when you need to do something more advanced that integrated seamlessly with all the existing streaming data types.

Conclusion

We want to thank everyone who has used ZIO 1.0 or participated in the development process for ZIO 2.0 and given us feedback along the way. As is hopefully apparent here, many of the changes in ZIO 2.0 are based on your feedback.

When something isn't working, we strive to take that as feedback that "something is wrong with us" versus "something is wrong with you" and that doesn't stop today. The release of ZIO 2.0 is an important milestone that will help others start building even more amazing things on top of it.

But the development of ZIO is also an ongoing process and we will be working over the coming weeks and months to make ZIO even better based on your feedback. So please share your experiences upgrading to and working with ZIO 2.0 and we will continue to make it even better together.

Thank you all for your continued support and we hope you enjoy using ZIO 2.0 as much as we have enjoyed creating it.

2.0.0rc6

Given the changes since `RC5`, we are doing one more release candidate for ZIO 2.0. This release candidate brings the following changes.

Autoblocking

Blocking work will now automatically be identified and shifted to the blocking executor. You can continue to use operators like `blocking` to give a "hint" to the runtime that a particular operator is blocking for efficiency but this should no longer be needed for correctness. This is a new feature and a significant innovation so please report any issues!

Simplification Of Runtime Customization

The `RuntimeConfig` and `RuntimeConfigAspect` data types have been deleted. Instead, you can customize the runtime using layers. This allows you to use ZIO workflows in setting up your runtime, for example to load some configuration information using ZIO Config.

If you need to access information about the current configuration you can use more specialized operators such as `ZIO.logger` or `ZIO.executor`.

If you want to customize the runtime you can use basic layers defined in the `Runtime` companion object such as `addLogger` or ZIO ecosystem libraries will provide their own layers that do all necessary setup. The layer in `ZIOApp` has been renamed `bootstrap` to more clearly indicate this.

Other Simplifications

The type alias "companion objects" have been deleted. So instead of `Task.attempt(???)` do `ZIO.attempt(???)`. This promotes consistency and is one less thing to think about.

Variants of `acquireRelease` on the `ZIO` trait have been deleted in favor of the versions on the ZIO companion object. So instead of `acquire.acquireReleaseWith(release)(use)` do `ZIO.acquireReleaseWith(acquire)(release)(use)`. This is more idiomatic as constructors belong on the companion object and promotes consistency between different ways of using resources.

The `Accessible` trait has been deleted. This proved a relatively unpopular alternative to implementing accessors compared to just using the macro annotation in Scala 2 or defining them manually, which has become easier with automatic completion tools. We are continuing to explore solutions for replacing macro annotations on Scala 3.

The `Spec` data type has been simplified to "build in" the `TestFailure` data type. So if you ever did `layer.mapError(TestFailure.fail)` in your tests before you can delete that.

The `provideService` operator has also been deleted. Instead of `provideService(service)` do `provideLayer(ZLayer.succeed(service))`. Layers are the idiomatic way of providing ZIO workflows with their dependencies and this operator generally should not be needed anymore with the elimination of the default services from the environment.

Page 3 of 20

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.