Skip to content

Install the command line programs as console_scripts - #231

Merged
stefankoegl merged 1 commit into
masterfrom
claude/epic-einstein-apfbsl
Oct 10, 2026
Merged

stefankoegl merged 1 commit into
masterfrom
claude/epic-einstein-apfbsl

Conversation

@stefankoegl

@stefankoegl stefankoegl commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Fixes #176. Based on #177, but keeps jsonpatch.py a single module.

The jsondiff and jsonpatch programs were installed as extension-less scripts with a shebang line (scripts= in setup.py), which cannot be run on Windows. They are now installed as console_scripts entry points, for which pip generates a launcher suitable for the platform (.exe on Windows).

Changes

  • bin/jsondiff and bin/jsonpatch are merged into the new top-level module jsonpatch_cli.py, with jsondiff_main() and jsonpatch_main() as entry points. The code is unchanged except for renaming the names that would collide in one module (parser, main).
  • setup.py adds jsonpatch_cli to py_modules and replaces scripts= with entry_points.
  • The argument parsers set prog explicitly, so --version and --help print jsondiff / jsonpatch no matter how the programs are started.
  • The CLI tests call the entry-point functions instead of running bin/ scripts.

jsonpatch.py, the release workflow and RELEASING.md are untouched. Coverage stays at 100%, because jsonpatch_cli is outside source = jsonpatch, as bin/ was.

Testing

  • tests.py, property_tests.py and pytest pass.
  • Built sdist and wheel. The wheel contains jsonpatch.py, jsonpatch_cli.py and the console_scripts entry points.
  • Installed from the sdist into a clean venv and ran jsondiff and jsonpatch: exit codes, --version, -u, the patch read from stdin, and -i -b all work.
  • Upgrading an existing jsonpatch 1.33 install to the new wheel works.
  • Not tested on Windows. CI only runs on Ubuntu.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SMPzBWARECp9uGKGvqiyDW

@coveralls

coveralls commented Oct 10, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — claude/epic-einstein-apfbsl into master

The jsondiff and jsonpatch programs were installed as extension-less
scripts with a shebang line, which cannot be run on Windows. Move them
from bin/ into the new module jsonpatch_cli and install them as
console_scripts entry points, for which the installer generates a
launcher suitable for the platform.

jsonpatch.py stays a single module. The program names are set
explicitly, so --version and --help print "jsondiff" and "jsonpatch"
no matter how the programs are started.

Based on #177.

Fixes #176

Co-authored-by: Travis LaGrone <TLagrone@reyesholdings.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SMPzBWARECp9uGKGvqiyDW
@stefankoegl
stefankoegl force-pushed the claude/epic-einstein-apfbsl branch from 99d612c to cfbcbc8 Compare October 10, 2026 21:27
@stefankoegl stefankoegl changed the title Refactor jsonpatch into a package with CLI entry points Install the command line programs as console_scripts Oct 10, 2026
@stefankoegl
stefankoegl merged commit d38e01e into master Oct 10, 2026
12 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.

Support CLI tools on Windows

3 participants