Registry
¶
The UPath registry system manages filesystem-specific path implementations. It allows you to register custom UPath subclasses for different protocols and retrieve the appropriate implementation for a given protocol.
Functions¶
get_upath_class
cached
¶
get_upath_class(
protocol: Literal["simplecache"],
) -> type[SimpleCachePath]
get_upath_class(
protocol: Literal["github"],
) -> type[GitHubPath]
get_upath_class(
protocol: Literal["memory"],
) -> type[MemoryPath]
get_upath_class(
protocol: Literal["webdav"],
) -> type[WebdavPath]
get_upath_class(
protocol: Literal[""],
) -> type[WindowsUPath]
get_upath_class(protocol: Literal['']) -> type[PosixUPath]
Return the upath cls for the given protocol.
Returns None if no matching protocol can be found.
| PARAMETER | DESCRIPTION |
|---|---|
protocol
|
The protocol string
TYPE:
|
fallback
|
If fallback is False, don't return UPath instances for fsspec filesystems that don't have an implementation registered.
TYPE:
|
Source code in upath/registry.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
register_implementation
¶
register a UPath implementation with a protocol
| PARAMETER | DESCRIPTION |
|---|---|
protocol
|
Protocol name to associate with the class
TYPE:
|
cls
|
The UPath subclass for the protocol or a str representing the full path to an implementation class like package.module.class. |
clobber
|
Whether to overwrite a protocol with the same name; if False, will raise instead.
TYPE:
|
Source code in upath/registry.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
available_implementations
¶
return a list of protocols for available implementations
| PARAMETER | DESCRIPTION |
|---|---|
fallback
|
If True, also return protocols for fsspec filesystems without an implementation in universal_pathlib.
TYPE:
|
Source code in upath/registry.py
174 175 176 177 178 179 180 181 182 183 184 185 186 | |
See Also
¶
- UPath - Main UPath class documentation
- Implementations - Built-in UPath subclasses
- Extensions - Extending UPath functionality