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 — Add `pathlib.Path.from_uri()` classmethod · Issue #107465 · python/cpython

Add pathlib.Path.from_uri() classmethod #107465

New issue
Copy link
New issue
Copy link
Closed
Closed
Add pathlib.Path.from_uri() classmethod#107465
Copy link
Labels
topic-pathlibtype-featureA feature request or enhancementA feature request or enhancement

Description

@barneygale
barneygale
opened on Jul 30, 2023
Issue body actions

Feature or enhancement

Add pathlib.Path.from_uri() classmethod that creates a path objects from a 'file' URI, like file:///c:/windows. This method should accept RFC 8089 file: URIs, including variant forms.

Pitch

The proposed method is the counterpart of pathlib.Path.as_uri(). As we continue to open up pathlib for subclassing, user subclasses of path classes will begin to appear with their own as_uri() methods returning URIs like s3://, ftp://. These subclasses will likely also support parsing URIs to create paths. However, there is currently no defined interface for doing this in pathlib, and users will be tempted to accept URIs in initialisers, which produces a confusing interface. If pathlib instead defines a from_uri() classmethod, there is one clear and obvious method that subclasses may override.

Previous discussion

See https://discuss.python.org/t/make-pathlib-extensible/3428/136 and subsequent posts

Linked PRs

  • GH-107465: Add pathlib.Path.from_uri() classmethod. #107640
Reacted by Mark, Edgar Ramírez Mondragón, Maciej Olko, Junlin Zhou and Nikolas Brix
Reacted by Maciej Olko and Junlin Zhou

Activity

  1. barneygale
    added
    type-featureA feature request or enhancementA feature request or enhancement
    topic-pathlib
    on Jul 30, 2023
  2. barneygale
    added 2 commits that reference this issue on Aug 4, 2023

    pythonGH-107465: Add `pathlib.Path.from_uri()` classmethod.

    b4fe32d

    pythonGH-107465: Add `pathlib.Path.from_uri()` classmethod.

    0f51181
  3. barneygale
    added a commit that references this issue on Sep 2, 2023

    Merge branch 'main' into pythongh-107465-pathlib-from-uri

    754ba5a
  4. barneygale
    added 3 commits that reference this issue on Sep 24, 2023

    Merge branch 'main' into pythongh-107465-pathlib-from-uri

    d73f74c

    Merge branch 'main' into pythongh-107465-pathlib-from-uri

    310d71c

    GH-107465: Add `pathlib.Path.from_uri()` classmethod. (#107640)

    15de493
  5. barneygale commented on Oct 1, 2023

    @barneygale
    barneygale
    on Oct 1, 2023
    ContributorAuthor
    More actions

    Implemented in 3.13 / 15de493 / #107640

  6. barneygale
    closed this as completedon Oct 1, 2023
  7. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythonGH-107465: Add `pathlib.Path.from_uri()` classmethod. (python#1…

    d76c6db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-pathlibtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.