TissueEngineeringLab / MyoFInDer

Python interface for automatic calculation of the fusion index in muscle cell cultures
https://tissueengineeringlab.github.io/MyoFInDer/
GNU General Public License v3.0
3 stars 1 forks source link

Switch to `deepcell>12.0.7` requirement #20

Open WeisLeDocto opened 9 months ago

WeisLeDocto commented 9 months ago

Starting from release 0.12.8, the deepcell library requires a token authentication for users to be able to download the weights of the AI models. Currently, we circumvent this limitation by enforcing the use of version 0.12.7, that allows to freely download the weights of the AI model.

On the long term, the possibility to provide a token and to install a newer version of DeepCell will however become necessary, as version 0.12.7 will age and eventually not be compatible with the evolution of Python. There are several requirements for integration in the basic interface of MyoFInDer:

The default behavior should be to stick to version 0.12.7, maybe with regular messages advising users to request a token. For command-line users, it seems reasonable to request a manual update of DeepCell once they have provided their token. For regular Windows users, the bash script managing startup should be responsible for checking if a token was provided, and if it is valid. Once provided, the token could be stored in a __token__ file in the base folder of MyoFInDer.

The practical implementation of the token system is not straightforward to achieve in a clean way. Making use of the optional-dependencies of pyproject.toml could be an option, and work as follows:

It should first be checked if it is allowed to have the same packages in the dependencies and optional-dependencies fields. Double-checking the validity of this system with a question on the Python Discourse would be safer. It would, at that point, also be good to check with the maintainers of DeepCell if they have any opinion on this solution.

WeisLeDocto commented 4 months ago

It should first be checked if it is allowed to have the same packages in the dependencies and optional-dependencies fields. Double-checking the validity of this system with a question on the Python Discourse would be safer. It would, at that point, also be good to check with the maintainers of DeepCell if they have any opinion on this solution.

In the light of this topic on the Python Discourse, it appears that having the version of DeepCell depend on an optional-dependencies would prove very hard, if not impossible. A more realistic approach will be to simply require users to provide a token when installing MyoFInDer, and raise an exception if no token is provided.

The new strategy is as follows:

The implementation would be the following:

The changes in #44 now make it possible to request a token during installation with the Windows installer.

WeisLeDocto commented 1 month ago

if the provided one is not valid, an error message is displayed in a popup window, and the user is invited to re-enter a valid token

UPDATE: Won't be feasible as there is no way to preemptively check if a token is valid without actually downloading something. The error displayed in the terminal should be clear enough for users to know what's wrong, and should clearly provide the path to the file to modify.