samvera / bulkrax

Bulk Import and Export For Samvera
Apache License 2.0
12 stars 20 forks source link

Resolve gem version conflicts with Hyrax v4 #823

Open bkiahstroud opened 1 year ago

bkiahstroud commented 1 year ago

Story

Attempting to add Bulkrax to a Hyrax v4 application fails due to gem version errors. Specifically, for the dry-monads and bagit gems.

dry-monads error message ``` Could not find compatible versions Because every version of bulkrax depends on dry-monads ~> 1.4.0 and every version of hyrax depends on dry-monads ~> 1.5, every version of bulkrax is incompatible with hyrax >= 0. So, because Gemfile depends on hyrax >= 0 and Gemfile depends on bulkrax >= 0, version solving has failed. ```
bagit error message ``` Your bundle is locked to bagit (0.4.6) from rubygems repository https://rubygems.org/ or installed locally, but that version can no longer be found in that source. That means the author of bagit (0.4.6) has removed it. You'll need to update your bundle to a version other than bagit (0.4.6) that hasn't been removed in order to install. ```

These errors occurred on the following versions:

Resolving these errors is the first step in making Bulkrax compatible with Hryax v4 and is blocking many following tasks.

Acceptance Criteria

Testing Instructions

NOTE: These instructions assume you will be using Hyrax's .koppie app. They should apply to any Hyrax v4 app, but if you aren't using .koppie, you may need to slightly modify some of the commands.

_NOTE: If using .koppie for testing purposes, you will need to add libxml2-dev to the EXTRA_APK_PACKAGES variables in both Dockerfile and docker-compose-koppie.yml and rebuild the Docker image. See this PR for an example._

  1. Add gem 'bulkrax' to .koppie/Gemfile
  2. Run docker compose -f docker-compose-koppie.yml up
  3. Ensure all containers run with no bundler errors. Visit http://localhost:3001 to make sure the app spins up successfully.

Notes

The official bagit gem does not support Ruby 3.2, which Hyrax v4 requires. I found a fork that does support Ruby 3.2:

If this fork is used, testing should be done to ensure the Bagit importer still works as expected.

Related conversation in Slack: https://samvera.slack.com/archives/C03S9FS60KW/p1688779291516519

bbpennel commented 9 months ago

For what its worth, my understanding is that hyrax 4 only requires ruby >= 2.7, but their test matrix tests through 3.2. Hyrax 5 does require 3.2 though.

For our local repository, forking bulkrax and changing to s.add_dependency 'dry-monads', '~> 1.5.0' seems to resolve dependency issues when including bulkrax 5.3.0 in a hyrax 4 based repository using ruby 2.7 (oddly 5.2.1 did not have problems being included in the hyrax 4 based repo). Of course all the tests fail in bulkrax due with uninitialized constant Dry::Monads::Result::Transformer. I get the impression that dry-transactions v0.15.0 is supposed to resolve this issue https://github.com/dry-rb/dry-transaction/commit/4fbe3aea30e4293fceba74c6204ec82d993957e6 but if I set that in bulkrax then bundle update spins forever.

In actual usage in our hyrax 4 repository, Bulkrax seems to be functioning and I'm able to do a a csv based import of several dozen works, and then export it.

It also looks like since this issue was opened, the official bagit gem has released an update (0.4.6) with ruby 3.2 support.

bkiahstroud commented 9 months ago

This is great, thanks for the info @bbpennel!