scala-uri icon indicating copy to clipboard operation
scala-uri copied to clipboard

Split library into `scala-uri-core` and `scala-uri-cats`

Open jdrphillips opened this issue 2 years ago • 4 comments

Description

I would like the library split into two - one for the core functionality and one for the cats instances.

I cannot upgrade to scala-uri:4.0.0 due to the inclusion of cats:2.7.0 which at the moment is incompatible with my project. It seems the inclusion of a URI library in your project should be orthogonal to the inclusion of Future applicative instances from cats, for example.

jdrphillips avatar Feb 25 '22 14:02 jdrphillips

Just FYI I can choose to exclude the transitive dependency, and as long as I don't use any scala-uri cats functionality it should work

jdrphillips avatar Feb 25 '22 15:02 jdrphillips

Thanks for raising this. Agree that it makes sense to put the cats instances in a separate library that users can optionally add to their project.

What makes this a little more complicated is, since 4.0.0 scala-uri uses cats-parse to perform the URL parsing itself, so has a transitive dependency on cats.

We moved from parboiled2 to cats-parse in order to support scala3. At the time I didn't think parboiled2 was going to get published for scala3 (although thanks to some great work from the community over there it actually looks like it did 2 days ago).

So moving forward I'm thinking the options are:

  • Stick with cats-parse, but make the internal URL parser usage of cats use a shaded version of cats-parse/cats to remove any classpath clash (note: the separate scala-uri-cats library would need to have a regular non-shaded cats dependency)
  • Move back to parboiled2?

I'm not sure at the moment and need to spend some time weighing up the options, but if anyone has any opinions feel free to post here!

theon avatar Feb 26 '22 09:02 theon

That makes sense. Using cats-parse makes sense too if it does what you need. If it's possible to shade the cats dependency that would be great. That would decouple you from the upgrade chain in client projects, and allow people to upgrade you and cats independently when required.

I'm not sure how much of a pain that would be.

jdrphillips avatar Feb 28 '22 07:02 jdrphillips

I'm using this library with ZIO so removing cats dependency has a lot of sense for me

carlos-verdes avatar Oct 19 '22 09:10 carlos-verdes