Description
UPath._format_parsed_parts
currently drops the netloc portion completely when netloc is empty. This leads to a shortened URI with single slash format.
For example, _format_parsed_parts
currently shortens protocol:///path
to protocol:/path
. This unfortunately breaks compatibility with RFC 3986 format, which is assumed by fsspec
and third-party libraries that use it (e.g. pandas). Per RFC 3986, an empty host/authority field can be valid.
UPath should offer an attribute to allow implementations to specify whether empty netloc's are valid or not. In the case where they are valid, it shouldn't treat empty string netloc any differently. Without a flag like this, implementations would need to override _format_parsed_parts to change one line.
I am building a UPath implementation for the boxfs implementation and I have to do just that. Netloc (URI host/authority) doesn't have a meaning in this "protocol", so I plan to leave it blank.