charmlibs-pathops 1.0.1.post0__tar.gz → 1.2.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.
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/PKG-INFO +6 -4
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/pyproject.toml +24 -5
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/__init__.py +2 -1
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_container_path.py +11 -5
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_types.py +16 -3
- charmlibs_pathops-1.2.0/src/charmlibs/pathops/_version.txt +1 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/PKG-INFO +6 -4
- charmlibs_pathops-1.0.1.post0/src/charmlibs/pathops/_version.txt +0 -1
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/README.md +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/setup.cfg +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_constants.py +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_errors.py +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_fileinfo.py +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_functions.py +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_local_path.py +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/py.typed +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/SOURCES.txt +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/dependency_links.txt +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/requires.txt +0 -0
- {charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/top_level.txt +0 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: charmlibs-pathops
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A pathlib-like interface for Juju K8s charms to interact with files in their workload container.
|
|
5
5
|
Author: The Charm Tech team at Canonical Ltd.
|
|
6
|
-
Project-URL:
|
|
7
|
-
Project-URL:
|
|
6
|
+
Project-URL: Documentation, https://documentation.ubuntu.com/charmlibs
|
|
7
|
+
Project-URL: Repository, https://github.com/canonical/charmlibs
|
|
8
|
+
Project-URL: Issues, https://github.com/canonical/charmlibs/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/canonical/charmlibs/blob/main/pathops/CHANGELOG.md
|
|
8
10
|
Classifier: Programming Language :: Python :: 3
|
|
9
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
13
|
Classifier: Operating System :: POSIX :: Linux
|
|
12
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.10
|
|
14
16
|
Description-Content-Type: text/markdown
|
|
15
17
|
Requires-Dist: ops<4,>=2.19
|
|
16
18
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name = "charmlibs-pathops"
|
|
3
3
|
description = "A pathlib-like interface for Juju K8s charms to interact with files in their workload container."
|
|
4
4
|
readme = "README.md"
|
|
5
|
-
requires-python = ">=3.
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
6
|
authors = [
|
|
7
7
|
{name="The Charm Tech team at Canonical Ltd."},
|
|
8
8
|
]
|
|
@@ -18,9 +18,21 @@ dependencies = [
|
|
|
18
18
|
"ops>=2.19,<4",
|
|
19
19
|
]
|
|
20
20
|
|
|
21
|
+
[dependency-groups]
|
|
22
|
+
lint = [
|
|
23
|
+
"typing_extensions",
|
|
24
|
+
]
|
|
25
|
+
unit = []
|
|
26
|
+
functional = []
|
|
27
|
+
integration = [
|
|
28
|
+
"jubilant",
|
|
29
|
+
]
|
|
30
|
+
|
|
21
31
|
[project.urls]
|
|
22
|
-
"
|
|
23
|
-
"
|
|
32
|
+
"Documentation" = "https://documentation.ubuntu.com/charmlibs"
|
|
33
|
+
"Repository" = "https://github.com/canonical/charmlibs"
|
|
34
|
+
"Issues" = "https://github.com/canonical/charmlibs/issues"
|
|
35
|
+
"Changelog" = "https://github.com/canonical/charmlibs/blob/main/pathops/CHANGELOG.md"
|
|
24
36
|
|
|
25
37
|
[build-system]
|
|
26
38
|
requires = [
|
|
@@ -33,9 +45,16 @@ version = {file = ["src/charmlibs/pathops/_version.txt"]}
|
|
|
33
45
|
|
|
34
46
|
[tool.ruff]
|
|
35
47
|
extend = "../pyproject.toml"
|
|
36
|
-
src = ["src", "tests/unit", "tests/integration
|
|
48
|
+
src = ["src", "tests/unit", "tests/functional", "tests/integration"] # correctly sort local imports in tests
|
|
37
49
|
|
|
38
50
|
[tool.pyright]
|
|
39
51
|
extend = "../pyproject.toml"
|
|
40
52
|
include = ["src", "tests"]
|
|
41
|
-
pythonVersion = "3.
|
|
53
|
+
pythonVersion = "3.10"
|
|
54
|
+
|
|
55
|
+
[tool.charmlibs.functional]
|
|
56
|
+
pebble = ["v1.1.1","master"]
|
|
57
|
+
ubuntu = ["22.04", "latest"]
|
|
58
|
+
|
|
59
|
+
[tool.charmlibs.integration]
|
|
60
|
+
tags = ["22.04", "24.04"]
|
|
@@ -21,7 +21,8 @@ The ``pathops`` charm library provides:
|
|
|
21
21
|
- :class:`ContainerPath`: the concrete implementation of the interface for remote paths in the
|
|
22
22
|
workload container of Kubernetes charms. Operations are implemented using the Pebble file API.
|
|
23
23
|
- :class:`LocalPath`: the concrete implementation of the interface for local paths, which includes
|
|
24
|
-
both machine charms and the charm container of Kubernetes charms.
|
|
24
|
+
both machine charms and the charm container of Kubernetes charms. Inherits from
|
|
25
|
+
:class:`pathlib.PosixPath` and extends the signature of some methods.
|
|
25
26
|
- Top-level helper functions such as :func:`ensure_contents`, which operate on both container
|
|
26
27
|
and local paths.
|
|
27
28
|
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_container_path.py
RENAMED
|
@@ -28,9 +28,10 @@ from . import _constants, _errors, _fileinfo
|
|
|
28
28
|
|
|
29
29
|
if typing.TYPE_CHECKING:
|
|
30
30
|
import os
|
|
31
|
-
from
|
|
31
|
+
from collections.abc import Generator
|
|
32
|
+
from typing import Literal, TypeGuard
|
|
32
33
|
|
|
33
|
-
from typing_extensions import Self
|
|
34
|
+
from typing_extensions import Self
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class RelativePathError(ValueError):
|
|
@@ -514,16 +515,21 @@ class ContainerPath:
|
|
|
514
515
|
_errors.raise_not_a_directory(repr(self))
|
|
515
516
|
self._remove_path()
|
|
516
517
|
|
|
517
|
-
def unlink(self) -> None:
|
|
518
|
+
def unlink(self, missing_ok: bool = False) -> None:
|
|
518
519
|
"""Remove this path if it is not a directory.
|
|
519
520
|
|
|
520
521
|
Raises:
|
|
521
|
-
FileNotFoundError: if the path does not exist.
|
|
522
|
+
FileNotFoundError: if the path does not exist and ``missing_ok`` is false.
|
|
522
523
|
IsADirectoryError: if the path exists but is a directory.
|
|
523
524
|
PermissionError: if the Pebble user does not have permissions for the operation.
|
|
524
525
|
PebbleConnectionError: if the remote Pebble client cannot be reached.
|
|
525
526
|
"""
|
|
526
|
-
|
|
527
|
+
try:
|
|
528
|
+
info = _fileinfo.from_container_path(self, follow_symlinks=False)
|
|
529
|
+
except FileNotFoundError:
|
|
530
|
+
if missing_ok:
|
|
531
|
+
return
|
|
532
|
+
raise
|
|
527
533
|
if info.type == pebble.FileType.DIRECTORY:
|
|
528
534
|
_errors.raise_is_a_directory(repr(self))
|
|
529
535
|
self._remove_path()
|
|
@@ -22,7 +22,7 @@ from . import _constants
|
|
|
22
22
|
|
|
23
23
|
if typing.TYPE_CHECKING:
|
|
24
24
|
import os
|
|
25
|
-
from
|
|
25
|
+
from collections.abc import Generator, Sequence
|
|
26
26
|
|
|
27
27
|
from typing_extensions import Self
|
|
28
28
|
|
|
@@ -50,6 +50,19 @@ class PathProtocol(typing.Protocol):
|
|
|
50
50
|
not the case, then equality is ``False`` and other comparisons are :class:`NotImplemented`.
|
|
51
51
|
|
|
52
52
|
Protocol implementers are hashable.
|
|
53
|
+
|
|
54
|
+
.. warning::
|
|
55
|
+
User implementations of ``PathProtocol`` are not covered by this package's semantic
|
|
56
|
+
versioning promise.
|
|
57
|
+
|
|
58
|
+
The semantic versioning of this package reflects the runtime use of :class:`ContainerPath`
|
|
59
|
+
and :class:`LocalPath`. ``PathProtocol`` is always updated to reflect the latest changes to
|
|
60
|
+
:class:`ContainerPath` and :class:`LocalPath`.
|
|
61
|
+
|
|
62
|
+
``PathProtocol`` will always be a valid type annotation for :class:`ContainerPath`,
|
|
63
|
+
:class:`LocalPath`, and :class:`pathlib.PosixPath` objects. However, user implementations
|
|
64
|
+
of ``PathProtocol`` may experience type checking breakage on minor version bumps of this
|
|
65
|
+
package.
|
|
53
66
|
"""
|
|
54
67
|
|
|
55
68
|
#############################
|
|
@@ -367,11 +380,11 @@ class PathProtocol(typing.Protocol):
|
|
|
367
380
|
"""
|
|
368
381
|
...
|
|
369
382
|
|
|
370
|
-
def unlink(self) -> None:
|
|
383
|
+
def unlink(self, missing_ok: bool = False) -> None:
|
|
371
384
|
"""Remove this path if it is not a directory.
|
|
372
385
|
|
|
373
386
|
Raises:
|
|
374
|
-
FileNotFoundError: if the path does not exist.
|
|
387
|
+
FileNotFoundError: if the path does not exist and ``missing_ok`` is false.
|
|
375
388
|
IsADirectoryError: if the path exists but is a directory.
|
|
376
389
|
PermissionError: if the local or remote user does not have the appropriate permissions.
|
|
377
390
|
PebbleConnectionError: if the remote Pebble client cannot be reached.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.2.0
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/PKG-INFO
RENAMED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: charmlibs-pathops
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: A pathlib-like interface for Juju K8s charms to interact with files in their workload container.
|
|
5
5
|
Author: The Charm Tech team at Canonical Ltd.
|
|
6
|
-
Project-URL:
|
|
7
|
-
Project-URL:
|
|
6
|
+
Project-URL: Documentation, https://documentation.ubuntu.com/charmlibs
|
|
7
|
+
Project-URL: Repository, https://github.com/canonical/charmlibs
|
|
8
|
+
Project-URL: Issues, https://github.com/canonical/charmlibs/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/canonical/charmlibs/blob/main/pathops/CHANGELOG.md
|
|
8
10
|
Classifier: Programming Language :: Python :: 3
|
|
9
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
13
|
Classifier: Operating System :: POSIX :: Linux
|
|
12
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.10
|
|
14
16
|
Description-Content-Type: text/markdown
|
|
15
17
|
Requires-Dist: ops<4,>=2.19
|
|
16
18
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.0.1.post0
|
|
File without changes
|
|
File without changes
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_constants.py
RENAMED
|
File without changes
|
|
File without changes
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_fileinfo.py
RENAMED
|
File without changes
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_functions.py
RENAMED
|
File without changes
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs/pathops/_local_path.py
RENAMED
|
File without changes
|
|
File without changes
|
{charmlibs_pathops-1.0.1.post0 → charmlibs_pathops-1.2.0}/src/charmlibs_pathops.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|