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 EOL Python 2.7 and 3.5 #117

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 4 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "pypy-2.7"
- "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
Expand All @@ -43,11 +42,6 @@ jobs:
python-version: "pypy-3.6"
- os: ubuntu-20.04
python-version: "3.6"
- os: ubuntu-20.04
python-version: "3.5"
- os: ubuntu-20.04
container: python:2.7-buster
python-version: "2.7"

runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
Expand Down Expand Up @@ -77,22 +71,13 @@ jobs:
echo IS_PYPY=$IS_PYPY >>$GITHUB_ENV
echo TOX_PYTHON=$V >>$GITHUB_ENV

if [[ ${{ matrix.python-version }} = *2.7 ]]; then
python -m pip install tox
else
python -Im pip install tox
fi
python -Im pip install tox

- name: Prepare sdist and source-dir
shell: bash
run: |
if [[ ${{ matrix.python-version }} = *2.7 ]]; then
python -m pip install build
python -m build
else
python -Im pip install build
python -Im build
fi
python -Im pip install build
python -Im build

mkdir source-dir
tar -xzvf dist/wcwidth-*.tar.gz -C source-dir --strip-components=1
Expand All @@ -101,11 +86,7 @@ jobs:
shell: bash
working-directory: ./source-dir
run: |
if [[ ${{ matrix.python-version }} = *2.7 ]]; then
python -m tox -e ${{ env.TOX_PYTHON }}
else
python -Im tox -e ${{ env.TOX_PYTHON }}
fi
python -Im tox -e ${{ env.TOX_PYTHON }}

- name: Rename coverage data
shell: bash
Expand Down
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ matrix:
include:
- python: 3.8
env: TOXENV=update,compile,autopep8,docformatter,isort,pylint,flake8,flake8_tests,pydocstyle,docs COVERAGE_ID=travis-ci
- python: 2.7
env: TOXENV=py27,codecov COVERAGE_ID=travis-ci
- python: 3.4
env: TOXENV=py34,codecov COVERAGE_ID=travis-ci
- python: 3.5
env: TOXENV=py35,codecov COVERAGE_ID=travis-ci
- python: 3.6
env: TOXENV=py36,codecov COVERAGE_ID=travis-ci
- python: 3.7
Expand Down
23 changes: 9 additions & 14 deletions bin/wcwidth-browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# Invalid constant name "echo"
# Invalid constant name "flushout" (col 4)
# Invalid module name "wcwidth-browser"
from __future__ import division, print_function

# std imports
import sys
Expand All @@ -44,7 +43,7 @@

#: printable length of highest unicode character description
LIMIT_UCS = 0x3fffd
UCS_PRINTLEN = len('{value:0x}'.format(value=LIMIT_UCS))
UCS_PRINTLEN = len(f'{LIMIT_UCS:0x}')


def readline(term, width):
Expand All @@ -69,7 +68,7 @@ def readline(term, width):
return text


class WcWideCharacterGenerator(object):
class WcWideCharacterGenerator:
"""Generator yields unicode characters of the given ``width``."""

# pylint: disable=R0903
Expand Down Expand Up @@ -101,7 +100,7 @@ def __next__(self):
return (ucs, name)


class WcCombinedCharacterGenerator(object):
class WcCombinedCharacterGenerator:
"""Generator yields unicode characters with combining."""

# pylint: disable=R0903
Expand Down Expand Up @@ -148,11 +147,8 @@ def __next__(self):
continue
return (ucs, name)

# python 2.6 - 3.3 compatibility
next = __next__


class Style(object):
class Style:
"""Styling decorator class instance for terminal output."""

# pylint: disable=R0903
Expand Down Expand Up @@ -184,7 +180,7 @@ def __init__(self, **kwargs):
setattr(self, key, val)


class Screen(object):
class Screen:
"""Represents terminal style, data dimensions, and drawables."""

intro_msg_fmt = ('Delimiters ({delim}) should align, '
Expand Down Expand Up @@ -217,8 +213,7 @@ def head_item(self):
"""Text of a single column heading."""
delimiter = self.style.attr_minor(self.style.delimiter)
hint = self.style.header_hint * self.wide
heading = ('{delimiter}{hint}{delimiter}'
.format(delimiter=delimiter, hint=hint))
heading = f'{delimiter}{hint}{delimiter}'

def alignment(*args):
if self.style.alignment == 'right':
Expand Down Expand Up @@ -264,7 +259,7 @@ def page_size(self):
return self.num_rows * self.num_columns


class Pager(object):
class Pager:
"""A less(1)-like browser for browsing unicode characters."""
# pylint: disable=too-many-instance-attributes

Expand Down Expand Up @@ -570,10 +565,10 @@ def draw_status(self, writer, idx):
if idx == self.last_page:
last_end = '(END)'
else:
last_end = '/{0}'.format(self.last_page)
last_end = f'/{self.last_page}'
txt = ('Page {idx}{last_end} - '
'{q} to quit, [keys: {keyset}]'
.format(idx=style.attr_minor('{0}'.format(idx)),
.format(idx=style.attr_minor(f'{idx}'),
last_end=style.attr_major(last_end),
keyset=style.attr_major('kjfbvc12-='),
q=style.attr_minor('q')))
Expand Down
21 changes: 3 additions & 18 deletions bin/wcwidth-libc-comparator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# coding: utf-8
"""
Manual tests comparing wcwidth.py to libc's wcwidth(3) and wcswidth(3).

Expand All @@ -18,7 +17,6 @@
# Invalid module name "wcwidth-libc-comparator"

# standard imports
from __future__ import print_function

# std imports
import sys
Expand Down Expand Up @@ -64,25 +62,12 @@ def report_ucs_msg(ucs, wcwidth_libc, wcwidth_local):
.decode('ascii')
.upper()
.lstrip('0'))
url = "http://codepoints.net/U+{}".format(ucp)
url = f"http://codepoints.net/U+{ucp}"
name = unicodedata.name(ucs)
return (u"libc,ours={},{} [--o{}o--] name={} val={} {}"
return ("libc,ours={},{} [--o{}o--] name={} val={} {}"
" ".format(wcwidth_libc, wcwidth_local, ucs, name, ord(ucs), url))


# use chr() for py3.x,
# unichr() for py2.x
try:
_ = unichr(0)
except NameError as err:
if err.args[0] == "name 'unichr' is not defined":
# pylint: disable=W0622
# Redefining built-in 'unichr' (col 8)

unichr = chr
else:
raise

if sys.maxunicode < 1114111:
warnings.warn('narrow Python build, only a small subset of '
'characters may be tested.')
Expand All @@ -108,7 +93,7 @@ def main(using_locale=('en_US', 'UTF-8',)):
report a detailed AssertionError to stdout.
"""
all_ucs = (ucs for ucs in
[unichr(val) for val in range(sys.maxunicode)]
[chr(val) for val in range(sys.maxunicode)]
if is_named(ucs) and is_not_combining(ucs))

libc_name = ctypes.util.find_library('c')
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# wcwidth documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 20 15:18:02 2017.
Expand Down
2 changes: 1 addition & 1 deletion docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Install wcwidth in editable mode::

Execute unit tests using tox_::

tox -e py27,py35,py36,py37,py38,py39,py310,py311,py312
tox -e py36,py37,py38,py39,py310,py311,py312

Updating Unicode Version
------------------------
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,21 @@ def main():
_get_here('README.rst'), 'rb', 'utf8').read(),
author='Jeff Quast',
author_email='[email protected]',
install_requires=('backports.functools-lru-cache>=1.2.1;'
'python_version < "3.2"'),
license='MIT',
packages=['wcwidth'],
url='https://github.com/jquast/wcwidth',
package_data={
'': ['LICENSE', '*.rst'],
},
zip_safe=True,
python_requires='>=3.6',
classifiers=[
'Intended Audience :: Developers',
'Natural Language :: English',
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
Loading
Loading