GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-130608: Remove `dirs_exist_ok` argument from `pathlib.Path.copy()` by barneygale · Pull Request #130610 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented Feb 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Per the issue:

(Background: pathlib.Path.copy() is new in Python 3.14, so it hasn't been released yet.)

I don't think there's a compelling case to support a dirs_exist_ok argument in the initial version of Path.copy(). Most Python users don't need "copy and merge directory" functionality. Particularly unlucky users might use the wrong source or target path, and perform a large directory tree merge that is difficult to unpick.

We could add this back in later, in response to user demand.

  • Issue: Remove dirs_exist_ok argument from pathlib.Path.copy() #130608

📚 Documentation preview 📚: https://cpython-previews--130610.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@barneygale
pythonGH-130608: Remove dirs_exist_ok argument from `pathlib.Path.c…
3398e65
…opy()`

This feature isn't sufficiently motivated.
@barneygale barneygale added the topic-pathlib label Feb 26, 2025
@bedevere-app bedevere-app Bot added the awaiting core review label Feb 26, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Feb 26, 2025
Remove dirs_exist_ok argument from pathlib.Path.copy() #130608
Closed
@barneygale
barneygale requested a review from pfmoore February 28, 2025 17:19
@barneygale

barneygale commented Feb 28, 2025

Copy link
Copy Markdown
Contributor Author

Hi Paul, I requested your review because you helped with a similar PR few months back: #123337

To explain my motivations a bit:

I'm trying to be extremely careful about adding pathlib features I might later regret. It's already happened more than once while I've been maintaining pathlib 🙃

In this case, the implementation uses WritablePath.mkdir(exist_ok=dirs_exist_ok), but I'd like to remove the exist_ok argument because it implies readability, whereas WritablePath is otherwise write-only. Maybe this is solvable some other way, but for now I'd quite like to play it safe.

Hope that makes sense, thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pfmoore
pfmoore approved these changes Feb 28, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Feb 28, 2025
@pfmoore

pfmoore commented Feb 28, 2025

Copy link
Copy Markdown
Member

Looks OK to me, and I agree with your reasoning. Until we know how people are going to use the new extensibility, it's better to keep the requirements minimal. We can add functionality later if it's needed, and 3rd party providers won't have a problem with it.

barneygale reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale

barneygale commented Feb 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Excellent, thanks for your help :]

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale
barneygale merged commit b545450 into python:main Feb 28, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pfmoore pfmoore pfmoore approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-pathlib

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@barneygale @pfmoore
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.