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

Add os.path.fileuri() function #88578

Closed
barneygale mannequin opened this issue Jun 13, 2021 · 2 comments
Closed

Add os.path.fileuri() function #88578

barneygale mannequin opened this issue Jun 13, 2021 · 2 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@barneygale
Copy link
Mannequin

barneygale mannequin commented Jun 13, 2021

BPO 44412
Nosy @barneygale
PRs
  • bpo-44412: add os.path.fileuri() function. #26708
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-06-13.16:10:22.472>
    labels = ['type-feature', 'library', '3.11']
    title = 'Add os.path.fileuri() function'
    updated_at = <Date 2021-06-13.16:55:19.479>
    user = 'https://github.com/barneygale'

    bugs.python.org fields:

    activity = <Date 2021-06-13.16:55:19.479>
    actor = 'barneygale'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-06-13.16:10:22.472>
    creator = 'barneygale'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44412
    keywords = ['patch']
    message_count = 1.0
    messages = ['395756']
    nosy_count = 1.0
    nosy_names = ['barneygale']
    pr_nums = ['26708']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44412'
    versions = ['Python 3.11']

    @barneygale
    Copy link
    Mannequin Author

    barneygale mannequin commented Jun 13, 2021

    Proposal:

    • Introduce os.path.fileuri() function that produces a 'file://' URI
    • Adjust PurePosixPath.to_uri() to call posixpath.fileuri()
    • Adjust PureWindowsPath.to_uri() to call ntpath.fileuri()
    • Adjust nturl2path.pathname2url() to call ntpath.fileuri()

    Rationale:

    • pathlib is 95% a wrapper around os and os.path. It implements
      little itself except the OOP interface. as_uri() is one of only a
      tiny handful of pathlib features that have no decent antecedents.
    • the existence of these OS-specific features complicates pathlib's
      internals, necessitating the existence of OS-specific '_Flavour'
      classes that greatly complicate work on bpo-24132
    • this is a useful feature with lots of stackoverflow posts. It seems
      silly to /require/ users to use pathlib for this, as the rest of their
      codebase may work just fine using traditional path manip.

    Further discussion on python-ideas: https://discuss.python.org/t/pathlib-and-os-path-feature-parity-and-code-de-duplication/9239

    Related: bpo-44403, bpo-44136, bpo-24132

    @barneygale barneygale mannequin added 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 13, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @barneygale
    Copy link
    Contributor

    Withdrawing this request in favour of #125866

    @barneygale barneygale closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant