Skip to content

Maybe replace filename-handling with universal-pathlib? #1545

@jpivarski

Description

@jpivarski

Just something to consider because it would change a lot of code (this would be a big task), but Uproot has some hairy filename parsing because

  1. it handles local paths, including Windows drive letters, and URLs in the same string field
  2. it handles external paths/URLs and inside-the-ROOT-file paths with that same string field, separated by a colon (and colons are necessary for Windows drive letters, URL schemes, and URL port numbers).

At least item 1 could be solved by universal-pathlib (import upath), which unifies local path and URL parsing. It might even help with item 2 because you can search for the colon separator after the global parts of the path (Windows drive letter, URL scheme, URL port) have already been identified and separated from the nested filename.

Something to be cautious of with universal-pathlib: it's not the only Python library that gets imported as upath. I don't know what would happen if both of them are installed in the same environment. (They have different PyPI names, but the same import name.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions