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 support for Python 3.7 which is end-of-life #3100

Merged
merged 7 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
jsonschema-version: ["3.0", "4.17"]
name: py ${{ matrix.python-version }} js ${{ matrix.jsonschema-version }}
steps:
Expand Down
6 changes: 1 addition & 5 deletions altair/utils/_vegafusion_data.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import sys
from toolz import curried
import uuid
from weakref import WeakValueDictionary

from typing import Union, Dict, Set, MutableMapping

if sys.version_info >= (3, 8):
from typing import TypedDict, Final
else:
from typing_extensions import TypedDict, Final
from typing import TypedDict, Final

from altair.utils.core import _DataFrameLike
from altair.utils.data import _DataType, _ToValuesReturnType, MaxRowsError
Expand Down
5 changes: 1 addition & 4 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
else:
from typing_extensions import ParamSpec

if sys.version_info >= (3, 8):
from typing import Literal, Protocol
else:
from typing_extensions import Literal, Protocol
from typing import Literal, Protocol

try:
from pandas.api.types import infer_dtype as _infer_dtype
Expand Down
6 changes: 1 addition & 5 deletions altair/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import random
import hashlib
import sys
import warnings
from typing import Union, MutableMapping, Optional, Dict, Sequence, TYPE_CHECKING, List
from types import ModuleType
Expand All @@ -17,10 +16,7 @@
from .plugin_registry import PluginRegistry


if sys.version_info >= (3, 8):
from typing import Protocol, TypedDict, Literal
else:
from typing_extensions import Protocol, TypedDict, Literal
from typing import Protocol, TypedDict, Literal


if TYPE_CHECKING:
Expand Down
10 changes: 1 addition & 9 deletions altair/utils/execeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
import sys


if sys.version_info > (3, 8):
Module = ast.Module
else:
# Mock the Python >= 3.8 API
def Module(nodelist, type_ignores):
return ast.Module(nodelist)


class _CatchDisplay:
"""Class to temporarily catch sys.displayhook"""

Expand Down Expand Up @@ -48,7 +40,7 @@ def eval_block(code, namespace=None, filename="<string>"):
to_exec, to_eval = tree.body, []

for node in to_exec:
compiled = compile(Module([node], []), filename=filename, mode="exec")
compiled = compile(ast.Module([node], []), filename=filename, mode="exec")
exec(compiled, namespace)

with catch_display:
Expand Down
6 changes: 1 addition & 5 deletions altair/utils/plugin_registry.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import sys
from typing import Any, Dict, List, Optional, Generic, TypeVar, cast
from types import TracebackType

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

from toolz import curry

Expand Down
7 changes: 1 addition & 6 deletions altair/vegalite/v5/compiler.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import sys

from ...utils.compiler import VegaLiteCompilerRegistry

if sys.version_info >= (3, 8):
from typing import Final
else:
from typing_extensions import Final
from typing import Final


ENTRY_POINT_GROUP: Final = "altair.vegalite.v5.vegalite_compiler"
Expand Down
7 changes: 1 addition & 6 deletions altair/vegalite/v5/data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

from ..data import (
MaxRowsError,
curry,
Expand All @@ -15,10 +13,7 @@

from ...utils._vegafusion_data import vegafusion_data_transformer

if sys.version_info >= (3, 8):
from typing import Final
else:
from typing_extensions import Final
from typing import Final


# ==============================================================================
Expand Down
6 changes: 1 addition & 5 deletions altair/vegalite/v5/display.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys
from typing import Dict

from ...utils.mimebundle import spec_to_mimebundle
Expand All @@ -14,10 +13,7 @@

from .schema import SCHEMA_VERSION

if sys.version_info >= (3, 8):
from typing import Final
else:
from typing_extensions import Final
from typing import Final

VEGALITE_VERSION: Final = SCHEMA_VERSION.lstrip("v")
VEGA_VERSION: Final = "5"
Expand Down
5 changes: 1 addition & 4 deletions altair/vegalite/v5/schema/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
from altair.utils import parse_shorthand
from typing import overload, List

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from typing import Literal


class FieldChannelMixin:
Expand Down
8 changes: 1 addition & 7 deletions altair/vegalite/v5/theme.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tools for enabling and registering chart themes"""
import sys
from typing import Dict, Union
from typing import Dict, Union, Final

from ...utils.theme import ThemeRegistry

Expand All @@ -17,11 +16,6 @@
"powerbi",
]

if sys.version_info >= (3, 8):
from typing import Final
else:
from typing_extensions import Final


class VegaTheme:
"""Implementation of a builtin vega theme."""
Expand Down
1 change: 1 addition & 0 deletions doc/releases/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Bug Fixes

Backward-Incompatible Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Drop support for Python 3.7 which is end-of-life (#3100).

Version 5.0.1 (released May 26, 2023)
-------------------------------------
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ build-backend = "hatchling.build"
name = "altair"
authors = [ {name = "Vega-Altair Contributors"} ]
dependencies = [
"importlib_metadata; python_version<\"3.8\"",
"typing_extensions>=4.0.1; python_version<\"3.11\"",
"jinja2",
"jsonschema>=3.0",
Expand All @@ -34,7 +33,7 @@ keywords = [
"json",
"vega-lite",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dynamic = ["version"]
license-files = { paths = ["LICENSE"] }
classifiers= [
Expand All @@ -43,7 +42,6 @@ classifiers= [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down Expand Up @@ -153,7 +151,7 @@ publish-clean-build = [

[tool.black]
line-length = 88
target-version = ["py37", "py38", "py39", "py310", "py311"]
target-version = ["py38", "py39", "py310", "py311"]
include = '\.pyi?$'
extend-exclude = '''
/(
Expand All @@ -170,7 +168,7 @@ extend-exclude = '''
'''

[tool.ruff]
target-version = "py310"
target-version = "py38"
line-length = 88
select = [
# flake8-bugbear
Expand Down
5 changes: 1 addition & 4 deletions tools/generate_schema_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,7 @@ def generate_vegalite_channel_wrappers(schemafile, version, imports=None):
"from altair.utils import parse_shorthand",
"from typing import overload, List",
"",
"if sys.version_info >= (3, 8):",
" from typing import Literal",
"else:",
" from typing_extensions import Literal",
"from typing import Literal",
]
contents = [HEADER]
contents.extend(imports)
Expand Down
5 changes: 1 addition & 4 deletions tools/update_init_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
else:
from typing_extensions import Self

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from typing import Literal

# Import Altair from head
ROOT_DIR = abspath(join(dirname(__file__), ".."))
Expand Down