{"id":28280563,"url":"https://github.com/fsspec/universal_pathlib","last_synced_at":"2025-06-16T21:32:07.683Z","repository":{"id":37817325,"uuid":"311779497","full_name":"fsspec/universal_pathlib","owner":"fsspec","description":"pathlib api extended to use fsspec backends","archived":false,"fork":false,"pushed_at":"2025-06-09T12:13:56.000Z","size":648,"stargazers_count":311,"open_issues_count":41,"forks_count":42,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-06-15T22:12:44.202Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fsspec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.rst","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-10T20:41:09.000Z","updated_at":"2025-06-07T07:33:16.000Z","dependencies_parsed_at":"2023-10-01T19:12:43.924Z","dependency_job_id":"ca2c4869-4543-480b-8318-3dcc2cf17846","html_url":"https://github.com/fsspec/universal_pathlib","commit_stats":{"total_commits":319,"total_committers":25,"mean_commits":12.76,"dds":0.7021943573667712,"last_synced_commit":"1a32d12f2d056c6954c6a0c0b1a04abf6a08c85d"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/fsspec/universal_pathlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsspec%2Funiversal_pathlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsspec%2Funiversal_pathlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsspec%2Funiversal_pathlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsspec%2Funiversal_pathlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fsspec","download_url":"https://codeload.github.com/fsspec/universal_pathlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsspec%2Funiversal_pathlib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260244787,"owners_count":22980078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-21T10:17:20.172Z","updated_at":"2025-06-16T21:32:07.671Z","avatar_url":"https://github.com/fsspec.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Pathlib\n\n[![PyPI](https://img.shields.io/pypi/v/universal_pathlib.svg)](https://pypi.org/project/universal_pathlib/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/universal_pathlib)](https://pypi.org/project/universal_pathlib/)\n[![PyPI - License](https://img.shields.io/pypi/l/universal_pathlib)](https://github.com/fsspec/universal_pathlib/blob/main/LICENSE)\n[![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/universal_pathlib?label=conda)](https://anaconda.org/conda-forge/universal_pathlib)\n\n[![Tests](https://github.com/fsspec/universal_pathlib/actions/workflows/tests.yml/badge.svg)](https://github.com/fsspec/universal_pathlib/actions/workflows/tests.yml)\n[![GitHub issues](https://img.shields.io/github/issues/fsspec/universal_pathlib)](https://github.com/fsspec/universal_pathlib/issues)\n[![Codestyle black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Changelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog-%23E05735)](./CHANGELOG.md)\n\nUniversal Pathlib is a Python library that extends the [`pathlib.Path`][pathlib]\nAPI to support a variety of backend filesystems via [`filesystem_spec`][fsspec].\n\n[pathlib]: https://docs.python.org/3/library/pathlib.html\n[fsspec]: https://filesystem-spec.readthedocs.io/en/latest/intro.html\n\n\n## Installation\n\nInstall the latest version of `universal_pathlib` with pip or conda. Please note\nthat while this will install `fsspec` as a dependency, for some filesystems, you\nhave to install additional packages. For example, to use S3, you need to install\n`s3fs`, or better depend on `fsspec[s3]`:\n\n### PyPI\n\n```bash\npython -m pip install universal_pathlib\n```\n\n### conda\n\n```bash\nconda install -c conda-forge universal_pathlib\n```\n\n### Adding universal_pathlib to your project\n\nBelow is a `pyproject.toml` based example for adding `universal_pathlib` to your\nproject as a dependency if you want to use it with `s3` and `http` filesystems:\n\n```toml\n[project]\nname = \"myproject\"\nrequires-python = \"\u003e=3.8\"\ndependencies = [\n    \"universal_pathlib\u003e=0.2.5\",\n    \"fsspec[s3,http]\",\n]\n```\n\nSee [filesystem_spec/pyproject.toml][fsspec-pyproject-toml] for an overview of the available\nfsspec extras.\n\n[fsspec-pyproject-toml]:\n  https://github.com/fsspec/filesystem_spec/blob/master/pyproject.toml#L26\n\n\n## Basic Usage\n\n```pycon\n# pip install universal_pathlib fsspec[s3]\n\u003e\u003e\u003e from upath import UPath\n\u003e\u003e\u003e\n\u003e\u003e\u003e s3path = UPath(\"s3://test_bucket\") / \"example.txt\"\n\u003e\u003e\u003e s3path.name\nexample.txt\n\u003e\u003e\u003e s3path.stem\nexample\n\u003e\u003e\u003e s3path.suffix\n.txt\n\u003e\u003e\u003e s3path.exists()\nTrue\n\u003e\u003e\u003e s3path.read_text()\n'Hello World'\n```\n\nFor more examples, see the [example notebook here][example-notebook].\n\n[example-notebook]: notebooks/examples.ipynb\n\n### Currently supported filesystems (and protocols)\n\n- `file:` and `local:` Local filesystem\n- `memory:` Ephemeral filesystem in RAM\n- `az:`, `adl:`, `abfs:` and `abfss:` Azure Storage _(requires `adlfs`)_\n- `data:` RFC 2397 style data URLs _(requires `fsspec\u003e=2023.12.2`)_\n- `github:` GitHub repository filesystem\n- `http:` and `https:` HTTP(S)-based filesystem\n- `hdfs:` Hadoop distributed filesystem\n- `gs:` and `gcs:` Google Cloud Storage _(requires `gcsfs`)_\n- `s3:` and `s3a:` AWS S3 _(requires `s3fs` to be installed)_\n- `sftp:` and `ssh:` SFTP and SSH filesystems _(requires `paramiko`)_\n- `smb:` SMB filesystems _(requires `smbprotocol`)_\n- `webdav`, `webdav+http:` and `webdav+https:` WebDAV-based filesystem on top of\n  HTTP(S) _(requires `webdav4[fsspec]`)_\n\nIt is likely, that other fsspec-compatible filesystems are supported through the\ndefault implementation. But because they are not tested in the universal_pathlib\ntest-suite, correct behavior is not guaranteed. If you encounter any issues with\na specific filesystem using the default implementation, please open an issue. We\nare happy to add support for other filesystems via custom UPath implementations.\nAnd of course, contributions for new filesystems are welcome!\n\n### Class hierarchy\n\nThe class hierarchy for `UPath` implementations and their relation to the stdlib\n`pathlib` classes are visualized in the following diagram:\n\n```mermaid\nflowchart TB\n  subgraph s0[pathlib]\n    A---\u003e B\n    A--\u003e AP\n    A--\u003e AW\n\n    B--\u003e BP\n    AP---\u003e BP\n    B--\u003e BW\n    AW---\u003e BW\n  end\n  subgraph s1[upath]\n    B ---\u003e U\n    U --\u003e UP\n    U --\u003e UW\n    BP --\u003e UP\n    BW --\u003e UW\n    U --\u003e UL\n    U --\u003e US3\n    U --\u003e UH\n    U -.-\u003e UO\n  end\n\n  A(PurePath)\n  AP(PurePosixPath)\n  AW(PureWindowsPath)\n  B(Path)\n  BP(PosixPath)\n  BW(WindowsPath)\n\n  U(UPath)\n  UP(PosixUPath)\n  UW(WindowsUPath)\n  UL(FilePath)\n  US3(S3Path)\n  UH(HttpPath)\n  UO(...Path)\n\n  classDef np fill:#f7f7f7,stroke:#2166ac,stroke-width:2px,color:#333\n  classDef nu fill:#f7f7f7,stroke:#b2182b,stroke-width:2px,color:#333\n\n  class A,AP,AW,B,BP,BW,UP,UW np\n  class U,UL,US3,UH,UO nu\n\n  style UO stroke-dasharray: 3 3\n\n  style s0 fill:none,stroke:#07b,stroke-width:3px,stroke-dasharray:3,color:#07b\n  style s1 fill:none,stroke:#d02,stroke-width:3px,stroke-dasharray:3,color:#d02\n```\n\nWhen instantiating `UPath` the returned instance type is determined by the path,\nor better said, the \"protocol\" that was provided to the constructor. The `UPath`\nclass will return a registered implementation for the protocol, if available. If\nno specialized implementation can be found but the protocol is available through\n`fsspec`, it will return a `UPath` instance and provide filesystem access with a\ndefault implementation. Please note the default implementation can not guarantee\ncorrect behavior for filesystems that are not tested in the test-suite.\n\n### Local paths and url paths\n\nIf a local path is provided `UPath` will return a `PosixUPath` or `WindowsUPath`\ninstance. These two implementations are 100% compatible with the `PosixPath` and\n`WindowsPath` classes of their specific Python version. They're tested against a\nlarge subset of the CPython pathlib test-suite to ensure compatibility.\n\nIf a local urlpath is provided, i.e. a \"file://\" or \"local://\" URI, the returned\ninstance type will be a `FilePath` instance. This class is a subclass of `UPath`\nthat provides file access via `LocalFileSystem` from `fsspec`. You can use it to\nensure that all your local file access is done through `fsspec` as well.\n\n### UPath public class API\n\nThe public class interface of `UPath` extends `pathlib.Path` via attributes that\nsimplify interaction with `filesystem_spec`. Think of the `UPath` class in terms\nof the following code:\n\n```python\nfrom pathlib import Path\nfrom typing import Any, Mapping\nfrom fsspec import AbstractFileSystem\n\nclass UPath(Path):\n    # the real implementation is more complex, but this is the general idea\n\n    @property\n    def protocol(self) -\u003e str:\n        \"\"\"The fsspec protocol for the path.\"\"\"\n\n    @property\n    def storage_options(self) -\u003e Mapping[str, Any]:\n        \"\"\"The fsspec storage options for the path.\"\"\"\n\n    @property\n    def path(self) -\u003e str:\n        \"\"\"The path that a fsspec filesystem can use.\"\"\"\n\n    @property\n    def fs(self) -\u003e AbstractFileSystem:\n        \"\"\"The cached fsspec filesystem instance for the path.\"\"\"\n\n```\n\nThese attributes are used to provide a public interface to move from the `UPath`\ninstance to more fsspec specific code:\n\n```python\nfrom upath import UPath\nfrom fsspec import filesystem\n\np = UPath(\"s3://bucket/file.txt\", anon=True)\n\nfs = filesystem(p.protocol, **p.storage_options)  # equivalent to p.fs\n\nwith fs.open(p.path) as f:\n    data = f.read()\n```\n\n## Advanced Usage\n\nIf you want to create your own UPath implementations, there are multiple ways to\ncustomize your subclass behavior. Here are a few things to keep in mind when you\ncreate your own UPath implementation:\n\n### UPath's constructor, `upath.registry`, and subclassing\n\nWhen instantiating `UPath(...)` the `UPath.__new__()` method determines the path\nprotocol and returns a registered implementation for the protocol, if available.\nThe registered implementations are mapped in the `upath.registry` module. When a\nprotocol is not registered, `universal_pathlib` checks if the protocol is mapped\nto an `fsspec` filesystem. If so, it returns an instance of `UPath` and provides\nfilesystem access through the default implementation. The protocol is determined\nby either looking at the URI scheme of the first argument to the constructor, or\nby using the `protocol` keyword argument:\n\n```python\nfrom upath import UPath\nfrom upath.implementations.cloud import S3Path\nfrom upath.implementations.memory import MemoryPath\n\np0 = UPath(\"s3://bucket/file.txt\")\nassert p0.protocol == \"s3\"\nassert type(p0) is S3Path\nassert isinstance(p0, UPath)\n\np1 = UPath(\"/some/path/file.txt\", protocol=\"memory\")\nassert p1.protocol == \"memory\"\nassert type(p1) is MemoryPath\nassert isinstance(p1, UPath)\n\n# the ftp filesystem current has no custom UPath implementation and is not\n# tested in the universal_pathlib test-suite. Therefore, the default UPath\n# implementation is returned, and a warning is emitted on instantiation.\np2 = UPath(\"ftp://ftp.ncbi.nih.gov/snp/archive\")\nassert p2.protocol == \"ftp\"\nassert type(p2) is UPath\n```\n\nThis has some implications for custom UPath subclasses. We'll go through the two\nmain cases where you might want to create a custom UPath implementation:\n\n#### Case 1: Custom filesystem works with default UPath implementation\n\nLet's say you would like to add a new implementation of your \"myproto\" protocol.\nYou already built a custom AbstractFileSystem implementation for \"myproto\" which\nyou have registered through `fsspec.registry`. In some cases it is possible that\nthe custom filesystem class already works with `UPath`'s default implementation,\nand you don't need to necessarily create a custom UPath implementation:\n\n```python\nimport fsspec.registry\nfrom fsspec.spec import AbstractFileSystem\n\nclass MyProtoFileSystem(AbstractFileSystem):\n    protocol = (\"myproto\",)\n    ...  # your custom implementation\n\nfsspec.registry.register_implementation(\"myproto\", MyProtoFileSystem)\n\nfrom upath import UPath\n\np = UPath(\"myproto:///my/proto/path\")\nassert type(p) is UPath\nassert p.protocol == \"myproto\"\nassert isinstance(p.fs, MyProtoFileSystem)\n```\n\n#### Case 2: Custom filesystem requires a custom UPath implementation\n\nSometimes the default implementation isn't sufficient and some method(s) have to\nbe overridden to provide correct behavior. In this case, create a custom `UPath`\nimplementation:\n\n```python\nfrom upath import UPath\n\nclass MyProtoPath(UPath):\n\n    def mkdir(self, mode=0o777, parents=False, exist_ok=False):\n        something = {...: ...}  # fixes to make MyProtoFileSystem.mkdir work\n        self.fs.mkdir(self.path, **something)\n\n    def path(self):\n        path = super().path\n        if path.startswith(\"/\"):\n            return path[1:]  # MyProtoFileSystem needs the path without \"/\"\n        return path\n```\n\nIf you use your implementation directly via `MyProtoPath(\"myproto:///a/b\")`, you\ncan use this implementation already as is. If you want a call to `UPath(...)` to\nreturn your custom implementation when the detected protocol is `\"myproto\"`, you\nneed to register your implementation. The next section explains your options.\n\nAlso note: In case you develop a custom `UPath` implementation, please feel free\nto open an issue to discuss integrating it in `universal_pathlib`.\n\n#### Implementation registration dynamically from Python\n\nYou can register your custom UPath implementation dynamically from Python:\n\n```python\n# for example: mymodule/submodule.py\nfrom upath import UPath\nfrom upath.registry import register_implementation\n\nclass MyProtoPath(UPath):\n    ...  # your custom implementation\n\nregister_implementation(\"myproto\", MyProtoPath)\n```\n\n#### Implementation registration on installation via entry points\n\nIf you distribute your implementation in your own Python package, you can inform\n`universal_pathlib` about your implementation via the `entry_points` mechanism:\n\n```\n# pyproject.toml\n[project.entry-points.\"universal_pathlib.implementations\"]\nmyproto = \"my_module.submodule:MyPath\"\n```\n\n```\n# setup.cfg\n[options.entry_points]\nuniversal_pathlib.implementations =\n    myproto = my_module.submodule:MyPath\n```\n\nChose the method that fits your use-case best. If you have questions, open a new\nissue in the `universal_pathlib` repository. We are happy to help you!\n\n### Customization options for UPath subclasses\n\n#### Filesystem access methods\n\nOnce you thoroughly test your custom UPath implementation, it's likely that some\nmethods need to be overridden to provide correct behavior compared to `stdlib`'s\n`pathlib.Path` class. The most common issue is that for certain edge cases, your\nimplementation is not raising the same exceptions compared to the `pathlib.Path`\nclass. Or that the `UPath.path` property needs some prefix removed or added.\n\n```python\nclass MyProtoPath(UPath):\n\n    @property\n    def path(self) -\u003e str:\n        if p := self.path.startswith(\"/\"):\n            p = p[1:]\n        return p\n\n    def mkdir(self, mode=0o777, parents=False, exist_ok=False):\n        if some_edge_case:\n            raise FileExistsError(str(self))\n        super().mkdir(mode=mode, parents=parents, exist_ok=exist_ok)\n\n    def is_file(self):\n        return self.fs.isfile(self.path, myproto_option=123)\n```\n\n#### Storage option parsing\n\nIt's possible that you might want to extract additional storage options from the\nuser provided arguments to you constructor. You can provide a custom classmethod\nfor `_parse_storage_options`:\n\n```python\nimport os\n\nclass MyProtoPath(UPath):\n\n    @classmethod\n    def _parse_storage_options(\n        cls, urlpath: str, protocol: str, storage_options: Mapping[str, Any]\n    ) -\u003e dict[str, Any]:\n        if \"SOME_VAR\" in os.environ:\n            storage_options[\"some_var\"] = os.environ[\"SOME_VAR\"]\n        storage_options[\"my_proto_caching\"] = True\n        storage_options[\"extra\"] = get_setting_from_path(urlpath)\n        return storage_options\n```\n\n#### Fsspec filesystem instantiation\n\nTo have more control over fsspec filesystem instantiation you can write a custom\n`_fs_factory` classmethod:\n\n```python\nclass MyProtoPath(UPath):\n\n    @classmethod\n    def _fs_factory(\n        cls, urlpath: str, protocol: str, storage_options: Mapping[str, Any]\n    ) -\u003e AbstractFileSystem:\n        myfs = ...  # custom code that creates a AbstractFileSystem instance\n        return myfs\n```\n\n#### Init argument parsing\n\nIn special cases you need to take more control over how the init args are parsed\nfor your custom subclass. You can override `__init__` or the `UPath` classmethod\n`_transform_init_args`. The latter handles pickling of your custom subclass in a\nbetter way in case you modify storage options or the protocol.\n\n```python\nclass MyProtoPath(UPath):\n\n    @classmethod\n    def _transform_init_args(\n            cls,\n            args: tuple[str | os.PathLike, ...],\n            protocol: str,\n            storage_options: dict[str, Any],\n    ) -\u003e tuple[tuple[str | os.PathLike, ...], str, dict[str, Any]]:\n        # check the cloud, http or webdav implementations for examples\n        ...\n        return args, protocol, storage_options\n```\n\n#### Stopping UPath's subclass dispatch mechanism\n\nThere are cases for which you want to disable the protocol dispatch mechanism of\nthe `UPath.__new__` constructor. For example if you want to extend the class API\nof your `UPath` implementation, and use it as the base class for other, directly\ninstantiated subclasses. Together with other customization options this can be a\nuseful feature. Please be aware that in this case all protocols are handled with\nthe default implementation in UPath. Please always feel free to open an issue in\nthe issue tracker to discuss your use case. We're happy to help with finding the\nmost maintainable solution.\n\n```python\nclass ExtraUPath(UPath):\n    _protocol_dispatch = False  # disable the registry return an ExtraUPath\n\n    def some_extra_method(self) -\u003e str:\n        return \"hello world\"\n\nassert ExtraUPath(\"s3://bucket/file.txt\").some_extra_method() == \"hello world\"\n```\n\n## Migration Guide\n\nUPath's internal implementation is likely going to change with larger changes in\nCPython's stdlib `pathlib` landing in the next Python versions (`3.13`, `3.14`).\nTo reduce the problems for user code, when these changes are landing in `UPath`,\nthere have been some significant changes in `v0.2.0`. This migration guide tries\nto help migrating code that extensively relies on private implementation details\nof the `UPath` class of versions `v0.1.x` to the new and better supported public\ninterface of `v0.2.0`\n\n### migrating to `v0.2.0`\n\n### _FSSpecAccessor subclasses with custom filesystem access methods\n\nIf you implemented a custom accessor subclass, it is now recommended to override\nthe corresponding `UPath` methods in your subclass directly:\n\n```python\n# OLD: v0.1.x\nfrom upath.core import UPath, _FSSpecAccessor\n\nclass MyAccessor(_FSSpecAccessor):\n    def exists(self, path, **kwargs):\n        # custom code\n        return path.fs.exists(self._format_path(path), **kwargs)\n\n    def touch(self, path, **kwargs):\n        # custom\n        return path.fs.touch(self._format_path(path), **kwargs)\n\nclass MyPath(UPath):\n    _default_accessor = MyAccessor\n\n\n# NEW: v0.2.0+\nfrom upath import UPath\n\nclass MyPath(UPath):\n    def exists(self, *, follow_symlinks=True):\n        kwargs = {}  # custom code\n        return self.fs.exists(self.path, **kwargs)\n\n    def touch(self, mode=0o666, exist_ok=True):\n        kwargs = {}  # custom code\n        self.fs.touch(self.path, **kwargs)\n```\n\n### _FSSpecAccessor subclasses with custom `__init__` method\n\nIf you implemented a custom `__init__` method for your accessor subclass usually\nthe intention is to customize how the fsspec filesystem instance is created. You\nhave two options to recreate this with the new implementation. Chose one or both\ndependent on the level of control you need.\n\n```python\n# OLD: v0.1.x\nimport fsspec\nfrom upath.core import UPath, _FSSpecAccessor\n\nclass MyAccessor(_FSSpecAccessor):\n    def __init__(self, parsed_url: SplitResult | None, **kwargs: Any) -\u003e None:\n        # custom code\n        protocol = ...\n        storage_options = ...\n        self._fs = fsspec.filesystem(protocol, storage_options)\n\nclass MyPath(UPath):\n    _default_accessor = MyAccessor\n\n\n# NEW: v0.2.0+\nfrom upath import UPath\n\nclass MyPath(UPath):\n    @classmethod\n    def _parse_storage_options(\n        cls, urlpath: str, protocol: str, storage_options: Mapping[str, Any]\n    ) -\u003e dict[str, Any]:\n        # custom code to change storage_options\n        storage_options = ...\n        return storage_options\n\n    @classmethod\n    def _fs_factory(\n        cls, urlpath: str, protocol: str, storage_options: Mapping[str, Any]\n    ) -\u003e AbstractFileSystem:\n        # custom code to instantiate fsspec filesystem\n        protocol = ...\n        storage_options = ...  # note changes to storage_options here won't\n                               # show up in MyPath().storage_options\n        return fsspec.filesystem(protocol, **storage_options)\n```\n\n### Access to `._accessor`\n\nThe `_accessor` attribute and the `_FSSpecAccessor` class is deprecated. In case\nyou need direct access to the underlying filesystem, just access `UPath().fs`.\n\n```python\n# OLD: v0.1.x\nfrom upath.core import UPath\n\nclass MyPath(UPath):\n    def mkdir(self, mode=0o777, parents=False, exist_ok=False):\n        self._accessor.mkdir(...)  # custom access to the underlying fs...\n\n\n# NEW: v0.2.0+\nfrom upath import UPath\n\nclass MyPath(UPath):\n    def mkdir(self, mode=0o777, parents=False, exist_ok=False):\n        self.fs.mkdir(...)\n```\n\n### Access to `._path`, `._kwargs`, `._drv`, `._root`, `._parts`\n\nIf you access one of the listed private attributes directly, move your code over\nto the following public versions:\n\n| _deprecated_      | `v0.2.0+`                 |\n|:------------------|:--------------------------|\n| `UPath()._path`   | `UPath().path`            |\n| `UPath()._kwargs` | `UPath().storage_options` |\n| `UPath()._drv`    | `UPath().drive`           |\n| `UPath()._root`   | `UPath().root`            |\n| `UPath()._parts`  | `UPath().parts`           |\n\n### Access to `._url`\n\nBe aware that the `._url` attribute will likely be deprecated once `UPath()` has\nsupport for uri fragments and uri query parameters through a public api. In case\nyou are interested in contributing this functionality, please open an issue!\n\n### Calling `_from_parts`, `_parse_args`, `_format_parsed_parts`\n\nIf your code is currently calling any of the three above listed classmethods, it\nrelies on functionality based on the implementation of `pathlib` in Python up to\n`3.11`. In `universal_pathlib` we vendor code that allows the `UPath()` class to\nbe based on the `3.12` implementation of `pathlib.Path` alone. Usually, usage of\nthose classmethods occurs when copying some code of the internal implementations\nof methods of the `UPath` `0.1.4` classes.\n\n- To reproduce custom `_format_parsed_parts` methods in `v0.2.0`, try overriding\n  `UPath().path` and/or `UPath().with_segments()`.\n- Custom `_from_parts` and `_parse_args` classmethods can now be implemented via\n  the `_transform_init_args` method or via more functionality in the new flavour\n  class. Please open an issue for discussion in case you have this use case.\n\n### Custom `_URIFlavour` classes\n\nThe `_URIFlavour` class was removed from `universal_pathlib` and the new flavour\nclass for fsspec filesystem path operations now lives in `upath._flavour`. As of\nnow the internal FSSpecFlavour is experimental. In a future Python version, it's\nlikely that a flavour or flavour-like base class will become public, that allows\nus to base our internal implementation on. Until then, if you find yourself in a\nsituation where a custom path flavour would solve your problem, please feel free\nto open an issue for discussion. We're happy to find a maintainable solution.\n\n### Using `.parse_parts()`, `.casefold()`, `.join_parsed_parts()` of `._flavour`\n\nThese methods of the `._flavour` attribute of `pathlib.Path()` and `UPath()` are\nspecific to `pathlib` of Python versions up to `3.11`. `UPath()` is now based on\nthe `3.12` implementation of `pathlib.Path`. Please refer to the implementations\nof the `upath._flavour` submodule to see how you could avoid using them.\n\n\n## Known issues solvable by installing newer upstream dependencies\n\nSome issues in `UPath`'s behavior with specific fsspec filesystems are fixed via\ninstallation of a newer version of its upstream dependencies. Below you can find\na list of known issues and their solutions. We attempt to keep this list updated\nwhenever we encounter more:\n\n- currently none :sparkles:\n\n## Contributing\n\nContributions are very welcome.\nTo learn more, see the [Contributor Guide](CONTRIBUTING.rst).\n\n\n## License\n\nDistributed under the terms of the [MIT license](LICENSE),\n*universal_pathlib* is free and open source software.\n\n\n## Issues\n\nIf you encounter any problems, or if you create your own implementations and run\ninto limitations, please [file an issue][issues] with a detailed description. We\nare always happy to help with any problems you might encounter.\n\n[issues]: https://github.com/fsspec/universal_pathlib/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsspec%2Funiversal_pathlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffsspec%2Funiversal_pathlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsspec%2Funiversal_pathlib/lists"}