Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to cats-effect v3.1.1, preparing for sbt v1.5 #1166

Conversation

rtyley
Copy link
Contributor

@rtyley rtyley commented Jul 11, 2021

The new, stricter eviction logic in sbt v1.5 (see sbt/sbt#6221) spotted that the versions of cats-effect used by Scanamo were suspected to be binary incompatible:

[error] (zio / update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error]
[error] 	* org.typelevel:cats-effect_2.12:3.1.1 (early-semver) is selected over 2.5.1
[error] 	    +- org.scanamo:scanamo-zio_2.12:1.0.0-M15+101-13c581a6-SNAPSHOT (depends on 3.1.1)
[error] 	    +- co.fs2:fs2-core_2.12:3.0.3                         (depends on 3.1.1)
[error] 	    +- org.typelevel:cats-effect_2.12:2.5.1               (depends on 2.5.1)
[error]
[error]
[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel

Upgrading to use cats-effect v3.1.1 for consistency meant:

The new, stricter eviction logic in sbt v1.5 (see
sbt/sbt#6221) spotted that the version of
`cats-effect` used by Scanamo were suspected to be binary incompatible:

```
[error] (zio / update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error]
[error] 	* org.typelevel:cats-effect_2.12:3.1.1 (early-semver) is selected over 2.5.1
[error] 	    +- org.scanamo:scanamo-zio_2.12:1.0.0-M15+101-13c581a6-SNAPSHOT (depends on 3.1.1)
[error] 	    +- co.fs2:fs2-core_2.12:3.0.3                         (depends on 3.1.1)
[error] 	    +- org.typelevel:cats-effect_2.12:2.5.1               (depends on 2.5.1)
[error]
[error]
[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel

```

Upgrading to use cats-effect v3.1.1 for consistency meant:

* Using `async_` rather than `async` (which has an updated method
  signature that supports cancellation) - see
  https://typelevel.org/cats-effect/docs/migration-guide#async
* Using `cats.effect.unsafe.implicits.global` in tests, where no
  `IORuntime` was available - an alternative way to do this would be
  using https://github.com/typelevel/cats-effect-testing/#scalatest
  See also https://typelevel.org/cats-effect/docs/migration-guide#io
@rtyley rtyley mentioned this pull request Jul 11, 2021
@regiskuckaertz regiskuckaertz merged commit 777bc26 into master Jul 11, 2021
@regiskuckaertz regiskuckaertz deleted the upgrade-cats-effect-to-remove-eviction-error-in-sbt-v1.5 branch July 11, 2021 17:01
rtyley added a commit that referenced this pull request Aug 14, 2021
This change updates to the latest version of `fs2-core`, which is now
compatible with `cats-effect` v3.1.1 (introduced in
#1166). Unfortunately there's not
yet a version of `monix` that supports `cats-effect` v3.1.1, so we're
dropping support for Monix for now - the actual implementation code
within Scanamo for the Monix support is only 4 lines, so can probably be
easily copied into an end-user project if it's needed!

Sbt is capable of warning us about version conflicts in dependencies, but
gave no warning of the `cats-effect` version conflict, I think because
the `fs2-core` & `monix` dependencies were marked as already `Provided`.
My guess as to why the `Provided` marker was used is that the
`scanamo-cats-effect` artifact gave support for both `fs2-core` & `monix`,
but in general a consuming project is likely to only be using one of
those - by declaring the two dependencies as `Provided`, neither will be
implicitly pulled in as a transitive dependency of `scanamo-cats-effect`
when used in the end-user project- giving the end-user-project freedom to
just explicitly declare a dependency on the one they want to use. As we've
dropped Monix support, and there's now only `fs2-core` support, I've
changed the `fs2-core` dependency to be explicit, which will give us the
benefit of sbt version-conflict warnings in future.

See #1184
regiskuckaertz pushed a commit that referenced this pull request Aug 15, 2021
…1187)

This change updates to the latest version of `fs2-core`, which is now
compatible with `cats-effect` v3.1.1 (introduced in
#1166). Unfortunately there's not
yet a version of `monix` that supports `cats-effect` v3.1.1, so we're
dropping support for Monix for now - the actual implementation code
within Scanamo for the Monix support is only 4 lines, so can probably be
easily copied into an end-user project if it's needed!

Sbt is capable of warning us about version conflicts in dependencies, but
gave no warning of the `cats-effect` version conflict, I think because
the `fs2-core` & `monix` dependencies were marked as already `Provided`.
My guess as to why the `Provided` marker was used is that the
`scanamo-cats-effect` artifact gave support for both `fs2-core` & `monix`,
but in general a consuming project is likely to only be using one of
those - by declaring the two dependencies as `Provided`, neither will be
implicitly pulled in as a transitive dependency of `scanamo-cats-effect`
when used in the end-user project- giving the end-user-project freedom to
just explicitly declare a dependency on the one they want to use. As we've
dropped Monix support, and there's now only `fs2-core` support, I've
changed the `fs2-core` dependency to be explicit, which will give us the
benefit of sbt version-conflict warnings in future.

See #1184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants