Beanie 2.x support #18
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue: #16.
There already is a PR for supporting Beanie 2.x, but I'd argue that it's missing some important details.
First things first – supporting Beanie 2.x is important because the move they made that caused the major version bump is the right one. I am citing the README from the Motor repo:
That's what Beanie 2.x does.
The problem with the other PR is that it still uses Motor in the tests (see below) and the version range defined for the
beanie
dependency ("beanie >=1.11.0,<2.1.0"
) seems to be problematic:hatch run test
fails forbeanie >=1.11.0, <=1.19.0
(I realized after writing this PR that this has actually nothing to do with the changes made here – this seems to be an issue that's already present, so it's unrelated, but still important!), so Beanie support should start at1.20.0
. This version didn't contain official stable versions of the asyncronous API yet, but it seems to run just fine.< 2.1.0
doesn't seem to make any sense, as breaking changes in versions> 0.x
should always come with a major version bump and I'd trust the Beanie community to do so. Therefore, setting the dependency to"beanie >=1.20.0,<3.0.0"
seems to be the way to go. BTWbeanie 1.20.0
is more than two years old right now, so I don't think we're cutting off any significant amounts of projects, here.As I mentioned above, the test cases are explicitly using modules from the Motor package which will soon be EOL and Beanie stops using it entirely from v
2.x
on.