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

fix: support older versions of colorama #1421

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

em230418
Copy link

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.

@pawamoy
Copy link
Contributor

pawamoy commented Nov 21, 2023

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 ;)

@em230418
Copy link
Author

If we are to accept this fix, #1403 should also be reverted

Done.

Copy link

codecov bot commented Nov 21, 2023

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.

❗ 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 ⚠️
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%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

IMHO we shouldn't merge this.

Don't get me wrong. The patch looks quite OK. It's just that older distros will happen always.

Our supported installation methods include pipx and nix, which are both self-contained. You can use also pip and any venv implementation you want.

Thus, I think it's better that our users use self-contained installations, than having to deal with older distros.

At least, that's my opinion right now. But I could be wrong...

@em230418
Copy link
Author

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.

@sisp
Copy link
Member

sisp commented Nov 22, 2023

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? 🤔

@em230418
Copy link
Author

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.

@pawamoy
Copy link
Contributor

pawamoy commented Nov 22, 2023

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.

@pawamoy
Copy link
Contributor

pawamoy commented Nov 22, 2023

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 🤷

@yajo
Copy link
Member

yajo commented Nov 22, 2023

Ok for dropping it

@yajo
Copy link
Member

yajo commented Jan 15, 2024

@em230418 do you have intentions to go ahead with this PR and remove colorama?

Marking as draft while this isn't ready.

@yajo yajo marked this pull request as draft January 15, 2024 18:12
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.

4 participants