From e3a26b12372edb22cf03754ca07d2341572674a2 Mon Sep 17 00:00:00 2001 From: Juho Inkinen <34240031+juhoinkinen@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:43:08 +0200 Subject: [PATCH 1/3] Drop Python 3.8 support --- .github/workflows/cicd.yml | 20 ++++++++------------ .scrutinizer.yml | 2 +- README.md | 2 +- pyproject.toml | 3 +-- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 3de7dfa57..716bccddc 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -23,7 +23,7 @@ jobs: - name: "Prepare: restore caches, install Poetry, set up Python" uses: ./.github/actions/prepare with: - python-version: "3.10" + python-version: "3.11" poetry-version: ${{ env.POETRY_VERSION }} - name: Install Python dev dependencies run: | @@ -47,7 +47,7 @@ jobs: id: prepare uses: ./.github/actions/prepare with: - python-version: "3.9" + python-version: "3.10" poetry-version: ${{ env.POETRY_VERSION }} - name: Install Python dependencies run: | @@ -61,7 +61,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11"] name: test on Python ${{ matrix.python-version }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -79,19 +79,15 @@ jobs: - name: Install Python dependencies run: | # Selectively install the optional dependencies for some Python versions - # For Python 3.8: - if [[ ${{ matrix.python-version }} == '3.8' ]]; then - poetry install -E "nn omikuji yake voikko stwfsa"; - fi # For Python 3.9: if [[ ${{ matrix.python-version }} == '3.9' ]]; then - poetry install -E "fasttext spacy"; - # download the small English pretrained spaCy model needed by spacy analyzer - poetry run python -m spacy download en_core_web_sm --upgrade-strategy only-if-needed + poetry install -E "nn omikuji yake voikko stwfsa"; fi # For Python 3.10: if [[ ${{ matrix.python-version }} == '3.10' ]]; then - poetry install -E "nn omikuji yake stwfsa"; + poetry install -E "fasttext spacy"; + # download the small English pretrained spaCy model needed by spacy analyzer + poetry run python -m spacy download en_core_web_sm --upgrade-strategy only-if-needed fi # For Python 3.11: if [[ ${{ matrix.python-version }} == '3.11' ]]; then @@ -103,7 +99,7 @@ jobs: - name: Test with pytest run: | poetry run pytest --cov=./ --cov-report xml - if [[ ${{ matrix.python-version }} == '3.9' ]]; then + if [[ ${{ matrix.python-version }} == '3.10' ]]; then poetry run pytest --cov=./ --cov-report xml --cov-append -m slow fi - name: Upload coverage to Codecov diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ebf755aa4..095b59f43 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -4,7 +4,7 @@ checks: duplicate_code: true build: environment: - python: 3.8.12 + python: 3.9.17 dependencies: override: - pip install .[dev] diff --git a/README.md b/README.md index e549a20b9..8bb1bcaa3 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ already functional for many common tasks. Annif is developed and tested on Linux. If you want to run Annif on Windows or Mac OS, the recommended way is to use Docker (see below) or a Linux virtual machine. -You will need Python 3.8+ to install Annif. +You will need Python 3.9+ to install Annif. The recommended way is to install Annif from [PyPI](https://pypi.org/project/annif/) into a virtual environment. diff --git a/pyproject.toml b/pyproject.toml index 1aebd8fbb..1a51caf9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers=[ ] [tool.poetry.dependencies] -python = ">=3.8,<3.12" +python = ">=3.9,<3.12" connexion = {version = "2.14.2", extras = ["swagger-ui"]} flask = "2.2.*" @@ -52,7 +52,6 @@ jsonschema = "4.17.*" fasttext-wheel = {version = "0.9.2", optional = true} voikko = {version = "0.5.*", optional = true} tensorflow-cpu = {version = "2.13.*", optional = true} -tensorflow-io-gcs-filesystem = {version = "<=0.34.*", optional = true, python = "3.8"} lmdb = {version = "1.4.1", optional = true} omikuji = {version = "0.5.*", optional = true} yake = {version = "0.4.5", optional = true} From f04f0be3ba9c9e7fb3fd8e02703ca7312fa6d82e Mon Sep 17 00:00:00 2001 From: Juho Inkinen <34240031+juhoinkinen@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:04:49 +0200 Subject: [PATCH 2/3] Resolve complaint by flake (E721) --- annif/backend/yake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/annif/backend/yake.py b/annif/backend/yake.py index 8f7d38c50..2eeef9a9c 100644 --- a/annif/backend/yake.py +++ b/annif/backend/yake.py @@ -51,7 +51,7 @@ def is_trained(self): @property def label_types(self) -> list[URIRef]: - if type(self.params["label_types"]) == str: # Label types set by user + if isinstance(self.params["label_types"], str): # Label types set by user label_types = [lt.strip() for lt in self.params["label_types"].split(",")] self._validate_label_types(label_types) else: From ec7b79a0ab0796483f692df79887c50fe77b9095 Mon Sep 17 00:00:00 2001 From: Juho Inkinen <34240031+juhoinkinen@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:54:23 +0200 Subject: [PATCH 3/3] Remove obsolete dependency tensorflow-io-gcs-filesystem --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1a51caf9c..6a06219b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ schemathesis = "3.*.*" [tool.poetry.extras] fasttext = ["fasttext-wheel"] voikko = ["voikko"] -nn = ["tensorflow-cpu", "tensorflow-io-gcs-filesystem", "lmdb"] +nn = ["tensorflow-cpu", "lmdb"] omikuji = ["omikuji"] yake = ["yake"] spacy = ["spacy"]