Skip to content

Commit

Permalink
Drop 3.7 support
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Oct 18, 2024
1 parent c70267c commit eff4f28
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 55 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ jobs:
- { os: macos-latest, py: "brew@3.11" }
- { os: macos-latest, py: "brew@3.10" }
- { os: macos-latest, py: "brew@3.9" }
- { os: macos-latest, py: "brew@3.8" }
- { os: ubuntu-latest, py: "3.7" }
- { os: macos-13, py: "3.7" }
exclude:
- { os: windows-latest, py: "pypy-3.10" }
- { os: windows-latest, py: "pypy-3.9" }
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/u.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Upgrade embedded wheels:

Removed setuptools of ``68.0.0``
Removed wheel of ``0.42.0``
Removed pip of ``24.0``
7 changes: 4 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Python and OS Compatibility

virtualenv works with the following Python interpreter implementations:

- `CPython <https://www.python.org/>`_: ``3.12 >= python_version >= 3.7``
- `PyPy <https://pypy.org/>`_: ``3.10 >= python_version >= 3.7``
- `CPython <https://www.python.org/>`_: ``3.12 >= python_version >= 3.8``
- `PyPy <https://pypy.org/>`_: ``3.10 >= python_version >= 3.8``

This means virtualenv works on the latest patch version of each of these minor versions. Previous patch versions are
supported on a best effort approach.
Expand All @@ -97,6 +97,7 @@ request on our issue tracker.

Note:

- as of ``20.27.0`` -- ``2024-10-17`` -- we no longer support running under Python ``<=3.7``,
- as of ``20.18.0`` -- ``2023-02-06`` -- we no longer support running under Python ``<=3.6``,
- as of ``20.22.0`` -- ``2023-04-19`` -- we no longer support creating environments for Python ``<=3.6``.

Expand All @@ -120,4 +121,4 @@ In case of macOS we support:
Windows
~~~~~~~
- Installations from `python.org <https://www.python.org/downloads/>`_
- Windows Store Python - note only `version 3.7+ <https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l>`_
- Windows Store Python - note only `version 3.8+ <https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l>`_
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ license = "MIT"
maintainers = [
{ name = "Bernat Gabor", email = "gaborjbernat@gmail.com" },
]
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -27,7 +27,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -106,7 +105,6 @@ build.targets.sdist.include = [
version.source = "vcs"

[tool.ruff]
target-version = "py37"
line-length = 120
format.preview = true
format.docstring-code-line-length = 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ def sources(cls, interpreter):
def executables(cls, interpreter):
return super().sources(interpreter)

@classmethod
def has_shim(cls, interpreter):
return interpreter.version_info.minor >= 7 and cls.shim(interpreter) is not None # noqa: PLR2004

@classmethod
def shim(cls, interpreter):
shim = Path(interpreter.system_stdlib) / "venv" / "scripts" / "nt" / "python.exe"
Expand All @@ -84,11 +80,7 @@ def shim(cls, interpreter):

@classmethod
def host_python(cls, interpreter):
if cls.has_shim(interpreter):
# starting with CPython 3.7 Windows ships with a venvlauncher.exe that avoids the need for dll/pyd copies
# it also means the wrapper must be copied to avoid bugs such as https://bugs.python.org/issue42013
return cls.shim(interpreter)
return super().host_python(interpreter)
return cls.shim(interpreter)

@classmethod
def dll_and_pyd(cls, interpreter):
Expand Down
4 changes: 0 additions & 4 deletions src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ def sources(cls, interpreter):
class Pypy3Windows(PyPy3, WindowsSupports):
"""PyPy 3 on Windows."""

@property
def less_v37(self):
return self.interpreter.version_info.minor < 7 # noqa: PLR2004

@classmethod
def _shared_libs(cls, python_dir):
# glob for libpypy*.dll and libffi*.dll
Expand Down
13 changes: 0 additions & 13 deletions src/virtualenv/create/via_global_ref/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from .api import ViaGlobalRefApi, ViaGlobalRefMeta
from .builtin.cpython.mac_os import CPython3macOsBrew
from .builtin.pypy.pypy3 import Pypy3Windows


class Venv(ViaGlobalRefApi):
Expand Down Expand Up @@ -44,18 +43,6 @@ def create(self):
for lib in self.libs:
ensure_dir(lib)
super().create()
self.executables_for_win_pypy_less_v37()

def executables_for_win_pypy_less_v37(self):
"""
PyPy <= 3.6 (v7.3.3) for Windows contains only pypy3.exe and pypy3w.exe
Venv does not handle non-existing exe sources, e.g. python.exe, so this
patch does it.
""" # noqa: D205
creator = self.describe
if isinstance(creator, Pypy3Windows) and creator.less_v37:
for exe in creator.executables(self.interpreter):
exe.run(creator, self.symlinks)

def create_inline(self):
from venv import EnvBuilder # noqa: PLC0415
Expand Down
10 changes: 2 additions & 8 deletions src/virtualenv/run/plugin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@

import sys
from collections import OrderedDict
from importlib.metadata import entry_points

if sys.version_info >= (3, 8):
from importlib.metadata import entry_points

importlib_metadata_version = ()
else:
from importlib_metadata import entry_points, version

importlib_metadata_version = tuple(int(i) for i in version("importlib_metadata").split(".")[:2])
importlib_metadata_version = ()


class PluginLoader:
Expand Down
7 changes: 1 addition & 6 deletions src/virtualenv/seed/wheels/embed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

BUNDLE_FOLDER = Path(__file__).absolute().parent
BUNDLE_SUPPORT = {
"3.7": {
"pip": "pip-24.0-py3-none-any.whl",
"setuptools": "setuptools-68.0.0-py3-none-any.whl",
"wheel": "wheel-0.42.0-py3-none-any.whl",
},
"3.8": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-75.2.0-py3-none-any.whl",
Expand Down Expand Up @@ -47,7 +42,7 @@
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
}
MAX = "3.7"
MAX = "3.8"


def get_embed_wheel(distribution, for_py_version):
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 1 addition & 4 deletions tasks/__main__zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ def iterator(self, resource_name):
def versioned_distribution_class():
global _VER_DISTRIBUTION_CLASS # noqa: PLW0603
if _VER_DISTRIBUTION_CLASS is None:
if sys.version_info >= (3, 8):
from importlib.metadata import Distribution # noqa: PLC0415
else:
from importlib_metadata import Distribution # noqa: PLC0415
from importlib.metadata import Distribution # noqa: PLC0415

class VersionedDistribution(Distribution):
def __init__(self, file_loader, dist_path) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tasks/upgrade_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
STRICT = "UPGRADE_ADVISORY" not in os.environ

BUNDLED = ["pip", "setuptools", "wheel"]
SUPPORT = [(3, i) for i in range(7, 15)]
SUPPORT = [(3, i) for i in range(8, 15)]
DEST = Path(__file__).resolve().parents[1] / "src" / "virtualenv" / "seed" / "wheels" / "embed"


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/seed/embed/test_pip_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_base_bootstrap_via_pip_invoke(tmp_path, coverage_env, mocker, current_f
def _load_embed_wheel(app_data, distribution, for_py_version, version): # noqa: ARG001
return load_embed_wheel(app_data, distribution, old_ver, version)

old_ver = "3.7"
old_ver = "3.8"
old = BUNDLE_SUPPORT[old_ver]
mocker.patch("virtualenv.seed.wheels.bundle.load_embed_wheel", side_effect=_load_embed_wheel)

Expand Down

0 comments on commit eff4f28

Please sign in to comment.