Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create __init__.py #490

Merged
merged 3 commits into from
Oct 6, 2023
Merged

Create __init__.py #490

merged 3 commits into from
Oct 6, 2023

Conversation

Adibvafa
Copy link
Member

@Adibvafa Adibvafa commented Oct 5, 2023

PR Type ([Feature | Fix | Documentation | Test])

Fix the issue of importing MortalityPredictionTask. Source of the bug is when replication the tutorial below: https://vectorinstitute.github.io/cyclops/api/tutorials/kaggle/heart_failure_prediction.html

Short Description

The following code fails because 'tasks' will be loaded as 'tasks.py' file instead of the directory containing 'mortalitiy_prediction'.

from cyclops.tasks.mortality_prediction import MortalityPredictionTask

Tests Added

Added init file to fix the issue.

The following code fails because 'tasks' will be loaded as 'tasks.py' file instead of the directory containing 'mortalitiy_prediction'.

from cyclops.tasks.mortality_prediction import MortalityPredictionTask


Signed-off-by: Adibvafa Fallahpour <[email protected]>
@fcogidi
Copy link
Collaborator

fcogidi commented Oct 5, 2023

Thanks for your contribution! :)

Could you share how you set up your environment? Was it through the pip install?

I ask because running from cyclops.tasks.mortality_prediction import MortalityPredictionTask doesn't fail in my environment. But that's a development environment.

@amrit110
Copy link
Member

amrit110 commented Oct 6, 2023

Yeah adding to @fcogidi, good catch. In the development env, poetry installs the cyclops package which adds the package directory to the PYTHONPATH which allows for discovery of subpackages and modules.

BTW, we could even import the task classes in the init file so that you can do from cyclops.tasks import MortalityPredictionTask. @Adibvafa could you add that to the __init__file? So:

from cyclops.tasks.mortality_prediction import MortalityPredictionTask
from cyclops.tasks.cxr_classification import CXRClassificationTask

@Adibvafa
Copy link
Member Author

Adibvafa commented Oct 6, 2023

Thanks for your contribution! :)

Could you share how you set up your environment? Was it through the pip install?

I ask because running from cyclops.tasks.mortality_prediction import MortalityPredictionTask doesn't fail in my environment. But that's a development environment.

Yes, my environment is not a development environment, it's merely a conda env and I installed cyclops with pip.

Added new imports.

Signed-off-by: Adibvafa Fallahpour <[email protected]>
@Adibvafa
Copy link
Member Author

Adibvafa commented Oct 6, 2023

Yeah adding to @fcogidi, good catch. In the development env, poetry installs the cyclops package which adds the package directory to the PYTHONPATH which allows for discovery of subpackages and modules.

BTW, we could even import the task classes in the init file so that you can do from cyclops.tasks import MortalityPredictionTask. @Adibvafa could you add that to the __init__file? So:

from cyclops.tasks.mortality_prediction import MortalityPredictionTask
from cyclops.tasks.cxr_classification import CXRClassificationTask

That's a great idea! Just committed the changes you mentioned.

@amrit110 amrit110 added the bug Something isn't working label Oct 6, 2023
@amrit110 amrit110 self-requested a review October 6, 2023 04:15
@amrit110 amrit110 merged commit 951e144 into VectorInstitute:main Oct 6, 2023
10 checks passed
@amrit110
Copy link
Member

amrit110 commented Oct 6, 2023

@Adibvafa, should now be fixed in v0.1.38, so just update the pip install :).

@Adibvafa
Copy link
Member Author

Adibvafa commented Oct 6, 2023

@Adibvafa, should now be fixed in v0.1.38, so just update the pip install :).

Awesome! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants