Skip to content

Turn shutil into a runnable module #126562

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
zhihaoy opened this issue Nov 8, 2024 · 12 comments
Closed

Turn shutil into a runnable module #126562

zhihaoy opened this issue Nov 8, 2024 · 12 comments

Comments

@zhihaoy
Copy link

zhihaoy commented Nov 8, 2024

Feature or enhancement

Proposal:

Introduction

py -m shutil copy2 ~/my/src.txt .

I often find it necessary to use some shutil functionalities in scripts. It does the right thing efficiently, has more precise error handling than cmake -E, and, most importantly, is cross-platform.

Precedent

The zipfile module can be used by py -m zipfile. It gains credits for being a cross-platform ZIP64 decompressor.

Details

  • The subcommands should cover copyfile, copystat, copy, copy2, copytree, rmtree, move, chown, which, make_archive, and unpack_archive;
  • The keyword arguments that are easy to represent in cmdline should be adapted into --kw arg cmdline options; flags can follow the style --follow_symlinks and --no-follow_symlinks.
  • It would be even nicer if combined with a progress bar (See also: Add a basic progressbar implementation to shutil)

Links

DPO: https://discuss.python.org/t/turn-shutil-into-a-runnable-module/70503

Linked PRs

@zhihaoy zhihaoy added the type-feature A feature request or enhancement label Nov 8, 2024
@ZeroIntensity
Copy link
Member

I'm pretty sure this needs to get discussed on DPO.

@ZeroIntensity ZeroIntensity added the pending The issue will be closed if no feedback is provided label Nov 8, 2024
@picnixz picnixz added the stdlib Python modules in the Lib dir label Nov 8, 2024
@nineteendo
Copy link
Contributor

Can't this be closed in the meantime?

@ZeroIntensity
Copy link
Member

It could, but I don't see the need. It will just get reopened if we decide to go with the feature, and if not, then we'll close it.

@picnixz picnixz removed the pending The issue will be closed if no feedback is provided label Dec 15, 2024
@picnixz
Copy link
Member

picnixz commented Dec 15, 2024

(Removing the pending label since we have now a discussion)

@ZeroIntensity
Copy link
Member

Are we considering this approved?

@picnixz
Copy link
Member

picnixz commented Dec 15, 2024

No, just that there is a discussion pending. In general, I consider pending when we have neither a discussion, nor a reply from the OP. Now, I'm just considering as being "under public consideration".

@ZeroIntensity
Copy link
Member

FWIW, I think the DPO post was well received enough that submitting a PR isn't out of the question. Whether it gets merged is another thing, but the next logical step here is to actually implement it and see it in action.

@hugovk
Copy link
Member

hugovk commented Dec 15, 2024

Hmm, although I don't see any support on DPO from a core team member, only one commented there with an alternative suggestion.

@ZeroIntensity
Copy link
Member

Yeah, but TBF, core devs very rarely express interest in an idea there. The core team ultimately decides if it gets merged, anyway; DPO should be for gauging community interest.

@ZeroIntensity
Copy link
Member

Now that a draft implementation is up, I'm bumping this to try and gather consensus, at least from Bénédikt and Hugo. In my eyes, the DPO thread went surprisingly well; it's relatively uncommon to get mostly-positive community feedback over there.

Personally, I think this could be an interesting feature, but it's also not hitting that "gut feeling" for the standard library. (I'm not sure how to describe that--e.g., argparse feels like the standard library, but click doesn't, yet I generally prefer the latter.)

If there are any triagers or core devs that have a strong preference here, speak now or forever hold your peace! I'll close this in the next few days if there's nobody willing to second the PR.

@hugovk
Copy link
Member

hugovk commented Feb 27, 2025

My read of the DPO thread is that there was a bit of support, but most of the discussion was a digression around a general solution.

but it's also not hitting that "gut feeling" for the standard library.

Likewise. In general I am a fan of these type of CLIs, but this shutil one feels a bit of an arbitrary grab bag 🤷

@vstinner
Copy link
Member

I concur with @hugovk and I suggest to close this issue as not planned.

@erlend-aasland erlend-aasland added the pending The issue will be closed if no feedback is provided label Feb 27, 2025
@ZeroIntensity ZeroIntensity closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2025
@ZeroIntensity ZeroIntensity removed type-feature A feature request or enhancement stdlib Python modules in the Lib dir pending The issue will be closed if no feedback is provided labels Mar 1, 2025
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

No branches or pull requests

7 participants