diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dd8db2..c9e4f35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,29 +12,32 @@ jobs: build: runs-on: ubuntu-20.04 strategy: + fail-fast: false matrix: include: - - python-version: 2.7 - toxenv: py27 - - python-version: 3.5 + - python-version: '3.5' toxenv: py35 - - python-version: 3.6 + - python-version: '3.6' toxenv: py36 - - python-version: 3.7 + - python-version: '3.7' toxenv: py37 - - python-version: 3.8 + - python-version: '3.8' toxenv: py38 - - python-version: 3.9 + - python-version: '3.9' toxenv: py39 - - python-version: pypy-2.7 - toxenv: pypy - - python-version: pypy-3.7 + - python-version: '3.10' + toxenv: py310 + - python-version: '3.11' + toxenv: py311 + - python-version: '3.12' + toxenv: py312 + - python-version: 'pypy-3.10' toxenv: pypy3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install tox diff --git a/README.md b/README.md index b77990a..2a78fc3 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,7 @@ do. IceCream, or `ic` for short, makes print debugging a little sweeter. 5. It optionally includes program context: filename, line number, and parent function. -IceCream is well tested, [permissively licensed](LICENSE.txt), and -supports Python 2, Python 3, PyPy2, and PyPy3. +IceCream is well tested, [permissively licensed](LICENSE.txt), and supports Python 3 and PyPy3. ### Inspect Variables diff --git a/icecream/icecream.py b/icecream/icecream.py index 7cc1c29..5350d8e 100644 --- a/icecream/icecream.py +++ b/icecream/icecream.py @@ -36,8 +36,6 @@ from .coloring import SolarizedDark -PYTHON2 = (sys.version_info[0] == 2) - _absent = object() @@ -50,7 +48,7 @@ def decorator(fn): @bindStaticVariable('formatter', Terminal256Formatter(style=SolarizedDark)) @bindStaticVariable( - 'lexer', PyLexer(ensurenl=False) if PYTHON2 else Py3Lexer(ensurenl=False)) + 'lexer', Py3Lexer(ensurenl=False)) def colorize(s): self = colorize return highlight(s, self.lexer, self.formatter) @@ -160,14 +158,6 @@ def formatPair(prefix, arg, value): def singledispatch(func): - if "singledispatch" not in dir(functools): - def unsupport_py2(*args, **kwargs): - raise NotImplementedError( - "functools.singledispatch is missing in " + sys.version - ) - func.register = func.unregister = unsupport_py2 - return func - func = functools.singledispatch(func) # add unregister based on https://stackoverflow.com/a/25951784 diff --git a/setup.py b/setup.py index f470d0f..f17ac1b 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def run(self): os.system('python setup.py sdist bdist_wheel') sdist = 'dist/icecream-%s.tar.gz' % meta['__version__'] - wheel = 'dist/icecream-%s-py2.py3-none-any.whl' % meta['__version__'] + wheel = 'dist/icecream-%s-py3-none-any.whl' % meta['__version__'] rc = os.system('twine upload "%s" "%s"' % (sdist, wheel)) sys.exit(rc) @@ -86,8 +86,6 @@ def run_tests(self): 'Topic :: Software Development :: Libraries', 'Development Status :: 4 - Beta', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', @@ -96,10 +94,13 @@ def run_tests(self): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: CPython', ], - tests_require=[], + tests_require=[ + 'tox>=4', + ], install_requires=[ 'colorama>=0.3.9', 'pygments>=2.2.0', diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_icecream.py b/tests/test_icecream.py index fced433..394eef4 100644 --- a/tests/test_icecream.py +++ b/tests/test_icecream.py @@ -15,10 +15,7 @@ import unittest import warnings -try: # Python 2.x. - from StringIO import StringIO -except ImportError: # Python 3.x. - from io import StringIO +from io import StringIO from contextlib import contextmanager from os.path import basename, splitext, realpath @@ -396,15 +393,6 @@ def testSingledispatchArgumentToString(self): def argumentToString_tuple(obj): return "Dispatching tuple!" - # Unsupport Python2 - if "singledispatch" not in dir(functools): - for attr in ("register", "unregister"): - with self.assertRaises(NotImplementedError): - getattr(argumentToString, attr)( - tuple, argumentToString_tuple - ) - return - # Prepare input and output x = (1, 2) default_output = ic.format(x) @@ -600,7 +588,7 @@ def testMultilineContainerArgs(self): list(range(15))]) lines = err.getvalue().strip().splitlines() - self.assertRegexpMatches( + self.assertRegex( lines[0], r'ic\| test_icecream.py:\d+ in testMultilineContainerArgs\(\)', ) diff --git a/tests/test_install.py b/tests/test_install.py index 61f9a79..6860fd7 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -13,10 +13,10 @@ import unittest import icecream -from test_icecream import ( +from .test_icecream import ( disableColoring, captureStandardStreams, parseOutputIntoPairs) -from install_test_import import runMe +from .install_test_import import runMe class TestIceCreamInstall(unittest.TestCase): diff --git a/tox.ini b/tox.ini index 0652468..fe311b4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,7 @@ [tox] -envlist = py27, py35, py36, py37, py38, py39, pypy, pypy3 +envlist = py35, py36, py37, py38, py39, py310, py311, py312, pypy3 [testenv] -deps = - nose +description = run unittest commands = - nosetests --exe [] + python -m unittest