diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7ec5232..befd853 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,10 +19,10 @@ jobs: with: ref: ${{ github.ref }} - - name: Set up Python 3.12 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: 3.12 + python-version: 3.13 allow-prereleases: true - name: Install dependencies run: | @@ -39,7 +39,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@v4 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b8c2f2b..57ba54a 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.13" # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/bin/jsonpointer b/bin/jsonpointer index ba2117c..d3d27ae 100755 --- a/bin/jsonpointer +++ b/bin/jsonpointer @@ -1,5 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 import argparse diff --git a/doc/conf.py b/doc/conf.py index ed2a7f3..f472f57 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # python-json-pointer documentation build configuration file, created by # sphinx-quickstart on Sat Apr 13 16:52:59 2013. @@ -11,7 +10,8 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -42,7 +42,7 @@ master_doc = 'index' # General information about the project. -project = u'python-json-pointer' +project = 'python-json-pointer' copyright = jsonpointer.__author__ # The version info for the project you're documenting, acts as replacement for @@ -186,8 +186,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'python-json-pointer.tex', u'python-json-pointer Documentation', - u'Stefan Kögl', 'manual'), + ('index', 'python-json-pointer.tex', 'python-json-pointer Documentation', + 'Stefan Kögl', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -216,8 +216,8 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'python-json-pointer', u'python-json-pointer Documentation', - [u'Stefan Kögl'], 1) + ('index', 'python-json-pointer', 'python-json-pointer Documentation', + ['Stefan Kögl'], 1) ] # If true, show URL addresses after external links. @@ -230,8 +230,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'python-json-pointer', u'python-json-pointer Documentation', - u'Stefan Kögl', 'python-json-pointer', 'One line description of project.', + ('index', 'python-json-pointer', 'python-json-pointer Documentation', + 'Stefan Kögl', 'python-json-pointer', 'One line description of project.', 'Miscellaneous'), ] diff --git a/doc/index.rst b/doc/index.rst index 7d079e8..e1e0aae 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -7,7 +7,7 @@ python-json-pointer =================== *python-json-pointer* is a Python library for resolving JSON pointers (`RFC -6901 `_). Python 3.9+ +6901 `_). Python 3.10+ and PyPy are supported. **Contents** diff --git a/jsonpointer.py b/jsonpointer.py index 3e97add..d64d729 100644 --- a/jsonpointer.py +++ b/jsonpointer.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# # python-json-pointer - An implementation of the JSON Pointer syntax # https://github.com/stefankoegl/python-json-pointer # @@ -136,7 +134,7 @@ class JsonPointerException(Exception): pass -class EndOfList(object): +class EndOfList: """Result of accessing element "-" of a list""" def __init__(self, list_): @@ -147,7 +145,7 @@ def __repr__(self): lst=repr(self.list_)) -class JsonPointer(object): +class JsonPointer: """A JSON Pointer that can reference parts of a JSON document""" # Array indices must not contain: @@ -294,7 +292,7 @@ def join(self, suffix): except: # noqa E722 raise JsonPointerException("Invalid suffix") - def __truediv__(self, suffix): # Python 3 + def __truediv__(self, suffix): return self.join(suffix) @property diff --git a/makefile b/makefile index c40b485..024d988 100644 --- a/makefile +++ b/makefile @@ -6,11 +6,11 @@ help: @echo " - coverage: run tests with coverage" @echo @echo "To install jsonpointer, type" - @echo " python setup.py install" + @echo " python3 setup.py install" @echo test: - python -munittest + python3 -munittest coverage: coverage run --source=jsonpointer tests.py diff --git a/setup.cfg b/setup.cfg index ab8f354..4b36d81 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[bdist_wheel] -universal = 1 - [flake8] max-line-length = 120 exclude = .git,.tox,dist,doc,*egg,build,.venv \ No newline at end of file diff --git a/setup.py b/setup.py index 75f5426..f353ac1 100644 --- a/setup.py +++ b/setup.py @@ -38,27 +38,28 @@ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Libraries', 'Topic :: Utilities', ] -setup(name=PACKAGE, - version=VERSION, - description=DESCRIPTION, - long_description=long_description, - long_description_content_type="text/markdown", - author=AUTHOR, - author_email=EMAIL, - license=LICENSE, - url=WEBSITE, - py_modules=MODULES, - scripts=['bin/jsonpointer'], - classifiers=CLASSIFIERS, - python_requires='>=3.9', - ) +setup( + name=PACKAGE, + version=VERSION, + description=DESCRIPTION, + long_description=long_description, + long_description_content_type="text/markdown", + author=AUTHOR, + author_email=EMAIL, + license=LICENSE, + url=WEBSITE, + py_modules=MODULES, + scripts=['bin/jsonpointer'], + classifiers=CLASSIFIERS, + python_requires='>=3.10', +) diff --git a/tests.py b/tests.py index 668982d..d7cee1f 100755 --- a/tests.py +++ b/tests.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- import copy import doctest @@ -370,7 +369,7 @@ def test_mock_dict_sanity(self): '/root/1/2': '3', } - for path, expected_value in iter(path_to_expected_value.items()): + for path, expected_value in path_to_expected_value.items(): self.assertEqual(resolve_pointer(doc, path, default), expected_value) def test_mock_dict_returns_default(self): @@ -382,7 +381,7 @@ def test_mock_dict_returns_default(self): '/x/y/z/d': default } - for path, expected_value in iter(path_to_expected_value.items()): + for path, expected_value in path_to_expected_value.items(): self.assertEqual(resolve_pointer(doc, path, default), expected_value) def test_mock_dict_raises_key_error(self):