nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
85.43k stars 3.43k forks source link

Drop Python 2 support #685

Open nvbn opened 7 years ago

nvbn commented 7 years ago

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.

ilovezfs commented 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.

nvbn commented 7 years ago

@ilovezfs it looks like there's already a lot formulas with python3 in dependencies.

ilovezfs commented 7 years ago

@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.

ilovezfs commented 7 years ago

Anyway, it's obviously up to you, but I don't think it's accurate to say there is "no reason" to support python2.

nvbn commented 7 years ago

@ilovezfs yep, it's a bit more complicated than I thought.

HoweChen commented 7 years ago

I am wondering if there is a way to close the warning whenever I open the terminal?

image

ilovezfs commented 7 years ago

@HoweChen install it with python3 :)

HoweChen commented 7 years ago

@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.

ilovezfs commented 7 years ago

@HoweChen it's a HEAD install?

HoweChen commented 7 years ago

@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:

image

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.

image

ilovezfs commented 7 years ago

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

HoweChen commented 7 years ago

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

ilovezfs commented 7 years ago

It sounds like maybe you have it installed via pip2 as well.

HoweChen commented 7 years ago

@ilovezfs Yeah you are right, I have uninstalled the pip2 version. Thank you very much.

ilovezfs commented 7 years ago

@HoweChen you're welcome!

ilovezfs commented 7 years ago

@nvbn I guess we'll depend on :python3 in the Homebrew formula because users will just complain about the warning to us otherwise.

MichaelKim0407 commented 7 years ago

How can I remove the warning? I installed thefuck with Python 3.

screenshot from 2017-08-29 14-35-32

I'm on Ubuntu/Linux 16.04

nvbn commented 7 years ago

@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 commented 7 years ago

@MichaelKim0407 you just need to upgrade to 3.23.

MichaelKim0407 commented 7 years ago

@nvbn OK, thanks

ilovezfs commented 7 years ago

@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.

AntonOlsen commented 7 years ago

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.

ilovezfs commented 7 years ago

Just comment out ...

    if six.PY2:
        warn("The Fuck will drop Python 2 support soon, more details "
             "https://github.com/nvbn/thefuck/issues/685")
AntonOlsen commented 7 years ago

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.

ilovezfs commented 7 years ago

why not just pin the version?

ilovezfs commented 7 years ago

I assume this would work:

ansible all -a 'pip install "thefuck==3.21"'
AntonOlsen commented 7 years ago

That appears to work, thanks.

ilovezfs commented 7 years ago

@AntonOlsen you're welcome!

nvbn commented 7 years ago

@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
saiqulhaq commented 7 years ago

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
machta commented 6 years ago

For me the new version still prints the annoying warning. So I suppressed it in .bashrc like this

eval $(thefuck --alias 2>/dev/null)
machta commented 6 years ago

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

ghost commented 6 years ago

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/
xueyuanl commented 6 years ago

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

tgunr commented 5 years ago

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.

antgel commented 5 years ago

@tgunr What does this have to do with dropping Python 2? I'm offended by your lack of attention to the topic!

Rom1deTroyes commented 5 years ago

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.

KartikSoneji commented 4 years ago

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.