Skip to content

Clean up broken, outdated and redundant bits across the project - #114

Merged
stefankoegl merged 22 commits into
masterfrom
claude/pensive-wright-ioey78
Nov 11, 2026
Merged

stefankoegl merged 22 commits into
masterfrom
claude/pensive-wright-ioey78

Conversation

@stefankoegl

Copy link
Copy Markdown
Owner

Project-wide cleanup. No changes to public API behaviour.

Library (jsonpointer.py)

  • JsonPointer.path doctest assigned a comparison to a variable and asserted nothing; now it actually checks the result.
  • Removed an unreachable assert in walk(): get_part() already raises for documents without __getitem__. The assert also disappeared under python -O.
  • Removed a redundant $ from _RE_ARRAY_INDEX, which is only used with fullmatch.
  • Docstring typos ("append" → "appended", "splitted", "paths" → "parts").

CLI (bin/jsonpointer)

  • The pointer is parsed once and reused, instead of being re-parsed for every input file.
  • Replaced a dated comment with an explanation.

Packaging

  • Added pyproject.toml with [build-system] (setuptools>=77). Without it, pip falls back to the legacy, non-isolated path. In this environment that failed to install with a distro-patched setuptools.
  • Replaced the deprecated License :: OSI Approved :: BSD License classifier with license_expression='BSD-3-Clause', which matches LICENSE.txt. Wheel metadata now has License-Expression: BSD-3-Clause, and setuptools no longer prints deprecation warnings.
  • setup.py reads README.md as UTF-8 and relative to its own location, closes the source file, and no longer uses io.open.
  • requirements-dev.txt: removed wheel/setuptools, which the test job doesn't use.
  • makefile: suggests pip install . instead of setup.py install.

Docs

  • CLI usage text updated to the current argparse format (-f, --pointer-file POINTER_FILE).
  • Fixed the mod-jsonpointer label: it was missing its _, so it was a comment.
  • Grammar fixes; resolve_pointer/set_pointer are now called functions, not methods.
  • Updated outdated URLs (RFC 6901, PyPI, Read the Docs) in README and docs.
  • conf.py: sys.path no longer depends on the current working directory, and the texinfo placeholder description is replaced with the module docstring.
  • .readthedocs.yaml: comment now says doc/, not docs/.

CI

  • The TestPyPI publish step now uses the same SHA-pinned action as the PyPI step.
  • Lint job: removed the redundant ref: ${{ github.ref }} and allow-prereleases for 3.13.

Verification

Run locally on Python 3.13:

  • python -m unittest: 96 tests OK
  • flake8: clean
  • sphinx-build -W: clean
  • python -m build and twine check --strict: pass, no warnings
  • mypy.stubtest jsonpointer: no issues

Generated by Claude Code

Library:
- Fix the JsonPointer.path doctest, which assigned instead of asserting
- Drop an unreachable assert in walk() (get_part already rejects
  non-indexable documents) and a redundant "$" in a fullmatch regex
- Fix docstring typos

CLI:
- Parse the pointer once instead of re-parsing it for every file
- Replace a dated comment with an explanation

Packaging:
- Add pyproject.toml declaring the setuptools build backend, so
  pip/build use an isolated, modern setuptools
- Use an SPDX license expression (BSD-3-Clause) instead of the
  deprecated license classifier, silencing setuptools warnings
- Read README.md as UTF-8 relative to setup.py; close the source file
- Drop wheel/setuptools from requirements-dev.txt (unused by tests)
- makefile: recommend "pip install ." instead of "setup.py install"

Docs:
- Update the CLI usage text to the current argparse help format
- Fix the mod-jsonpointer label, grammar, and "method" vs "function"
- Use current URLs for RFC 6901, PyPI and Read the Docs
- Make conf.py's sys.path independent of the working directory and
  replace the texinfo placeholder description

CI:
- Pin the TestPyPI publish action to the same SHA as the PyPI one
- Remove a redundant checkout ref and allow-prereleases for 3.13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
@coveralls

coveralls commented Nov 10, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 98.864% (-0.006%) from 98.87% — claude/pensive-wright-ioey78 into master

The package metadata already declares BSD-3-Clause; make the module
attribute agree instead of the informal "Modified BSD License".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
pairwise() is not used by the library itself, and itertools.pairwise()
is available on every supported Python version (3.10+). Keep it as a
thin wrapper that emits a DeprecationWarning, and mark it @deprecated
in the type stubs so type checkers flag callers too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
join() turns any failure into JsonPointerException("Invalid suffix").
Raise it "from" the original exception so the underlying cause (e.g. a
TypeError for a non-iterable suffix) shows up in tracebacks and is
available as __cause__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
Read the Docs recommends pinning documentation dependencies so a new
Sphinx release cannot silently change or break the build. Pin to the
current release (9.2.0), which builds the docs without warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
doc/conf.py was the 2013 sphinx-quickstart template, mostly
commented-out defaults. Keep only the settings that differ from
Sphinx's defaults, and:

- use the "classic" theme name instead of its legacy alias "default"
  (the generated HTML is identical apart from the alias stylesheet)
- drop templates_path and html_static_path, which pointed at an empty
  or missing directory, along with doc/_static/.empty
- define the author once and reuse it for the LaTeX, man and Texinfo
  outputs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
The source distribution included the .rst sources and tests.py but not
doc/conf.py, doc/Makefile or the requirements files, so the docs
could not be built from it. Add those plus the makefile and
.coveragerc, and drop the explicit README.md include, which setuptools
adds automatically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
- Test on Python 3.15 (released October 2026) and add its classifier;
  run the Windows and macOS jobs on 3.15 instead of 3.13
- Test the Python 3.16 pre-release as an allowed-to-fail job
- Stop testing PyPy 3.10, which PyPy no longer releases; PyPy 3.11
  stays

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
The v4/v5 releases of the first-party actions run on the deprecated
Node 20 runtime. Update to the current majors, which run on Node 24:

- actions/checkout v4 -> v7
- actions/setup-python v5 -> v7
- actions/upload-artifact v4 -> v7
- actions/download-artifact v4 -> v8

None of the inputs used here changed. Also move the pinned
pypa/gh-action-pypi-publish commit from v1.14.2 to v1.14.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
Ctrl-C made jsonpointer exit with 1, the same status as "pointer could
not be resolved", so callers could not tell the two apart. Use 130
(128 + SIGINT), the conventional status for an interrupted command,
and document it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
runpy.run_path() returns a copy of the script's globals, so replacing
resolve_files in it had no effect on main(). Raise KeyboardInterrupt
from json.load() instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
argparse.FileType is deprecated since Python 3.14. Open the pointer
file and the JSON inputs with a small helper instead, which keeps the
existing behaviour:

- "-" still means standard input, which is never closed
- files are read as UTF-8
- a file that cannot be opened is a usage error (exit status 2) with
  the same "can't open" message

The pointer file is now opened after argument parsing rather than
during it, so the help output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
Stop using the deprecated argparse.FileType in the CLI
Trim the Sphinx configuration to the settings in use
Pin Sphinx for reproducible documentation builds
Use SPDX identifier for __license__
Deprecate pairwise() in favour of itertools.pairwise()
Ship everything needed to test and build docs from the sdist
Update GitHub Actions to current major versions
Exit with status 130 when the CLI is interrupted
Keep the original error when join() rejects a suffix
@stefankoegl
stefankoegl merged commit 4ec45e5 into master Nov 11, 2026
19 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants