brainglobe / cellfinder-core

Standalone cellfinder cell detection algorithm
https://brainglobe.info/documentation/cellfinder/index.html
BSD 3-Clause "New" or "Revised" License
19 stars 16 forks source link

Forbid import when `tensorflow` is not installed #186

Closed willGraham01 closed 1 year ago

willGraham01 commented 1 year ago

Description

What is this PR

Why is this PR needed? See https://github.com/brainglobe/BrainGlobe/issues/27 - this PR is for conda-forge compatibility reasons.

What does this PR do? This PR forbids the import of cellfinder_core when tensorflow is not installed.

Note that we do not need to remove tensorflow from the pyproject.toml dependencies - these are read only by pip and not by conda.

References

Resolves step 1 of this issue.

How has this PR been tested?

Local testing of pip package install:

$ conda activate cellfinder
(cellfinder) $ pip install .
(cellfinder) $ python 
>> import cellfinder_core
# All good
>> exit()
(cellfinder) $ pip uninstall tensorflow
(cellfinder) $ python
>> import cellfinder_core
# Throws expected error
(cellfinder) $ pip install tensorflow
(cellfinder) $ python
>> import cellfinder_core
# All good again
>> exit()

Is this a breaking change?

No. New version, PyPI upload, and conda-forge recipe required though.

Does this PR require an update to the documentation?

Updates README to explain that the conda-install will not fetch tensorflow, this will have to be done by the user.

Requires a change on brainglobe-meta repository.

Checklist: