pathlib-next 0.3.5__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pathlib_next-0.4.0/.gitignore +25 -0
- pathlib_next-0.4.0/CHANGELOG.md +31 -0
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/LICENSE +21 -21
- pathlib_next-0.4.0/PKG-INFO +115 -0
- pathlib_next-0.4.0/README.md +81 -0
- pathlib_next-0.4.0/docs/api/reference.md +3 -0
- pathlib_next-0.4.0/docs/changelog.md +3 -0
- pathlib_next-0.4.0/docs/index.md +29 -0
- {pathlib_next-0.3.5/src → pathlib_next-0.4.0/examples}/example.py +70 -70
- pathlib_next-0.4.0/mkdocs.yml +46 -0
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/pyproject.toml +36 -30
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/__init__.py +10 -10
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/fspath.py +85 -83
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/mempath.py +172 -170
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/path.py +436 -434
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/protocols/__init__.py +2 -2
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/protocols/fs.py +119 -117
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/protocols/io.py +82 -80
- pathlib_next-0.4.0/src/pathlib_next/py.typed +1 -0
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/__init__.py +486 -482
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/query.py +60 -59
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/schemes/__init__.py +10 -10
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/schemes/file.py +65 -63
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/schemes/http.py +144 -142
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/schemes/sftp.py +108 -106
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/uri/source.py +76 -74
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/utils/__init__.py +101 -93
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/utils/glob.py +141 -140
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/utils/stat.py +132 -130
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/src/pathlib_next/utils/sync.py +260 -258
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/tests/test_local.py +22 -22
- {pathlib_next-0.3.5 → pathlib_next-0.4.0}/tests/test_uri.py +99 -99
- pathlib_next-0.3.5/.gitignore +0 -6
- pathlib_next-0.3.5/PKG-INFO +0 -32
- pathlib_next-0.3.5/README.md +0 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Build/dist output and generated docs site
|
|
2
|
+
dist/
|
|
3
|
+
build/
|
|
4
|
+
site/
|
|
5
|
+
|
|
6
|
+
# Agent/harness tooling
|
|
7
|
+
AGENTS.md
|
|
8
|
+
.agents/
|
|
9
|
+
CLAUDE.md
|
|
10
|
+
CLAUDE.local.md
|
|
11
|
+
.claude/
|
|
12
|
+
|
|
13
|
+
# Python-specific
|
|
14
|
+
__pycache__/
|
|
15
|
+
*.py[cod]
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.mypy_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.venv/
|
|
21
|
+
|
|
22
|
+
# Legacy project patterns
|
|
23
|
+
/_*
|
|
24
|
+
[a-zA-Z]*__
|
|
25
|
+
[a-zA-Z]*__.*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.4.0] - 2026-07-11
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Standardized repository layout and relocated examples to `examples/` directory.
|
|
14
|
+
- Configured MkDocs documentation site with dynamic API reference using `mkdocstrings`.
|
|
15
|
+
- Added GitHub Actions workflows for matrix testing (`test.yml`) and release pipelines (`release.yml`).
|
|
16
|
+
- Added typing marker `py.typed` for PEP 561 compliance.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Added backward compatibility support for Python 3.9 and 3.10: added `from __future__ import annotations` across the codebase, refactored runtime-evaluated union types to use `typing.Union`, and provided fallbacks for `TypeAlias` and `ParamSpec`.
|
|
20
|
+
- Updated package requirement to `requires-python = ">=3.9"`.
|
|
21
|
+
|
|
22
|
+
## [0.3.5] - 2026-07-11
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- Split path into protocols that can be standalone.
|
|
26
|
+
- Sync error handling.
|
|
27
|
+
- Generic Path Protocol based pathlib implementation for URI paths with file access support for sftp, http, file schemes.
|
|
28
|
+
|
|
29
|
+
[Unreleased]: https://github.com/jose-pr/pathlib_next/compare/v0.4.0...HEAD
|
|
30
|
+
[0.4.0]: https://github.com/jose-pr/pathlib_next/releases/tag/v0.4.0
|
|
31
|
+
[0.3.5]: https://github.com/jose-pr/pathlib_next/releases/tag/v0.3.5
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Jose A
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jose A
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pathlib_next
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Generic Path Protocol based pathlib
|
|
5
|
+
Project-URL: Homepage, https://github.com/jose-pr/pathlib_next/
|
|
6
|
+
Project-URL: Documentation, https://jose-pr.github.io/pathlib_next/
|
|
7
|
+
Project-URL: Issues, https://github.com/jose-pr/pathlib_next/issues
|
|
8
|
+
Author: Jose A
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: build; extra == 'dev'
|
|
16
|
+
Requires-Dist: hatchling; extra == 'dev'
|
|
17
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
18
|
+
Requires-Dist: twine; extra == 'dev'
|
|
19
|
+
Provides-Extra: docs
|
|
20
|
+
Requires-Dist: mkdocs; extra == 'docs'
|
|
21
|
+
Requires-Dist: mkdocs-material; extra == 'docs'
|
|
22
|
+
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
23
|
+
Provides-Extra: http
|
|
24
|
+
Requires-Dist: bs4; extra == 'http'
|
|
25
|
+
Requires-Dist: htmllistparse; extra == 'http'
|
|
26
|
+
Requires-Dist: requests; extra == 'http'
|
|
27
|
+
Requires-Dist: uritools; extra == 'http'
|
|
28
|
+
Provides-Extra: sftp
|
|
29
|
+
Requires-Dist: paramiko; extra == 'sftp'
|
|
30
|
+
Requires-Dist: uritools; extra == 'sftp'
|
|
31
|
+
Provides-Extra: uri
|
|
32
|
+
Requires-Dist: uritools; extra == 'uri'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# pathlib_next
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/pathlib_next/)
|
|
38
|
+
[](https://pypi.org/project/pathlib_next/)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
[](https://jose-pr.github.io/pathlib_next/)
|
|
41
|
+
[](https://github.com/jose-pr/pathlib_next/actions/workflows/test.yml)
|
|
42
|
+
|
|
43
|
+
Generic Path Protocol based pathlib implementation for URI paths with file access support for sftp, http, file schemes.
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- **Unified URI Interface** — Access resources on sftp, http, or local file schemes using python's familiar pathlib syntax.
|
|
48
|
+
- **In-memory filesystem** — `MemPath` provides a lightweight, virtual file system helper for mock files, testing, or transient storage.
|
|
49
|
+
- **Path synchronization** — `PathSyncer` allows syncing directory structures across different paths with customizable checksums.
|
|
50
|
+
- **Query & Source Parsing** — Parse and serialize complex URL query strings and URI sources easily.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install pathlib_next
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Optional features/extras:
|
|
59
|
+
|
|
60
|
+
| Extra/flag | Adds | Needed for |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `uri` | `uritools` | URI parsing capabilities |
|
|
63
|
+
| `http` | `requests`, `bs4`, `htmllistparse` | Read and list files over HTTP/HTTPS |
|
|
64
|
+
| `sftp` | `paramiko` | SFTP path operations and transfers |
|
|
65
|
+
|
|
66
|
+
## Quick start
|
|
67
|
+
|
|
68
|
+
### Unified Path Operations
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from pathlib_next import Path
|
|
72
|
+
from pathlib_next.uri import UriPath
|
|
73
|
+
|
|
74
|
+
# Use the unified path interface
|
|
75
|
+
local_path = Path("./my_folder")
|
|
76
|
+
http_path = UriPath("http://example.com/data.txt")
|
|
77
|
+
|
|
78
|
+
# Read and print text if it exists
|
|
79
|
+
if http_path.exists():
|
|
80
|
+
print(http_path.read_text())
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## API overview
|
|
84
|
+
|
|
85
|
+
| Module/Package | Purpose |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| `pathlib_next.path` | Base Path implementation and protocols |
|
|
88
|
+
| `pathlib_next.uri` | URI/URL specific path support and Query utils |
|
|
89
|
+
| `pathlib_next.mempath` | In-memory transient path structure |
|
|
90
|
+
| `pathlib_next.utils.sync` | Synchronization functions and PathSyncer class |
|
|
91
|
+
|
|
92
|
+
## Supported Python versions
|
|
93
|
+
|
|
94
|
+
Python >= 3.9
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
See `AGENTS.md` (and the language-specific directive it points to, e.g. `PYTHON.md`)
|
|
99
|
+
for environment setup, dependency install, and test commands.
|
|
100
|
+
|
|
101
|
+
### Releasing
|
|
102
|
+
|
|
103
|
+
This project follows [Semantic Versioning](https://semver.org/) and keeps a
|
|
104
|
+
[`CHANGELOG.md`](CHANGELOG.md). Pushing a tag matching `v*` triggers the release
|
|
105
|
+
workflow: test gate → build → publish → docs deploy (see `AGENTS.md`'s "Repository
|
|
106
|
+
Structure" section and the language-specific CI/CD notes for the concrete jobs).
|
|
107
|
+
|
|
108
|
+
### Documentation site
|
|
109
|
+
|
|
110
|
+
MkDocs builds the API reference from `docs/`, published on every
|
|
111
|
+
release. To preview locally: `mkdocs serve`.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# pathlib_next
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/pathlib_next/)
|
|
4
|
+
[](https://pypi.org/project/pathlib_next/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://jose-pr.github.io/pathlib_next/)
|
|
7
|
+
[](https://github.com/jose-pr/pathlib_next/actions/workflows/test.yml)
|
|
8
|
+
|
|
9
|
+
Generic Path Protocol based pathlib implementation for URI paths with file access support for sftp, http, file schemes.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Unified URI Interface** — Access resources on sftp, http, or local file schemes using python's familiar pathlib syntax.
|
|
14
|
+
- **In-memory filesystem** — `MemPath` provides a lightweight, virtual file system helper for mock files, testing, or transient storage.
|
|
15
|
+
- **Path synchronization** — `PathSyncer` allows syncing directory structures across different paths with customizable checksums.
|
|
16
|
+
- **Query & Source Parsing** — Parse and serialize complex URL query strings and URI sources easily.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install pathlib_next
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Optional features/extras:
|
|
25
|
+
|
|
26
|
+
| Extra/flag | Adds | Needed for |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `uri` | `uritools` | URI parsing capabilities |
|
|
29
|
+
| `http` | `requests`, `bs4`, `htmllistparse` | Read and list files over HTTP/HTTPS |
|
|
30
|
+
| `sftp` | `paramiko` | SFTP path operations and transfers |
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
### Unified Path Operations
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from pathlib_next import Path
|
|
38
|
+
from pathlib_next.uri import UriPath
|
|
39
|
+
|
|
40
|
+
# Use the unified path interface
|
|
41
|
+
local_path = Path("./my_folder")
|
|
42
|
+
http_path = UriPath("http://example.com/data.txt")
|
|
43
|
+
|
|
44
|
+
# Read and print text if it exists
|
|
45
|
+
if http_path.exists():
|
|
46
|
+
print(http_path.read_text())
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## API overview
|
|
50
|
+
|
|
51
|
+
| Module/Package | Purpose |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `pathlib_next.path` | Base Path implementation and protocols |
|
|
54
|
+
| `pathlib_next.uri` | URI/URL specific path support and Query utils |
|
|
55
|
+
| `pathlib_next.mempath` | In-memory transient path structure |
|
|
56
|
+
| `pathlib_next.utils.sync` | Synchronization functions and PathSyncer class |
|
|
57
|
+
|
|
58
|
+
## Supported Python versions
|
|
59
|
+
|
|
60
|
+
Python >= 3.9
|
|
61
|
+
|
|
62
|
+
## Development
|
|
63
|
+
|
|
64
|
+
See `AGENTS.md` (and the language-specific directive it points to, e.g. `PYTHON.md`)
|
|
65
|
+
for environment setup, dependency install, and test commands.
|
|
66
|
+
|
|
67
|
+
### Releasing
|
|
68
|
+
|
|
69
|
+
This project follows [Semantic Versioning](https://semver.org/) and keeps a
|
|
70
|
+
[`CHANGELOG.md`](CHANGELOG.md). Pushing a tag matching `v*` triggers the release
|
|
71
|
+
workflow: test gate → build → publish → docs deploy (see `AGENTS.md`'s "Repository
|
|
72
|
+
Structure" section and the language-specific CI/CD notes for the concrete jobs).
|
|
73
|
+
|
|
74
|
+
### Documentation site
|
|
75
|
+
|
|
76
|
+
MkDocs builds the API reference from `docs/`, published on every
|
|
77
|
+
release. To preview locally: `mkdocs serve`.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# pathlib_next
|
|
2
|
+
|
|
3
|
+
Generic Path Protocol based pathlib implementation for URI paths with file access support for sftp, http, file schemes.
|
|
4
|
+
|
|
5
|
+
For the full feature list, installation extras, quick-start examples for every
|
|
6
|
+
integration, and known limitations, see the
|
|
7
|
+
[project README](https://github.com/jose-pr/pathlib_next#readme). This site adds the
|
|
8
|
+
generated [API reference](api/reference.md) and the [changelog](changelog.md).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install pathlib_next
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from pathlib_next import Path
|
|
20
|
+
from pathlib_next.uri import UriPath
|
|
21
|
+
|
|
22
|
+
# Use the unified path interface
|
|
23
|
+
local_path = Path("./my_folder")
|
|
24
|
+
http_path = UriPath("http://example.com/data.txt")
|
|
25
|
+
|
|
26
|
+
# Read and print text if it exists
|
|
27
|
+
if http_path.exists():
|
|
28
|
+
print(http_path.read_text())
|
|
29
|
+
```
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from pathlib_next import Path, glob
|
|
4
|
-
from pathlib_next.mempath import MemPath
|
|
5
|
-
from pathlib_next.uri import Query, Source, Uri, UriPath
|
|
6
|
-
from pathlib_next.utils.sync import PathAndStat, PathSyncer
|
|
7
|
-
|
|
8
|
-
rootless = Uri("sftp://root@sftpexample")
|
|
9
|
-
rootless.source
|
|
10
|
-
authkeys = rootless / "root/.ssh/authorized_keys"
|
|
11
|
-
keys = authkeys.as_uri()
|
|
12
|
-
|
|
13
|
-
local = Path("./_ssh")
|
|
14
|
-
|
|
15
|
-
mempath = MemPath("test/test3") / "subpath"
|
|
16
|
-
mempath.parent.mkdir(parents=True, exist_ok=True)
|
|
17
|
-
mempath.write_text("test")
|
|
18
|
-
check = mempath.read_text()
|
|
19
|
-
mempath.parent.rm(recursive=True)
|
|
20
|
-
|
|
21
|
-
query = Query({"test": "://$#!1", "test2&": [1, 2]})
|
|
22
|
-
q2 = Query(str(query)).to_dict()
|
|
23
|
-
for name, value in query:
|
|
24
|
-
print(f"{name}: {value}")
|
|
25
|
-
src = Source(scheme="scheme", userinfo="user", host="123.com", port=0)
|
|
26
|
-
test = {**src}
|
|
27
|
-
test2 = [*src]
|
|
28
|
-
dest = UriPath("file:./_ssh")
|
|
29
|
-
|
|
30
|
-
#
|
|
31
|
-
# Norm test
|
|
32
|
-
#
|
|
33
|
-
with_dots = UriPath("a/b/c/d/../../test/.")
|
|
34
|
-
print(with_dots.normalized_path)
|
|
35
|
-
|
|
36
|
-
source_host = UriPath("file://test.com/path1/path2/path3/path4")
|
|
37
|
-
source_host.is_local()
|
|
38
|
-
|
|
39
|
-
rel_to = source_host.relative_to("/path1/path2")
|
|
40
|
-
dest = UriPath(dest)
|
|
41
|
-
test_ = UriPath("file:") / "test"
|
|
42
|
-
empty = UriPath()
|
|
43
|
-
uri = dest.as_uri()
|
|
44
|
-
|
|
45
|
-
test1 = dest / "test" / "test2/"
|
|
46
|
-
print(test1)
|
|
47
|
-
|
|
48
|
-
sftp_root = UriPath("sftp://root@sftpexample/")
|
|
49
|
-
print(sftp_root.as_posix())
|
|
50
|
-
authkeys = sftp_root / "root/.ssh/authorized_keys"
|
|
51
|
-
print(authkeys.as_posix())
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def checksum(uri: PathAndStat):
|
|
55
|
-
stat = uri.stat
|
|
56
|
-
return hash(stat.st_size)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
syncer = PathSyncer(checksum, remove_missing=False)
|
|
60
|
-
syncer.sync((sftp_root / "root/.ssh"), dest, dry_run=False)
|
|
61
|
-
|
|
62
|
-
rocky_repo = UriPath("http://dl.rockylinux.org/pub")
|
|
63
|
-
|
|
64
|
-
glob_test = UriPath("file:src/**/*.py")
|
|
65
|
-
|
|
66
|
-
for path in glob.glob(glob_test, recursive=True):
|
|
67
|
-
print(path)
|
|
68
|
-
|
|
69
|
-
print(rocky_repo.is_dir())
|
|
70
|
-
print(list(rocky_repo.iterdir()))
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from pathlib_next import Path, glob
|
|
4
|
+
from pathlib_next.mempath import MemPath
|
|
5
|
+
from pathlib_next.uri import Query, Source, Uri, UriPath
|
|
6
|
+
from pathlib_next.utils.sync import PathAndStat, PathSyncer
|
|
7
|
+
|
|
8
|
+
rootless = Uri("sftp://root@sftpexample")
|
|
9
|
+
rootless.source
|
|
10
|
+
authkeys = rootless / "root/.ssh/authorized_keys"
|
|
11
|
+
keys = authkeys.as_uri()
|
|
12
|
+
|
|
13
|
+
local = Path("./_ssh")
|
|
14
|
+
|
|
15
|
+
mempath = MemPath("test/test3") / "subpath"
|
|
16
|
+
mempath.parent.mkdir(parents=True, exist_ok=True)
|
|
17
|
+
mempath.write_text("test")
|
|
18
|
+
check = mempath.read_text()
|
|
19
|
+
mempath.parent.rm(recursive=True)
|
|
20
|
+
|
|
21
|
+
query = Query({"test": "://$#!1", "test2&": [1, 2]})
|
|
22
|
+
q2 = Query(str(query)).to_dict()
|
|
23
|
+
for name, value in query:
|
|
24
|
+
print(f"{name}: {value}")
|
|
25
|
+
src = Source(scheme="scheme", userinfo="user", host="123.com", port=0)
|
|
26
|
+
test = {**src}
|
|
27
|
+
test2 = [*src]
|
|
28
|
+
dest = UriPath("file:./_ssh")
|
|
29
|
+
|
|
30
|
+
#
|
|
31
|
+
# Norm test
|
|
32
|
+
#
|
|
33
|
+
with_dots = UriPath("a/b/c/d/../../test/.")
|
|
34
|
+
print(with_dots.normalized_path)
|
|
35
|
+
|
|
36
|
+
source_host = UriPath("file://test.com/path1/path2/path3/path4")
|
|
37
|
+
source_host.is_local()
|
|
38
|
+
|
|
39
|
+
rel_to = source_host.relative_to("/path1/path2")
|
|
40
|
+
dest = UriPath(dest)
|
|
41
|
+
test_ = UriPath("file:") / "test"
|
|
42
|
+
empty = UriPath()
|
|
43
|
+
uri = dest.as_uri()
|
|
44
|
+
|
|
45
|
+
test1 = dest / "test" / "test2/"
|
|
46
|
+
print(test1)
|
|
47
|
+
|
|
48
|
+
sftp_root = UriPath("sftp://root@sftpexample/")
|
|
49
|
+
print(sftp_root.as_posix())
|
|
50
|
+
authkeys = sftp_root / "root/.ssh/authorized_keys"
|
|
51
|
+
print(authkeys.as_posix())
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def checksum(uri: PathAndStat):
|
|
55
|
+
stat = uri.stat
|
|
56
|
+
return hash(stat.st_size)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
syncer = PathSyncer(checksum, remove_missing=False)
|
|
60
|
+
syncer.sync((sftp_root / "root/.ssh"), dest, dry_run=False)
|
|
61
|
+
|
|
62
|
+
rocky_repo = UriPath("http://dl.rockylinux.org/pub")
|
|
63
|
+
|
|
64
|
+
glob_test = UriPath("file:src/**/*.py")
|
|
65
|
+
|
|
66
|
+
for path in glob.glob(glob_test, recursive=True):
|
|
67
|
+
print(path)
|
|
68
|
+
|
|
69
|
+
print(rocky_repo.is_dir())
|
|
70
|
+
print(list(rocky_repo.iterdir()))
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
site_name: pathlib_next
|
|
2
|
+
site_description: Generic Path Protocol based pathlib
|
|
3
|
+
site_url: https://jose-pr.github.io/pathlib_next/
|
|
4
|
+
repo_url: https://github.com/jose-pr/pathlib_next
|
|
5
|
+
repo_name: jose-pr/pathlib_next
|
|
6
|
+
edit_uri: edit/main/docs/
|
|
7
|
+
|
|
8
|
+
theme:
|
|
9
|
+
name: material
|
|
10
|
+
palette:
|
|
11
|
+
- media: "(prefers-color-scheme: light)"
|
|
12
|
+
scheme: default
|
|
13
|
+
toggle:
|
|
14
|
+
icon: material/brightness-7
|
|
15
|
+
name: Switch to dark mode
|
|
16
|
+
- media: "(prefers-color-scheme: dark)"
|
|
17
|
+
scheme: slate
|
|
18
|
+
toggle:
|
|
19
|
+
icon: material/brightness-4
|
|
20
|
+
name: Switch to light mode
|
|
21
|
+
features:
|
|
22
|
+
- navigation.sections
|
|
23
|
+
- content.code.copy
|
|
24
|
+
|
|
25
|
+
nav:
|
|
26
|
+
- Home: index.md
|
|
27
|
+
- API Reference: api/reference.md
|
|
28
|
+
- Changelog: changelog.md
|
|
29
|
+
|
|
30
|
+
plugins:
|
|
31
|
+
- search
|
|
32
|
+
- mkdocstrings:
|
|
33
|
+
handlers:
|
|
34
|
+
python:
|
|
35
|
+
options:
|
|
36
|
+
show_source: true
|
|
37
|
+
show_root_heading: true
|
|
38
|
+
merge_init_into_class: true
|
|
39
|
+
show_if_no_docstring: true
|
|
40
|
+
|
|
41
|
+
markdown_extensions:
|
|
42
|
+
- admonition
|
|
43
|
+
- tables
|
|
44
|
+
- pymdownx.snippets:
|
|
45
|
+
base_path: ["."]
|
|
46
|
+
- pymdownx.superfences
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "pathlib_next"
|
|
7
|
-
version = "0.
|
|
8
|
-
authors = [{ name = "Jose A" }]
|
|
9
|
-
description = "Generic Path Protocol based pathlib"
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
requires-python = ">=3.
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Programming Language :: Python :: 3",
|
|
14
|
-
"License :: OSI Approved :: MIT License",
|
|
15
|
-
"Operating System :: OS Independent",
|
|
16
|
-
]
|
|
17
|
-
dependencies = []
|
|
18
|
-
[project.optional-dependencies]
|
|
19
|
-
uri = ["uritools"]
|
|
20
|
-
http = ["requests", "pathlib_next[uri]", 'htmllistparse', 'bs4']
|
|
21
|
-
sftp = ["paramiko", "pathlib_next[uri]"]
|
|
22
|
-
dev = ['build', 'twine', 'hatchling', 'pytest']
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[project.urls]
|
|
26
|
-
Homepage = "https://github.com/jose-pr/pathlib_next/"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pathlib_next"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
authors = [{ name = "Jose A" }]
|
|
9
|
+
description = "Generic Path Protocol based pathlib"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
dependencies = []
|
|
18
|
+
[project.optional-dependencies]
|
|
19
|
+
uri = ["uritools"]
|
|
20
|
+
http = ["requests", "pathlib_next[uri]", 'htmllistparse', 'bs4']
|
|
21
|
+
sftp = ["paramiko", "pathlib_next[uri]"]
|
|
22
|
+
dev = ['build', 'twine', 'hatchling', 'pytest']
|
|
23
|
+
docs = ['mkdocs', 'mkdocs-material', 'mkdocstrings[python]']
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/jose-pr/pathlib_next/"
|
|
27
|
+
Documentation = "https://jose-pr.github.io/pathlib_next/"
|
|
28
|
+
Issues = "https://github.com/jose-pr/pathlib_next/issues"
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.sdist]
|
|
31
|
+
exclude = ["/.*"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
pythonpath = ["src"]
|
|
36
|
+
testpaths = ["tests"]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
try:
|
|
2
|
-
from .uri import Uri as Uri
|
|
3
|
-
from .uri import UriPath as UriPath
|
|
4
|
-
from .uri.schemes import *
|
|
5
|
-
except ImportError:
|
|
6
|
-
pass
|
|
7
|
-
from .fspath import *
|
|
8
|
-
from .path import *
|
|
9
|
-
from .utils import glob as glob
|
|
10
|
-
from .utils import sync as sync
|
|
1
|
+
try:
|
|
2
|
+
from .uri import Uri as Uri
|
|
3
|
+
from .uri import UriPath as UriPath
|
|
4
|
+
from .uri.schemes import *
|
|
5
|
+
except ImportError:
|
|
6
|
+
pass
|
|
7
|
+
from .fspath import *
|
|
8
|
+
from .path import *
|
|
9
|
+
from .utils import glob as glob
|
|
10
|
+
from .utils import sync as sync
|