-
Notifications
You must be signed in to change notification settings - Fork 414
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
Only install and import colorama on Windows. #691
Only install and import colorama on Windows. #691
Conversation
Does this have a measurable benefit? (Startup time, etc.) |
Barely anything significant. But that is not the reason I took the effort to submit this PR. To give some background. I use poetry as my dependency manager and poetry will always uninstall colorama because You can say this is a poetry bug, or that I just have to install pipx in its own environment, |
Ah ok, I didn't realize there was this side effect with poetry. Your motivation makes more sense now. It's too bad, because the whole point of colorama is that it works cross-platform and you don't have to conditionally install on Windows. 😕 |
Yes, that is true, if other tools didn't specify colorama as Windows only and just ran it unconditionally Poetry would never decided to remove it. It's just that Python dependency management isn't as robust as it can be. Without that problem pipx might have never existed. Here is the issue from Poetry talking about that: |
Hello! I came across the following error when I was trying to poetry lock
And the
system python 3.7 Any thoughts on why it didn't follow the linux requirement? Thank you! |
I figured out a solution by adding |
Related: #612
Only install and import colorama on Windows. Importing and init call has no effect on other platforms, so no need to do it on other platforms.
docs/changelog.md
Summary of changes
Just check if on Windows, do import and call init. Also, colorama dep is now listed as a windows specific dep.
Test plan
Tested by running: