copier
copier copied to clipboard
fix: support older versions of colorama
just_fix_windows_console was introduces in colorama 0.4.6
Some stable GNU/Linux OS use packages with older version of colorama. Examples: https://packages.altlinux.org/en/p10/binary/python3-module-colorama/noarch/ https://packages.debian.org/bullseye/python3-colorama
In order to use OS specific packages with latest copier (which is required for example here https://github.com/OCA/oca-addons-repo-template/blob/master/copier.yml#L4), this patch is introduced.
If we are to accept this fix, #1403 should also be reverted, or maybe the lower bound should just be downgraded to 0.4.4.
Removing Colorama entirely would be even better ;)
If we are to accept this fix, #1403 should also be reverted
Done.
Codecov Report
Attention: 2 lines
in your changes are missing coverage. Please review.
Comparison is base (
007f830
) 97.46% compared to head (4eb2484
) 94.24%. Report is 1 commits behind head on master.
:exclamation: Current head 4eb2484 differs from pull request most recent head 710ddde. Consider uploading reports for the commit 710ddde to get more accurate results
Files | Patch % | Lines |
---|---|---|
copier/tools.py | 60.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #1421 +/- ##
==========================================
- Coverage 97.46% 94.24% -3.23%
==========================================
Files 48 48
Lines 4462 4466 +4
==========================================
- Hits 4349 4209 -140
- Misses 113 257 +144
Flag | Coverage Δ | |
---|---|---|
unittests | 94.24% <60.00%> (-3.23%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Removed modification in poetry.lock and added pragma: nocover
Our supported installation methods include pipx and nix, which are both self-contained. You can use also pip and any venv implementation you want.
In copier among these installation methods, there is installation method that just makes sure, that there is minimal versions of dependecies that can be used (those dependencies are described in pyproject.toml). I use this installation method and this PR is for those people who use the same method.
It's just that older distros will happen always.
Listed distros in my first message are not ancient and are still supported.
In order to use OS specific packages with latest copier [...]
Just trying to understand the motivation for this PR better, @em230418: Why do you need to rely on a Colorama version from an OS distro? Thr oca-addons-repo-template
README instructs installing Copier via pipx
, so you should be able to get a recent version of Colorama. Am I missing something? :thinking:
Why do you need to rely on a Colorama version from an OS distro?
Because I trust packages from OS distro more, than packages from pypi in general. That thing is not specific for colorama. As an exclusion, if is no package in OS distro, I use from ones from pypi or github.
I suppose @em230418 installs Copier like apt install python-copier
(or similar OS-specific command), where python-copier
is packaged by volunteers, and depends on python-colorama
(or similarly named), bypassing PyPI entirely.
I'd vote to entirely remove the call to Colorama. I am myself considering the removal of Colorama from my projects:
- it's easy enough to hardcode/copy-paste a few ANSI sequences in a codebase (or use Plumbum colors in our case)
-
just_fix_windows_console
is not needed in recent tools like Microsoft's Terminal, or shells running in WSL, where ANSI sequences are natively supported - higher-level libraries like Rich handle this transparently for us.
Obviously, there are still people using powershell, or cmd.exe through Cmder/else. But modern Windows (10) actually supports ANSI, but it's disabled by default. This SuperUser post shows how to enable it permanently. So we could tell users to do that :shrug:
Ok for dropping it
@em230418 do you have intentions to go ahead with this PR and remove colorama?
Marking as draft while this isn't ready.