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

Drop Python 2 support #685

Open
nvbn opened this issue Aug 28, 2017 · 38 comments
Open

Drop Python 2 support #685

nvbn opened this issue Aug 28, 2017 · 38 comments

Comments

@nvbn
Copy link
Owner

nvbn commented Aug 28, 2017

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
Copy link

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
Copy link
Owner Author

nvbn commented Aug 29, 2017

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

@ilovezfs
Copy link

@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
Copy link

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
Copy link
Owner Author

nvbn commented Aug 29, 2017

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

@HoweChen
Copy link

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

image

@ilovezfs
Copy link

@HoweChen install it with python3 :)

@HoweChen
Copy link

@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
Copy link

@HoweChen it's a HEAD install?

@HoweChen
Copy link

HoweChen commented Aug 29, 2017

@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
Copy link

@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
Copy link

@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
Copy link

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

@HoweChen
Copy link

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

@ilovezfs
Copy link

@HoweChen you're welcome!

@ilovezfs
Copy link

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

@MichaelKim0407
Copy link

MichaelKim0407 commented Aug 29, 2017

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
Copy link
Owner Author

nvbn commented Aug 30, 2017

@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
Copy link
Owner Author

nvbn commented Aug 30, 2017

@MichaelKim0407 you just need to upgrade to 3.23.

@MichaelKim0407
Copy link

@nvbn OK, thanks

@ilovezfs
Copy link

@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
Copy link

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
Copy link

ilovezfs commented Sep 7, 2017

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
Copy link

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
Copy link

ilovezfs commented Sep 7, 2017

why not just pin the version?

@ilovezfs
Copy link

ilovezfs commented Sep 7, 2017

I assume this would work:

ansible all -a 'pip install "thefuck==3.21"'

@AntonOlsen
Copy link

That appears to work, thanks.

@ilovezfs
Copy link

ilovezfs commented Sep 7, 2017

@AntonOlsen you're welcome!

@nvbn
Copy link
Owner Author

nvbn commented Sep 9, 2017

@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
Copy link

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
Copy link

machta commented Jan 1, 2018

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
Copy link

machta commented Jan 1, 2018

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

nagromc added a commit to nagromc/dotfiles-dotbot that referenced this issue Jan 27, 2018
nagromc added a commit to nagromc/dotfiles-dotbot that referenced this issue Jan 31, 2018
@ghost
Copy link

ghost commented Jul 5, 2018

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
Copy link

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
Copy link

tgunr commented Mar 23, 2019

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
Copy link

antgel commented Mar 23, 2019

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

@Rom1deTroyes
Copy link
Contributor

As a manager [...]

As a manager, it's surely unusual to say :

  • "Funck, apt need sudo rights !"
  • "Hey, why git don't know my funking branch ?"

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
Copy link
Contributor

KartikSoneji commented Jul 19, 2020

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.

riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
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

No branches or pull requests