pytorch / pytorch/vision

Replace `pathlib.Path` with raw strings in `prototype.datasets`

Open
#4,760 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: datasets prototype
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🐛 Describe the bug

We currently use pathlib.Path everywhere in the new datasets.
pathlib.Path is nice, but doesn't work well at all with URL-like paths. Indeed, it replaces // with /, so that http://www becomes an invalid url http:/www.

We should either remove pathlib.Path altogether and depend on raw strings, using os.path.join (which works without issues), or figure out a way of pathlib to work with urls,

Versions

Current nightly

cc @pmeier @bjuncek

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in prototype.datasets and inspect where pathlib.Path is used to assemble dataset paths. Reproduce the URL-like path case described in the issue, then verify that paths preserve // in URLs while local dataset paths continue to work with the chosen path handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.