From 33915abfdc6f70e4dc7a58652b8557b0b5d7e7b6 Mon Sep 17 00:00:00 2001 From: Tom Aarsen <37621491+tomaarsen@users.noreply.github.com> Date: Tue, 12 Dec 2023 12:19:13 +0100 Subject: [PATCH] [`deprecate`] Remove Python 3.7 support (#2375) * Deprecate Python 3.7 (and 3.6) * Import Literal from typing --- .github/workflows/tests.yml | 2 +- README.md | 2 +- docs/installation.md | 2 +- index.rst | 2 +- sentence_transformers/SentenceTransformer.py | 6 +----- setup.py | 4 ++-- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 548051825..4507f66c2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: name: Run unit tests strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] os: [ubuntu-latest, windows-latest] fail-fast: false runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 6e95999ca..0a094b100 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The following publications are integrated in this framework: ## Installation -We recommend **Python 3.6** or higher, **[PyTorch 1.6.0](https://pytorch.org/get-started/locally/)** or higher and **[transformers v4.6.0](https://github.com/huggingface/transformers)** or higher. The code does **not** work with Python 2.7. +We recommend **Python 3.8** or higher, **[PyTorch 1.6.0](https://pytorch.org/get-started/locally/)** or higher and **[transformers v4.23.0](https://github.com/huggingface/transformers)** or higher. The code does **not** work with Python 2.7. **Install with pip** diff --git a/docs/installation.md b/docs/installation.md index ababc1e81..9200c5123 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,6 +1,6 @@ # Installation -We recommend **Python 3.6** or higher, **[PyTorch 1.6.0](https://pytorch.org/get-started/locally/)** or higher and **[transformers v4.6.0](https://github.com/huggingface/transformers)** or higher. The code does **not** work with Python 2.7. +We recommend **Python 3.8** or higher, **[PyTorch 1.6.0](https://pytorch.org/get-started/locally/)** or higher and **[transformers v4.6.0](https://github.com/huggingface/transformers)** or higher. The code does **not** work with Python 2.7. diff --git a/index.rst b/index.rst index 74d559486..10b156d57 100644 --- a/index.rst +++ b/index.rst @@ -18,7 +18,7 @@ You can install it using pip: pip install -U sentence-transformers -We recommend **Python 3.6** or higher, and at least **PyTorch 1.6.0**. See `installation `_ for further installation options, especially if you want to use a GPU. +We recommend **Python 3.8** or higher, and at least **PyTorch 1.6.0**. See `installation `_ for further installation options, especially if you want to use a GPU. diff --git a/sentence_transformers/SentenceTransformer.py b/sentence_transformers/SentenceTransformer.py index 7a8d772a1..355fadbdc 100644 --- a/sentence_transformers/SentenceTransformer.py +++ b/sentence_transformers/SentenceTransformer.py @@ -4,11 +4,7 @@ import shutil import stat from collections import OrderedDict -from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional -try: - from typing import Literal -except ImportError: - from typing_extensions import Literal +from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional, Literal import numpy as np from numpy import ndarray import transformers diff --git a/setup.py b/setup.py index 6df3e1e57..baff91e65 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ url="https://www.SBERT.net", download_url="https://github.com/UKPLab/sentence-transformers/", packages=find_packages(), - python_requires=">=3.6.0", + python_requires=">=3.8.0", install_requires=[ 'transformers>=4.6.0,<5.0.0', 'tqdm', @@ -34,7 +34,7 @@ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.8", "Topic :: Scientific/Engineering :: Artificial Intelligence" ], keywords="Transformer Networks BERT XLNet sentence embedding PyTorch NLP deep learning"