Skip to content

Commit 2d8463e

Browse files
Copilotstefankoegl
andcommitted
Drop Python 2.7, 3.7, 3.8 support - update config and remove compatibility code
Co-authored-by: stefankoegl <184196+stefankoegl@users.noreply.github.com>
1 parent 41f2bd3 commit 2d8463e

File tree

5 files changed

+21
-38
lines changed

5 files changed

+21
-38
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ exclude_lines =
1111
# No need to test __repr__
1212
def __repr__
1313

14-
# Python 2/3 compatibility
14+
# Import fallbacks
1515
except ImportError

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ]
42+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
4343

4444
steps:
4545
- uses: actions/checkout@v4

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ python-json-pointer
77
===================
88

99
*python-json-pointer* is a Python library for resolving JSON pointers (`RFC
10-
6901 <http://tools.ietf.org/html/rfc6901>`_). Python 2.7, 3.4+
10+
6901 <http://tools.ietf.org/html/rfc6901>`_). Python 3.9+
1111
and PyPy are supported.
1212

1313
**Contents**

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
'Operating System :: OS Independent',
3939
'Programming Language :: Python',
4040
'Programming Language :: Python :: 3',
41-
'Programming Language :: Python :: 3.7',
42-
'Programming Language :: Python :: 3.8',
4341
'Programming Language :: Python :: 3.9',
4442
'Programming Language :: Python :: 3.10',
4543
'Programming Language :: Python :: 3.11',
@@ -62,5 +60,5 @@
6260
py_modules=MODULES,
6361
scripts=['bin/jsonpointer'],
6462
classifiers=CLASSIFIERS,
65-
python_requires='>=3.7',
63+
python_requires='>=3.9',
6664
)

tests.py

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
from __future__ import unicode_literals
5-
64
import copy
75
import doctest
8-
import sys
96
import unittest
107

118
import jsonpointer
@@ -78,45 +75,33 @@ def test_round_trip(self):
7875

7976
def test_str_and_repr(self):
8077
paths = [
81-
("", "", "JsonPointer({u}'')"),
82-
("/foo", "/foo", "JsonPointer({u}'/foo')"),
83-
("/foo/0", "/foo/0", "JsonPointer({u}'/foo/0')"),
84-
("/", "/", "JsonPointer({u}'/')"),
85-
("/a~1b", "/a~1b", "JsonPointer({u}'/a~1b')"),
86-
("/c%d", "/c%d", "JsonPointer({u}'/c%d')"),
87-
("/e^f", "/e^f", "JsonPointer({u}'/e^f')"),
88-
("/g|h", "/g|h", "JsonPointer({u}'/g|h')"),
89-
("/i\\j", "/i\\j", "JsonPointer({u}'/i\\\\j')"),
90-
("/k\"l", "/k\"l", "JsonPointer({u}'/k\"l')"),
91-
("/ ", "/ ", "JsonPointer({u}'/ ')"),
92-
("/m~0n", "/m~0n", "JsonPointer({u}'/m~0n')"),
78+
("", "", "JsonPointer('')"),
79+
("/foo", "/foo", "JsonPointer('/foo')"),
80+
("/foo/0", "/foo/0", "JsonPointer('/foo/0')"),
81+
("/", "/", "JsonPointer('/')"),
82+
("/a~1b", "/a~1b", "JsonPointer('/a~1b')"),
83+
("/c%d", "/c%d", "JsonPointer('/c%d')"),
84+
("/e^f", "/e^f", "JsonPointer('/e^f')"),
85+
("/g|h", "/g|h", "JsonPointer('/g|h')"),
86+
("/i\\j", "/i\\j", "JsonPointer('/i\\\\j')"),
87+
("/k\"l", "/k\"l", "JsonPointer('/k\"l')"),
88+
("/ ", "/ ", "JsonPointer('/ ')"),
89+
("/m~0n", "/m~0n", "JsonPointer('/m~0n')"),
9390
]
9491
for path, ptr_str, ptr_repr in paths:
9592
ptr = JsonPointer(path)
9693
self.assertEqual(path, ptr.path)
97-
98-
if sys.version_info[0] == 2:
99-
u_str = "u"
100-
else:
101-
u_str = ""
10294
self.assertEqual(ptr_str, str(ptr))
103-
self.assertEqual(ptr_repr.format(u=u_str), repr(ptr))
104-
105-
if sys.version_info[0] == 2:
106-
path = "/\xee"
107-
ptr_str = b"/\xee"
108-
ptr_repr = "JsonPointer(u'/\\xee')"
109-
else:
110-
path = "/\xee"
111-
ptr_str = "/\xee"
112-
ptr_repr = "JsonPointer('/\xee')"
95+
self.assertEqual(ptr_repr, repr(ptr))
96+
97+
path = "/\xee"
98+
ptr_str = "/\xee"
99+
ptr_repr = "JsonPointer('/\xee')"
113100
ptr = JsonPointer(path)
114101
self.assertEqual(path, ptr.path)
115-
116102
self.assertEqual(ptr_str, str(ptr))
117103
self.assertEqual(ptr_repr, repr(ptr))
118104

119-
# should not be unicode in Python 2
120105
self.assertIsInstance(str(ptr), str)
121106
self.assertIsInstance(repr(ptr), str)
122107

0 commit comments

Comments
 (0)