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.
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
Fix unclear error when missing dependencies #3511
Fix unclear error when missing dependencies #3511
Changes from all commits
51669bd
bd70a4a
edd5512
c22e8f1
274f759
3121c07
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 13 in strawberry/cli/__init__.py
Codecov / codecov/patch
strawberry/cli/__init__.py#L12-L13
Check warning on line 15 in strawberry/cli/__init__.py
Codecov / codecov/patch
strawberry/cli/__init__.py#L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's great, it's something I was thinking about a few weeks ago!
Do you think it would be possible to make this granular too? Maybe it's not worth it, but some commands need different dependencies (for example schema codegen needs libcst, most of the other commands don't), so maybe we can suggest to install
libcst
or[cli]
in that case?But I don't know if we can do this cleanly 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, how convenient!
If you did want to do that, the cleanest way would probably be to import anything necessary in the commands themselves and raise errors within that. That would add quite a few lines (unless you went to the trouble of using a decorator to transform the error or something), but would get extra granularity when needed.
Idk how worth it it would be though honestly, unless
libcst
installs like 20 dependencies of its own.I did do it like that for a personal project of mine though, where you could use it without the dependencies, but would need them for extra functionality: https://github.com/parafoxia/analytix/blob/main/analytix/reports/interfaces.py#L315-L318
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, maybe it's not worth doing it for now
I want to add some more commands in future, maybe I can do that then 😊
I'll properly review this and merge later! thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed this to just be based on Exception 😊