fades icon indicating copy to clipboard operation
fades copied to clipboard

Drop support for Python 2

Open facundobatista opened this issue 4 years ago • 3 comments

It's time now.

The rest of the ecosystem already did, see for example the log at the end here where "get-pip" fails because Py2...

Also, we could support >=Py3.5 (which has 6 years already) and just use venv module for the virtualenv creation (which also gives us pip "for free").

$ fades -v --python=python2.7 RI-generaMallaResuelve.py
*** fades ***  2021-05-21 18:54:09,032  fades INFO     Hi! This is fades 9.0.1, automatically managing your dependencies
*** fades ***  2021-05-21 18:54:09,032  fades DEBUG    Running Python sys.version_info(major=3, minor=9, micro=2, releaselevel='final', serial=0) on 'Linux-5.10.0-6-amd64-x86_64-with-glibc2.31'
*** fades ***  2021-05-21 18:54:09,032  fades DEBUG    Starting fades v. 9.0.1
*** fades ***  2021-05-21 18:54:09,032  fades DEBUG    Arguments: Namespace(version=False, dependency=None, requirement=None, python='python2.7', ipython=False, system_site_packages=False, virtualenv_options=[], check_updates=False, no_precheck_availability=False, pip_options=[], python_options=[], remove=None, clean_unused_venvs=None, get_venv_dir=False, autoimport=False, freeze=None, avoid_pip_upgrade=False, verbose=True, quiet=False, executable=False, module=False, child_program='RI-generaMallaResuelve.py', child_options=[])
*** fades ***  2021-05-21 18:54:09,033  fades.cache DEBUG    Using cache index: '/home/manuel/.local/share/fades/venvs.idx'
*** fades ***  2021-05-21 18:54:09,034  fades DEBUG    Dependencies from source file: {'pypi': [Requirement.parse('matplotlib'), Requirement.parse('numpy'), Requirement.parse('dolfin')]}
*** fades ***  2021-05-21 18:54:09,034  fades DEBUG    Dependencies from docstrings: {}
*** fades ***  2021-05-21 18:54:09,035  fades DEBUG    Dependencies from parameters: {}
*** fades ***  2021-05-21 18:54:09,035  fades.helpers DEBUG    Getting interpreter version for: python2.7
*** fades ***  2021-05-21 18:54:09,035  fades.helpers DEBUG    Current interpreter is /usr/bin/python3.9
*** fades ***  2021-05-21 18:54:09,035  fades.exec DEBUG    Executing external command: ['python2.7', '-c', "\nimport sys, json\nd = dict(path=sys.executable)\nd.update(zip('major minor micro releaselevel serial'.split(), sys.version_info))\nprint(json.dumps(d))\n"]
*** fades ***  2021-05-21 18:54:09,046  fades.exec DEBUG    :: {"major": 2, "releaselevel": "final", "micro": 18, "path": "/usr/bin/python2.7", "serial": 0, "minor": 7}
*** fades ***  2021-05-21 18:54:09,047  fades.helpers DEBUG    Interpreter=/usr/bin/python2.7. It is the same as fades?=False
*** fades ***  2021-05-21 18:54:09,047  fades.cache DEBUG    Searching a venv for: reqs={'pypi': {Requirement.parse('matplotlib'), Requirement.parse('dolfin'), Requirement.parse('numpy')}} interpreter=/usr/bin/python2.7 options={'pyvenv_options': [], 'virtualenv_options': []}
*** fades ***  2021-05-21 18:54:09,047  fades.cache DEBUG    No matching venv found
*** fades ***  2021-05-21 18:54:09,047  fades INFO     Checking the availabilty of dependencies in PyPI. You can use '--no-precheck-availability' to avoid it.
*** fades ***  2021-05-21 18:54:09,047  fades.helpers DEBUG    Checking if Requirement.parse('matplotlib') exists in PyPI
*** fades ***  2021-05-21 18:54:09,047  fades.helpers DEBUG    Doing HEAD requests against https://pypi.org/pypi/matplotlib/json
*** fades ***  2021-05-21 18:54:09,083  fades.helpers DEBUG    Requirement.parse('matplotlib') exists in PyPI.
*** fades ***  2021-05-21 18:54:09,083  fades.helpers DEBUG    Checking if Requirement.parse('dolfin') exists in PyPI
*** fades ***  2021-05-21 18:54:09,083  fades.helpers DEBUG    Doing HEAD requests against https://pypi.org/pypi/dolfin/json
*** fades ***  2021-05-21 18:54:09,123  fades.helpers DEBUG    Requirement.parse('dolfin') exists in PyPI.
*** fades ***  2021-05-21 18:54:09,123  fades.helpers DEBUG    Checking if Requirement.parse('numpy') exists in PyPI
*** fades ***  2021-05-21 18:54:09,123  fades.helpers DEBUG    Doing HEAD requests against https://pypi.org/pypi/numpy/json
*** fades ***  2021-05-21 18:54:09,165  fades.helpers DEBUG    Requirement.parse('numpy') exists in PyPI.
*** fades ***  2021-05-21 18:54:09,166  fades.envbuilder DEBUG    Env will be created at: /home/manuel/.local/share/fades/fdb5ae90-1d64-46ea-8081-bb2261cfa5a7
*** fades ***  2021-05-21 18:54:09,166  fades.envbuilder DEBUG    Creating virtualenv with virtualenv
*** fades ***  2021-05-21 18:54:09,166  fades.exec DEBUG    Executing external command: ['virtualenv', '--python', 'python2.7', '--no-pip', '/home/manuel/.local/share/fades/fdb5ae90-1d64-46ea-8081-bb2261cfa5a7']
*** fades ***  2021-05-21 18:54:09,390  fades.exec DEBUG    :: created virtual environment CPython2.7.18.final.0-64 in 114ms
*** fades ***  2021-05-21 18:54:09,391  fades.exec DEBUG    ::   creator CPython2Posix(dest=/home/manuel/.local/share/fades/fdb5ae90-1d64-46ea-8081-bb2261cfa5a7, clear=False, no_vcs_ignore=False, global=False)
*** fades ***  2021-05-21 18:54:09,391  fades.exec DEBUG    ::   seeder FromAppData(download=False, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/manuel/.local/share/virtualenv)
*** fades ***  2021-05-21 18:54:09,391  fades.exec DEBUG    ::     added seed packages: pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
*** fades ***  2021-05-21 18:54:09,391  fades.exec DEBUG    ::   activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
*** fades ***  2021-05-21 18:54:09,408  fades.envbuilder DEBUG    env_bin_path: /home/manuel/.local/share/fades/fdb5ae90-1d64-46ea-8081-bb2261cfa5a7/bin
*** fades ***  2021-05-21 18:54:09,408  fades.envbuilder DEBUG    pip isn't installed in the venv, setting pip_installed=False
*** fades ***  2021-05-21 18:54:09,408  fades.envbuilder DEBUG    Installing dependencies for repo 'pypi': requested={Requirement.parse('matplotlib'), Requirement.parse('dolfin'), Requirement.parse('numpy')}
*** fades ***  2021-05-21 18:54:09,409  fades.pipmanager INFO     Need to install a dependency with pip, but no builtin, doing it manually (just wait a little, all should go well)
*** fades ***  2021-05-21 18:54:09,409  fades.pipmanager DEBUG    Using pip installer from '/home/manuel/.local/share/fades/get-pip.py'
*** fades ***  2021-05-21 18:54:09,409  fades.pipmanager DEBUG    Installing PIP manually in the virtualenv
*** fades ***  2021-05-21 18:54:09,409  fades.exec DEBUG    Executing external command: ['/home/manuel/.local/share/fades/fdb5ae90-1d64-46ea-8081-bb2261cfa5a7/bin/python', '/home/manuel/.local/share/fades/get-pip.py', '-I']
*** fades ***  2021-05-21 18:54:09,440  fades.exec DEBUG    :: ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.
*** fades ***  2021-05-21 18:54:09,443  fades.envbuilder DEBUG    Installation Step failed, removing virtualenv
*** fades ***  2021-05-21 18:54:09,443  fades.envbuilder DEBUG    Destroying virtualenv at: /home/manuel/.local/share/fades/fdb5ae90-1d64-46ea-8081-bb2261cfa5a7

facundobatista avatar Jul 16 '21 12:07 facundobatista

We're not doing anything special for Py2... but the >= 3.6 to use venv for virtualenvs is interesting.

facundobatista avatar Feb 07 '24 18:02 facundobatista

Beyond a couple of small changes to remove Python 2 from README and similar (something else?), the key idea of this change is to start supporting >= 3.6 only, and that will allow us to:

  • remove the virtualenv usage
  • clean up names with pyvenv string

Before doing this we need to have #424 in place so quality is assured.

facundobatista avatar Feb 15 '24 00:02 facundobatista

README no longer mentions Py 2.

facundobatista avatar Feb 28 '24 20:02 facundobatista