Support CLI on Windows by refactoring scripts to console_scripts#177
Support CLI on Windows by refactoring scripts to console_scripts#177RH-TLagrone wants to merge 2 commits intostefankoegl:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Issue #176 by switching the jsondiff/jsonpatch CLIs from installed “scripts” to setuptools-generated console_scripts, which enables proper CLI installation on Windows.
Changes:
- Refactors packaging to define
console_scriptsentry points forjsondiffandjsonpatch. - Introduces new internal CLI modules:
jsonpatch._jsondiff_cliandjsonpatch._jsonpatch_cli. - Moves metadata parsing in
setup.pyto read fromjsonpatch/__init__.py.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| setup.py | Replaces scripts=[...] with entry_points.console_scripts and updates module metadata source path. |
| jsonpatch/_jsondiff_cli.py | Adds the jsondiff CLI implementation used by the console script entry point. |
| jsonpatch/_jsonpatch_cli.py | Adds the jsonpatch CLI implementation used by the console script entry point. |
| jsonpatch/init.py | Adds the package module that provides the library implementation and metadata used by setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses Windows compatibility for the jsondiff / jsonpatch command-line tools by switching from pre-written script files to setuptools-generated console_scripts entry points.
Changes:
- Refactors packaging to install the project as a
jsonpatchpackage and extract metadata fromjsonpatch/__init__.py. - Adds
console_scriptsentry points forjsondiffandjsonpatch. - Introduces internal CLI modules
jsonpatch._jsondiff_cliandjsonpatch._jsonpatch_cli.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
setup.py |
Switches installation from scripts= to console_scripts and updates packaging metadata source. |
jsonpatch/_jsonpatch_cli.py |
Adds the jsonpatch CLI implementation as an importable module for entry points. |
jsonpatch/_jsondiff_cli.py |
Adds the jsondiff CLI implementation as an importable module for entry points. |
jsonpatch/__init__.py |
Adds package module containing the library implementation and package metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| MODULES = [ | ||
| 'jsonpatch', | ||
| 'jsonpatch._jsondiff_cli', | ||
| 'jsonpatch._jsonpatch_cli', | ||
| ] | ||
|
|
There was a problem hiding this comment.
MODULES is now unused (it’s defined but never passed to setup() anymore). Please remove it to avoid confusion, or reintroduce py_modules/packages logic that actually uses it.
| MODULES = [ | |
| 'jsonpatch', | |
| 'jsonpatch._jsondiff_cli', | |
| 'jsonpatch._jsonpatch_cli', | |
| ] |
| 'install_requires': REQUIREMENTS, | ||
| 'entry_points': { | ||
| 'console_scripts': [ | ||
| 'jsondiff = jsonpatch._jsondiff_cli:main', | ||
| 'jsonpatch = jsonpatch._jsonpatch_cli:main', | ||
| ] | ||
| }, |
There was a problem hiding this comment.
The new CLI modules and console_scripts entry points aren’t covered by tests. Since this PR changes installation/execution behavior (especially for Windows), it would be good to add unit tests that exercise jsonpatch._jsondiff_cli:main / jsonpatch._jsonpatch_cli:main (e.g., by patching sys.argv and using temp files) to lock in exit codes and output.
Fixes #176