1010[ ![ Codestyle black] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/psf/black )
1111[ ![ Changelog] ( https://img.shields.io/badge/changelog-Keep%20a%20Changelog-%23E05735 )] ( ./CHANGELOG.md )
1212
13- Universal Pathlib is a Python library that extends the [ ` pathlib.Path ` ] [ pathlib ]
14- API to support a variety of backend filesystems via [ ` filesystem_spec ` ] [ fsspec ] .
13+ Universal Pathlib is a Python library that extends the
14+ [ ` pathlib_abc.JoinablePath ` ] [ pathlib_abc ] API to provide a
15+ [ ` pathlib.Path ` ] [ pathlib ] -like interface for a variety of backend filesystems
16+ via [ ` filesystem_spec ` ] [ fsspec ] .
1517
18+ [ pathlib_abc ] : https://github.com/barneygale/pathlib-abc
1619[ pathlib ] : https://docs.python.org/3/library/pathlib.html
1720[ fsspec ] : https://filesystem-spec.readthedocs.io/en/latest/intro.html
1821
@@ -44,9 +47,9 @@ project as a dependency if you want to use it with `s3` and `http` filesystems:
4447``` toml
4548[project ]
4649name = " myproject"
47- requires-python = " >=3.8 "
50+ requires-python = " >=3.9 "
4851dependencies = [
49- " universal_pathlib>=0.2.5 " ,
52+ " universal_pathlib>=0.3.0 " ,
5053 " fsspec[s3,http]" ,
5154]
5255```
@@ -106,33 +109,51 @@ And of course, contributions for new filesystems are welcome!
106109
107110### Class hierarchy
108111
109- The class hierarchy for ` UPath ` implementations and their relation to the stdlib
110- ` pathlib ` classes are visualized in the following diagram:
112+ The class hierarchy for ` UPath ` implementations and their relation to base classes
113+ in ` pathlib_abc ` and the stdlib ` pathlib ` classes are visualized in the following
114+ diagram:
111115
112116``` mermaid
113117flowchart TB
118+
119+ subgraph p0[pathlib_abc]
120+ X ----> Y
121+ X ----> Z
122+ end
123+
114124 subgraph s0[pathlib]
115- A---> B
125+ X --> A
126+
127+ A----> B
116128 A--> AP
117129 A--> AW
118130
131+ Y --> B
132+ Z --> B
133+
119134 B--> BP
120- AP---> BP
135+ AP---- > BP
121136 B--> BW
122- AW---> BW
137+ AW---- > BW
123138 end
124139 subgraph s1[upath]
125- B ---> U
140+ Y ---> U
141+ Z ---> U
142+
126143 U --> UP
127144 U --> UW
128- BP --> UP
129- BW --> UW
145+ BP --- > UP
146+ BW --- > UW
130147 U --> UL
131148 U --> US3
132149 U --> UH
133150 U -.-> UO
134151 end
135152
153+ X(JoinablePath)
154+ Y(WritablePath)
155+ Z(ReadablePath)
156+
136157 A(PurePath)
137158 AP(PurePosixPath)
138159 AW(PureWindowsPath)
@@ -148,14 +169,17 @@ flowchart TB
148169 UH(HttpPath)
149170 UO(...Path)
150171
172+ classDef na fill:#f7f7f7,stroke:#02a822,stroke-width:2px,color:#333
151173 classDef np fill:#f7f7f7,stroke:#2166ac,stroke-width:2px,color:#333
152174 classDef nu fill:#f7f7f7,stroke:#b2182b,stroke-width:2px,color:#333
153175
176+ class X,Y,Z na
154177 class A,AP,AW,B,BP,BW,UP,UW np
155178 class U,UL,US3,UH,UO nu
156179
157180 style UO stroke-dasharray: 3 3
158181
182+ style p0 fill:none,stroke:#0a2,stroke-width:3px,stroke-dasharray:3,color:#0a2
159183 style s0 fill:none,stroke:#07b,stroke-width:3px,stroke-dasharray:3,color:#07b
160184 style s1 fill:none,stroke:#d02,stroke-width:3px,stroke-dasharray:3,color:#d02
161185```
@@ -170,16 +194,20 @@ correct behavior for filesystems that are not tested in the test-suite.
170194
171195### Local paths and url paths
172196
173- If a local path is provided ` UPath ` will return a ` PosixUPath ` or ` WindowsUPath `
174- instance. These two implementations are 100% compatible with the ` PosixPath ` and
175- ` WindowsPath ` classes of their specific Python version. They're tested against a
176- large subset of the CPython pathlib test-suite to ensure compatibility.
197+ If a local path is without protocol is provided ` UPath ` will return a ` PosixUPath `
198+ or ` WindowsUPath ` instance. These two implementations are 100% compatible with
199+ the ` PosixPath ` and ` WindowsPath ` classes of their specific Python version.
200+ They're tested against a large subset of the CPython pathlib test-suite to ensure
201+ compatibility.
177202
178203If a local urlpath is provided, i.e. a "file://" or "local://" URI, the returned
179204instance type will be a ` FilePath ` instance. This class is a subclass of ` UPath `
180205that provides file access via ` LocalFileSystem ` from ` fsspec ` . You can use it to
181206ensure that all your local file access is done through ` fsspec ` as well.
182207
208+ All local UPath types are ` os.PathLike ` , but only the ` PosixUPath ` and
209+ ` WindowsUPath ` are subclasses of ` pathlib.Path ` .
210+
183211### UPath public class API
184212
185213The public class interface of ` UPath ` extends ` pathlib.Path ` via attributes that
0 commit comments