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

Setup Actions #15

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
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
77 changes: 77 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Python package

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
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"
- "python:3.12"
container: ${{ matrix.image }}-slim
steps:
- uses: actions/checkout@v1
- 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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down
4 changes: 2 additions & 2 deletions examples/logic.py
Original file line number Diff line number Diff line change
@@ -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-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.).
Licensed under AGPL-3.0-only.
"""

import re
Expand Down
4 changes: 2 additions & 2 deletions iso639/__init__.py
Original file line number Diff line number Diff line change
@@ -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-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.).
Licensed under AGPL-3.0-only.
"""

from __future__ import absolute_import
Expand Down
4 changes: 2 additions & 2 deletions iso639/iso639.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.).
Licensed under AGPL-3.0-only.
"""

# Fix for Python 3.0 - 3.2
Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES
testpaths = tests/tests.py README.rst
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.).
Licensed under AGPL-3.0-only.
"""

import sys
Expand Down Expand Up @@ -40,6 +40,12 @@
'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 :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Text Processing :: Linguistic',
Expand Down
14 changes: 9 additions & 5 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
"""
Python library for ISO 639 standard

Copyright (c) 2014-2016 Mikael Karlsson (CSC - IT Center for Science Ltd.).
Licensed under AGPLv3.
Copyright (c) 2014-2024 Mikael Karlsson (CSC - IT Center for Science Ltd.).
Licensed under AGPL-3.0-only.
"""

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
Expand Down Expand Up @@ -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
Expand Down
Loading