Open nvbn opened 7 years ago
it seems like there's no reason to support Python 2 nowadays
One reason is that some systems ship with python2 only (e.g. macOS), and python3 is a non-trivial dependency to require.
@ilovezfs it looks like there's already a lot formulas with python3 in dependencies.
@nvbn sure but the vast majority use python2. It just feels like a really heavy dependency for something like this, not to mention that it has over 14,000 installs per month.
Anyway, it's obviously up to you, but I don't think it's accurate to say there is "no reason" to support python2.
@ilovezfs yep, it's a bit more complicated than I thought.
I am wondering if there is a way to close the warning whenever I open the terminal?
@HoweChen install it with python3 :)
@ilovezfs Well, I install it from the homebrew, maybe it's the formula's problem which uses python2 as a default. I would change this to python3, thanks.
@HoweChen it's a HEAD install?
@ilovezfs No, it's not. When I try to install thefuck with --HEAD
, and I open up a new window of the terminal. It shows this:
I thought the formula of thefuck on homebrew should add be added a new argument --with-python3
. I found that homebrew itself uses Python instead of Python3 to run the command by default.
@HoweChen Yes it makes sense a HEAD build fails. I don't understand why you're seeing the warning though. That doesn't seem to be in version 3.21. Which version do you have installed?
@ilovezfs
After reinstalling thefuck via homebrew without --HEAD
, the problem has been solved. I thought it's my problem, every time when I update thefuck, I need to run brew link --overwrite thefuck
. I forgot to run this command this time maybe. If there is a way to avoid running this command?
It sounds like maybe you have it installed via pip2
as well.
@ilovezfs Yeah you are right, I have uninstalled the pip2 version. Thank you very much.
@HoweChen you're welcome!
@nvbn I guess we'll depend on :python3
in the Homebrew formula because users will just complain about the warning to us otherwise.
How can I remove the warning? I installed thefuck with Python 3.
I'm on Ubuntu/Linux 16.04
@ilovezfs thanks, would it be possible to have an option to install it with Python 2? In case some users have custom rules that work only with Python 2.
@MichaelKim0407 you just need to upgrade to 3.23.
@nvbn OK, thanks
@ilovezfs thanks, would it be possible to have an option to install it with Python 2? In case some users have custom rules that work only with Python 2.
@nvbn We typically only allow python2 and python3 in the same formula for libraries, not for applications.
The easiest way to skip the error is to uninstall The Fuck.
I can't upgrade to Python 3 until the next Ubuntu LTS is released and tested in production.
Just comment out ...
if six.PY2:
warn("The Fuck will drop Python 2 support soon, more details "
"https://github.com/nvbn/thefuck/issues/685")
Or: ansible all -a 'pip uninstall -y thefuck'
It was nice to have on the off chance I needed to work directly on a web server, but I have way too many servers to mess with editing the files.
why not just pin the version?
I assume this would work:
ansible all -a 'pip install "thefuck==3.21"'
That appears to work, thanks.
@AntonOlsen you're welcome!
@AntonOlsen current LTS has python 3.5 (even 14.04 has python 3.4), and it doesn't interfere with python 2, after installation python 2 still be used by default. So something like this shouldn't break anything:
pip uninstall thefuck
apt install python3 python3-dev python3-pip
pip3 install thefuck
I need do this on my mac, because pip command is not recognized, but pip2 command does so to get this awesome library being installed on python 3, I need do this
python3 -m pip install thefuck
For me the new version still prints the annoying warning. So I suppressed it in .bashrc
like this
eval $(thefuck --alias 2>/dev/null)
BTW is there a way to tell it to use Python 3.5 if I have also 2.7 installed and it is the default (i.e. /usr/bin/python is a symlink to python2.7)? Thanks
On Mint 19, I can't use pip3 to install:
pip3 install thefuck
Collecting thefuck
Downloading https://files.pythonhosted.org/packages/05/35/4272afb90220f06c585da17d3c941df3d647833839ba113823a4e89c8d55/thefuck-3.27-py2.py3-none-any.whl (120kB)
100% |████████████████████████████████| 122kB 3.6MB/s
Collecting pyte (from thefuck)
Downloading https://files.pythonhosted.org/packages/66/37/6fed89b484c8012a0343117f085c92df8447a18af4966d25599861cd5aa0/pyte-0.8.0.tar.gz (50kB)
100% |████████████████████████████████| 51kB 5.4MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-45bjj06l/pyte/
For those who still on Python 2, the annoying warn info when login can be removed by:
In your python2 path,
find / -name alias.py
for me, it in: /usr/local/lib/python2.7/dist-packages/thefuck/entrypoints
Then delete the three lines:
if six.PY2: warn("The Fuck will drop Python 2 support soon, more details " "https://github.com/nvbn/thefuck/issues/685")
and delete the file alias.pyc in the same path
I'm not a prude but your choice of name for your program is tacky at best and offensive to some. As a manager I would never allow vulgarities in the source code or otherwise. It just not professional IMO.
@tgunr What does this have to do with dropping Python 2? I'm offended by your lack of attention to the topic!
As a manager [...]
As a manager, it's surely unusual to say :
But as a developper, it's a daily task to manage fucks :-(
It just not professional IMO.
Yep, you're right, it's not a professional tool provided by an inovative startup to reduce human errors...
It's just a magnificent escape valve based on a simple idea : collect comunity driven best practices, and add them on top of an alias fuck='sudo $(history -p \!\!)'
.
As a Manager, you can see it as the best outlet : a free punchbag for opeational console users.
BTW, this kind of jokes are alerady there in all the things : the Digital World is full of them.
Python 2 has officially reached end-of-life (~7 months ago) and many packages are Python 3 only. This is a good time to drop support for Python 2.
Python 2 support makes code more complicated and slow downs development. And as Python 3 already exists almost nine years, it seems like there's no reason to support Python 2 nowadays.