Migrate the build system to poetry #1023
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.
What is this PR
I suggest migrating the build system from the traditional setup to using a more modern / advanced tool such as poetry. This work is not complete yet and I have a few things to fix.
Motivation
The motivation for this is that it is very hard to integrate easyocr in external projects that require
opencv
or / and pytorch. This is the case of many machine learning solutions that use different versions (specifically, the distribution of opencv, or pytorch in CPU only mode). These changes keep the same dependencies for the default pip package (I'm unsure where / how you built it in the past) but allow users of easyocr as a library to tweak the exact dependencies.Unintended Consequences
Poetry has some limitations. In this case, we would like to force the choice of any of the opencv choices as well as torch, which is not a supported use case for poetry. This has to be managed by the user. As a preventative measure, I added a check in the main
__init__.py
file that both libraries can be importedWhat's left
Bug addressed
@JaidedTeam Before I finish working on this, I want to make sure this is a change you want to see in the library. If you have no interest, I will maintain my own fork for my own purposes, but I truly believe this is a better solution than the current requirements.txt