From cff215201fa8341a56b627e86fc3b2e9f447a82b Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Fri, 8 Sep 2023 23:18:32 +0300 Subject: [PATCH 01/10] Add pytest.ini --- pytest.ini | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..85efa54 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES +testpaths = tests/tests.py README.rst From 116774e3b374e5222db2cec6ff99abbaf5bf5281 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Fri, 8 Sep 2023 23:18:32 +0300 Subject: [PATCH 02/10] Create python-package.yml --- .github/workflows/python-package.yml | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..7a60116 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,76 @@ +name: Python package + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Lint with flake8 + run: | + pip install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + image: + - "pypy:2.7" + - "pypy:3.5" + - "pypy:3.6" + - "pypy:3.7" + - "pypy:3.8" + - "pypy:3.9" + - "pypy:3.10" + - "python:2.7" + - "python:3.2" + - "python:3.3" + - "python:3.4" + - "python:3.5" + - "python:3.6" + - "python:3.7" + - "python:3.8" + - "python:3.9" + - "python:3.10" + - "python:3.11" + container: ${{ matrix.image }}-slim + steps: + - uses: actions/checkout@v3 + - name: Install dependencies + run: | + # pip install --upgrade pip + command -v python3.2 && export PYTEST_VERSION='<3' + pip install pytest$PYTEST_VERSION pycountry==1.11 + pip install -e . + - name: Test with pytest + run: | + py.test + test-py26: + runs-on: ubuntu-latest + container: centos:6 + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: | + # sed -i '/^mirrorlist/s/^/#/;/^#baseurl/{s/#//;s/mirror.centos.org/vault.centos.org/}' /etc/yum.repos.d/*B* + # yum clean all + # yum upgrade -y + # yum install -y epel-release + curl https://pylegacy.org/hub/get-pip-pyopenssl.py | python + pip install unittest2 pytest pycountry==1.11 + pip install -e . + - name: Test with pytest + run: | + py.test From 94a47e0d06f0c9a4be1771e66d08b2ee8cc78eb3 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Fri, 8 Sep 2023 23:18:32 +0300 Subject: [PATCH 03/10] Update copyright and license --- README.rst | 2 +- examples/logic.py | 4 ++-- iso639/__init__.py | 4 ++-- iso639/iso639.py | 4 ++-- setup.py | 4 ++-- tests/tests.py | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index f07c310..8c4db8a 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ Status License ------- -GNU Affero General Public License version 3 (AGPLv3) +GNU Affero General Public License version 3.0 only (AGPL-3.0-only) Supports -------- diff --git a/examples/logic.py b/examples/logic.py index fc8bb44..0023d8d 100644 --- a/examples/logic.py +++ b/examples/logic.py @@ -1,8 +1,8 @@ """ Python library for ISO 639 standard -Copyright (c) 2014 Mikael Karlsson (CSC - IT Center for Science Ltd.). -Licensed under AGPLv3. +Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Licensed under AGPL-3.0-only. """ import re diff --git a/iso639/__init__.py b/iso639/__init__.py index e6777c9..1b68010 100644 --- a/iso639/__init__.py +++ b/iso639/__init__.py @@ -1,8 +1,8 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2016 Mikael Karlsson (CSC - IT Center for Science Ltd.). -Licensed under AGPLv3. +Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Licensed under AGPL-3.0-only. """ from __future__ import absolute_import diff --git a/iso639/iso639.py b/iso639/iso639.py index f66ec1c..d1f40d8 100644 --- a/iso639/iso639.py +++ b/iso639/iso639.py @@ -2,8 +2,8 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2016 Mikael Karlsson (CSC - IT Center for Science Ltd.). -Licensed under AGPLv3. +Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Licensed under AGPL-3.0-only. """ # Fix for Python 3.0 - 3.2 diff --git a/setup.py b/setup.py index 9bf77c4..ebc52ad 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2017 Mikael Karlsson (CSC - IT Center for Science Ltd.). -Licensed under AGPLv3. +Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Licensed under AGPL-3.0-only. """ import sys diff --git a/tests/tests.py b/tests/tests.py index 1f22e71..7a017e3 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -2,8 +2,8 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2016 Mikael Karlsson (CSC - IT Center for Science Ltd.). -Licensed under AGPLv3. +Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Licensed under AGPL-3.0-only. """ import sys From df2355a6c1d0d5b57845b01a0768370697e8f188 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Fri, 8 Sep 2023 23:18:33 +0300 Subject: [PATCH 04/10] Fix collections import --- tests/tests.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index 7a017e3..c81134b 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -7,13 +7,17 @@ """ import sys -import collections if sys.version_info[0:2] == (2, 6): import unittest2 as unittest else: import unittest +if sys.version_info[0] == 3 and sys.version_info[1] > 2: + from collections.abc import Iterable, Iterator +else: + from collections import Iterable, Iterator + from iso639 import Iso639, languages from examples.logic import map_language from pycountry import languages as pclanguages @@ -112,8 +116,8 @@ def test_len(self): self.assertEqual(len(languages), 7981) def test_iter(self): - self.assertIsInstance(languages, collections.Iterable) - self.assertIsInstance(iter(languages), collections.Iterator) + self.assertIsInstance(languages, Iterable) + self.assertIsInstance(iter(languages), Iterator) def test_exceptions(self): self.assertRaises(KeyError, languages.get, part1='En') # Wrong value From e4ae5328c50a60b14f7254e8133ff186585c713b Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Fri, 8 Sep 2023 23:18:33 +0300 Subject: [PATCH 05/10] Update setup.py --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py index ebc52ad..7bdefb3 100644 --- a/setup.py +++ b/setup.py @@ -40,6 +40,11 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Text Processing :: Linguistic', From 9511fa3933e19ea91bea9193a57313a675f06eae Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Wed, 7 Feb 2024 19:22:02 +0200 Subject: [PATCH 06/10] Add Python 3.12 --- .github/workflows/python-package.yml | 1 + setup.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7a60116..5350e20 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -45,6 +45,7 @@ jobs: - "python:3.9" - "python:3.10" - "python:3.11" + - "python:3.12" container: ${{ matrix.image }}-slim steps: - uses: actions/checkout@v3 diff --git a/setup.py b/setup.py index 7bdefb3..4a4e0cc 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Text Processing :: Linguistic', From 4845718204fefdb2592952b8834f2cf7037344a1 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Mon, 2 Sep 2024 16:24:52 +0300 Subject: [PATCH 07/10] Update copyright --- examples/logic.py | 2 +- iso639/__init__.py | 2 +- iso639/iso639.py | 2 +- setup.py | 2 +- tests/tests.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/logic.py b/examples/logic.py index 0023d8d..5b34f43 100644 --- a/examples/logic.py +++ b/examples/logic.py @@ -1,7 +1,7 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Copyright (c) 2014-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.). Licensed under AGPL-3.0-only. """ diff --git a/iso639/__init__.py b/iso639/__init__.py index 1b68010..b3ec62d 100644 --- a/iso639/__init__.py +++ b/iso639/__init__.py @@ -1,7 +1,7 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Copyright (c) 2014-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.). Licensed under AGPL-3.0-only. """ diff --git a/iso639/iso639.py b/iso639/iso639.py index d1f40d8..bffcd93 100644 --- a/iso639/iso639.py +++ b/iso639/iso639.py @@ -2,7 +2,7 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Copyright (c) 2014-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.). Licensed under AGPL-3.0-only. """ diff --git a/setup.py b/setup.py index 4a4e0cc..df9557f 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Copyright (c) 2014-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.). Licensed under AGPL-3.0-only. """ diff --git a/tests/tests.py b/tests/tests.py index c81134b..e942841 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -2,7 +2,7 @@ """ Python library for ISO 639 standard -Copyright (c) 2014-2023 Mikael Karlsson (CSC - IT Center for Science Ltd.). +Copyright (c) 2014-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.). Licensed under AGPL-3.0-only. """ From d26cf2b0ea548f3d664fd2bf12d014f50ac3f2b9 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Mon, 2 Sep 2024 16:42:30 +0300 Subject: [PATCH 08/10] Bump actions/checkout --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 5350e20..3c7edf4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.10" @@ -48,7 +48,7 @@ jobs: - "python:3.12" container: ${{ matrix.image }}-slim steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: | # pip install --upgrade pip From 8c7765a0cd7184cd219ed3a1088adc2effbe72e0 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Mon, 2 Sep 2024 16:54:58 +0300 Subject: [PATCH 09/10] Bump actions/setup-python --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 3c7edf4..7c8399b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" - name: Lint with flake8 From 566f4773cf97594b1d86d85da32e3d0db7b0601e Mon Sep 17 00:00:00 2001 From: Mikael Karlsson Date: Mon, 2 Sep 2024 18:26:17 +0300 Subject: [PATCH 10/10] Change actions/checkout --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7c8399b..ff22092 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -48,7 +48,7 @@ jobs: - "python:3.12" container: ${{ matrix.image }}-slim steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v1 - name: Install dependencies run: | # pip install --upgrade pip