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

Optional dependencies #1798

Merged
merged 6 commits into from
Aug 24, 2023
Merged

Conversation

yifanmai
Copy link
Collaborator

@yifanmai yifanmai commented Aug 19, 2023

If a user attempts to use a feature that requires an optional dependency, they will be prompted to run pip install crfm-helm[all].

Addresses #1327

@yifanmai yifanmai requested a review from percyliang August 19, 2023 01:15
@@ -37,6 +37,7 @@ install_requires=
# sqlitedict==2.0.0 is slow! https://github.com/RaRe-Technologies/sqlitedict/issues/152
# Keep sqlitedict version at 1.7.0.
sqlitedict~=1.7.0
bottle~=0.12.23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is bottle not under server?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed that section from "server" to "proxy-server". Bottle is not under there because it's also used for helm-server, not just the proxy.

@@ -358,6 +359,12 @@ def filter_by_metadata(self, subset: ICESubset, header_dir: str, all_corpus_file
return []

for fi, columns in files:

try:
import xlrd # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do this at the top-level like the other imports of optional dependencies?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved. I wanted to keep it close to the pd.read_excel() call for readability, but I agree that it is better to have it at the top and just add a comment to explain it.

# TODO: Ask user to install more specific optional dependencies
# e.g. crfm-helm[plots] or crfm-helm[server]
raise OptionalDependencyNotInstalled(
f"Optional dependency {e.name} is not installed. " "Please run `pip install helm-crfm[all]` to install it."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could ask them to look at setup.cfg to determine which optional dependencies to install rather than always defaulting to [all].

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I have an idea of how to suggest which command to run, but I'll do it in the next PR.

@yifanmai yifanmai force-pushed the yifanmai/fix-optional-dependencies-round-2 branch from 727ea4f to 83f1aee Compare August 23, 2023 23:53
@yifanmai yifanmai merged commit be6f08d into main Aug 24, 2023
@yifanmai yifanmai deleted the yifanmai/fix-optional-dependencies-round-2 branch August 24, 2023 00:43
danielz02 pushed a commit to danielz02/helm that referenced this pull request Sep 7, 2023
danielz02 pushed a commit to danielz02/helm that referenced this pull request Sep 7, 2023
danielz02 pushed a commit to danielz02/helm that referenced this pull request Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants