Skip to content
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

Remove v2.FS from v2.Path context #325

Closed
wants to merge 2 commits into from
Closed

Remove v2.FS from v2.Path context #325

wants to merge 2 commits into from

Conversation

kuenishi
Copy link
Member

pfio.v2.Path shall be independent from pfio.v2.FS implementations such as S3 and so on as it includes too much information to represent generic paths and its manipulations. In this PR, it deprecates giving pfio.v2.FS to the constructor of pfio.v2.Path, and add a new method .scope() to FS for calling file access methods from Path such as open and exists.

Before:

with from_url('s3://bucket/path/to/dir') as s3:
  p = Path('path/to/file', fs=s3)
  p.open().read()

After this PR, we can do this:

p = Path('path/to/file')
with from_url('s3://bucket/path/to/dir') as s3:
  with s3.scope():
    p.open().read()

Current style (above) remains supported for 2.7.x, but will be removed in 2.8.

@kuenishi kuenishi added this to the 2.7.0 milestone Sep 13, 2023
@kuenishi kuenishi added the cat:enhancement Implementation that does not break interfaces. label Sep 13, 2023
@kuenishi kuenishi modified the milestones: 2.7.0, 2.8.0 Oct 2, 2023
@kuenishi
Copy link
Member Author

Closing in favor of #331 .

@kuenishi kuenishi closed this Apr 10, 2024
@kuenishi kuenishi deleted the fix-pathlib2 branch April 10, 2024 06:42
@kuenishi kuenishi removed this from the 2.8.0 milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Implementation that does not break interfaces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant