Skip to content

Support CLI on Windows by refactoring scripts to console_scripts#177

Open
RH-TLagrone wants to merge 2 commits intostefankoegl:masterfrom
RH-TLagrone:support-windows
Open

Support CLI on Windows by refactoring scripts to console_scripts#177
RH-TLagrone wants to merge 2 commits intostefankoegl:masterfrom
RH-TLagrone:support-windows

Conversation

@RH-TLagrone
Copy link

Fixes #176

@stefankoegl stefankoegl requested a review from Copilot March 18, 2026 22:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_scripts entry points for jsondiff and jsonpatch.
  • Introduces new internal CLI modules: jsonpatch._jsondiff_cli and jsonpatch._jsonpatch_cli.
  • Moves metadata parsing in setup.py to read from jsonpatch/__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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 jsonpatch package and extract metadata from jsonpatch/__init__.py.
  • Adds console_scripts entry points for jsondiff and jsonpatch.
  • Introduces internal CLI modules jsonpatch._jsondiff_cli and jsonpatch._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.

Comment on lines +19 to 24
MODULES = [
'jsonpatch',
'jsonpatch._jsondiff_cli',
'jsonpatch._jsonpatch_cli',
]

Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
MODULES = [
'jsonpatch',
'jsonpatch._jsondiff_cli',
'jsonpatch._jsonpatch_cli',
]

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +35
'install_requires': REQUIREMENTS,
'entry_points': {
'console_scripts': [
'jsondiff = jsonpatch._jsondiff_cli:main',
'jsonpatch = jsonpatch._jsonpatch_cli:main',
]
},
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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