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 38b9e89
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 34 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
1 change: 1 addition & 0 deletions docs/changelog/2758.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop 3.7 support as the CI environments no longer allow it running - by :user:`gaborbernat`.
5 changes: 5 additions & 0 deletions docs/changelog/2783.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Upgrade embedded wheels:

* setuptools to ``75.2.0`` from ``75.1.0``
* Removed pip of ``24.0``
* Removed setuptools of ``68.0.0``
* Removed wheel of ``0.42.0``

- by :user:`gaborbernat`.
1 change: 1 addition & 0 deletions docs/changelog/2784.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix zipapp is broken on Windows post distlib ``0.3.9`` - by :user:`gaborbernat`.
3 changes: 2 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.
17 changes: 9 additions & 8 deletions tasks/__main__zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ def _register_distutils_finder(self): # noqa: C901
class Resource:
def __init__(self, path: str, name: str, loader: SourceLoader) -> None:
self.path = os.path.join(path, name)
self.name = name
self._name = name
self.loader = loader

@cached_property
def name(self) -> str:
return os.path.basename(self._name)

@property
def bytes(self) -> bytes:
return self.loader.get_data(self.name)
return self.loader.get_data(self._name)

@property
def is_container(self) -> bool:
Expand All @@ -91,8 +95,8 @@ def resources(self) -> list[str]:
return [
i.filename
for i in (
(j for j in zip_file.filelist if j.filename.startswith(f"{self.name}/"))
if self.name
(j for j in zip_file.filelist if j.filename.startswith(f"{self._name}/"))
if self._name
else zip_file.filelist
)
]
Expand Down Expand Up @@ -133,10 +137,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
4 changes: 2 additions & 2 deletions tasks/make_zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

HERE = Path(__file__).parent.absolute()

VERSIONS = [f"3.{i}" for i in range(10, 6, -1)]
VERSIONS = [f"3.{i}" for i in range(13, 7, -1)]


def main():
Expand All @@ -49,7 +49,7 @@ def create_zipapp(dest, packages):
zip_app.writestr("__main__.py", (HERE / "__main__zipapp.py").read_bytes())
bio.seek(0)
zipapp.create_archive(bio, dest)
print(f"zipapp created at {dest}") # noqa: T201
print(f"zipapp created at {dest} with size {os.path.getsize(dest) / 1024 / 1024:.2f}MB") # noqa: T201


def write_packages_to_zipapp(base, dist, modules, packages, zip_app): # noqa: C901, PLR0912
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
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env_list =
3.10
3.9
3.8
3.7
coverage
readme
docs
Expand Down

0 comments on commit 38b9e89

Please sign in to comment.