universal_pathlib
universal_pathlib copied to clipboard
Provide a better way to allow static type-narrowing for the UPath constructor
Currently it seems all python type-checkers seem to have some limitation regarding either __new__ overloads or type.__call__ overloads.
see: #435
This issue tracks if we can come up with a better way to overload the constructor thats supported by all typecheckers.
xref / blocked-by:
- astral-sh/ty#281
- python/mypy#15182
- python/mypy#17251
There are two ways right now to get IDE autocompletion and suggestions for storage_options:
-
use the correct upath subclass directly
-
use
upath.registry.get_upath_classto narrow to the right class on protocol