Skip to content

Allow "-m json" instead of "-m json.tool" #122873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
treyhunner opened this issue Aug 9, 2024 · 6 comments
Closed

Allow "-m json" instead of "-m json.tool" #122873

treyhunner opened this issue Aug 9, 2024 · 6 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@treyhunner
Copy link
Member

treyhunner commented Aug 9, 2024

Feature or enhancement

Proposal:

This is a feature proposal for allowing python3 -m json to work in addition to python -m json.tool and softly deprecating the use of python3 -m json.tool.

I made a branch to see what these changes might look like.

Here is a separate branch which issues a DeprecationWarning .
However, since json.tool will continue working that warning may cause more hassle for end users than is worthwhile.

I think the no-warning approach may be more sensible.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

Discussion in Ideas discuss thread

Linked PRs

@treyhunner treyhunner added the type-feature A feature request or enhancement label Aug 9, 2024
@hugovk hugovk added the 3.14 bugs and security fixes label Aug 9, 2024
@ncoghlan
Copy link
Contributor

The "No warning" branch looks good to me (it would just need docs and News for me to approve a PR)

@Eclips4 Eclips4 added the stdlib Python modules in the Lib dir label Aug 10, 2024
@Eclips4
Copy link
Member

Eclips4 commented Aug 10, 2024

Hi @hugovk! Just a quick note: type-feature label doesn't require a version label: https://devguide.python.org/triage/labels/#type-labels

@Eclips4 Eclips4 removed the 3.14 bugs and security fixes label Aug 10, 2024
@hugovk
Copy link
Member

hugovk commented Aug 10, 2024

The "No warning" branch looks good to me (it would just need docs and News for me to approve a PR)

Agreed.

And change this in Lib/json/tool.py?

 def main():
-    prog = 'python -m json.tool'
+    prog = 'python -m json'

@treyhunner Would you like to put together a PR?

@treyhunner
Copy link
Member Author

I will put together a PR shortly. 👍

@rhettinger
Copy link
Contributor

+1 from me

@hugovk
Copy link
Member

hugovk commented Aug 11, 2024

PR is here: #122884

AA-Turner added a commit that referenced this issue Aug 13, 2024
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Alyssa Coghlan <[email protected]>
@hugovk hugovk closed this as completed Aug 13, 2024
blhsing pushed a commit to blhsing/cpython that referenced this issue Aug 22, 2024
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Alyssa Coghlan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants