vocker 0.1.0__tar.gz → 0.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.
- {vocker-0.1.0/src/vocker.egg-info → vocker-0.2.0}/PKG-INFO +1 -2
- {vocker-0.1.0 → vocker-0.2.0}/pyproject.toml +1 -2
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/system.py +34 -27
- {vocker-0.1.0 → vocker-0.2.0/src/vocker.egg-info}/PKG-INFO +1 -2
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker.egg-info/requires.txt +0 -1
- {vocker-0.1.0 → vocker-0.2.0}/CHANGELOG.md +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/DESIGN.md +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/MANIFEST.in +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/README.md +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/setup.cfg +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/setup.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/__init__.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/__main__.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/cli.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/dedup.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/dedup_models.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/image.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/integer_to_path.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/multihash.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/py.typed +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/repo/__init__.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/repo/compression.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/repo/io.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/util.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker/util_models.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker.egg-info/SOURCES.txt +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker.egg-info/dependency_links.txt +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/src/vocker.egg-info/top_level.txt +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/__init__.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/conftest.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/test_dedup.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/test_image_venv.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/test_integer_to_path.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/test_manifest.py +0 -0
- {vocker-0.1.0 → vocker-0.2.0}/tests/test_repo.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vocker
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Docker-like manager for virtualenvs
|
|
5
5
|
Author-email: Eduard Christian Dumitrescu <eduard.c.dumitrescu@gmail.com>
|
|
6
6
|
License: General Public License v3
|
|
@@ -18,7 +18,6 @@ Requires-Dist: platformdirs
|
|
|
18
18
|
Requires-Dist: sansio_tools>=1.0.0
|
|
19
19
|
Requires-Dist: sqlalchemy_boltons>=2.4.0
|
|
20
20
|
Requires-Dist: SQLAlchemy
|
|
21
|
-
Requires-Dist: strictyaml
|
|
22
21
|
Requires-Dist: structlog
|
|
23
22
|
Requires-Dist: cbor2
|
|
24
23
|
Provides-Extra: zstandard
|
|
@@ -3,7 +3,7 @@ line-length = 100
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "vocker"
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.2.0"
|
|
7
7
|
description = "Docker-like manager for virtualenvs"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
license = { text = "General Public License v3" }
|
|
@@ -22,7 +22,6 @@ dependencies = [
|
|
|
22
22
|
"sansio_tools>=1.0.0",
|
|
23
23
|
"sqlalchemy_boltons>=2.4.0",
|
|
24
24
|
"SQLAlchemy",
|
|
25
|
-
"strictyaml",
|
|
26
25
|
"structlog",
|
|
27
26
|
"cbor2",
|
|
28
27
|
]
|
|
@@ -16,8 +16,9 @@ import typing as ty
|
|
|
16
16
|
|
|
17
17
|
import atomicwrites
|
|
18
18
|
import attr
|
|
19
|
+
import marshmallow as ma
|
|
20
|
+
import marshmallow.fields as maf
|
|
19
21
|
import platformdirs
|
|
20
|
-
import strictyaml as sy
|
|
21
22
|
import structlog
|
|
22
23
|
|
|
23
24
|
from . import dedup as de, multihash as mh, image as im
|
|
@@ -40,10 +41,6 @@ def validate_local_repo_name(name: str) -> None:
|
|
|
40
41
|
raise ValueError(f"invalid repo name: {name!r}")
|
|
41
42
|
|
|
42
43
|
|
|
43
|
-
def cget(x, *args):
|
|
44
|
-
return x.value.get(*args)
|
|
45
|
-
|
|
46
|
-
|
|
47
44
|
@attr.s(eq=False, hash=False)
|
|
48
45
|
class RemoteRepository:
|
|
49
46
|
uri: str = attr.ib()
|
|
@@ -73,7 +70,8 @@ class _Remotes(MutableMapping[str, RemoteRepository]):
|
|
|
73
70
|
return self.system._config["remote_repositories"]
|
|
74
71
|
|
|
75
72
|
def __getitem__(self, k):
|
|
76
|
-
d = self._data[k]
|
|
73
|
+
d = self._data[k]
|
|
74
|
+
d.pop("comment", None)
|
|
77
75
|
return RemoteRepository(**d)
|
|
78
76
|
|
|
79
77
|
def __setitem__(self, k, v: RemoteRepository | None):
|
|
@@ -90,21 +88,25 @@ class _Remotes(MutableMapping[str, RemoteRepository]):
|
|
|
90
88
|
self[k] = None
|
|
91
89
|
|
|
92
90
|
def __iter__(self):
|
|
93
|
-
return iter(x
|
|
91
|
+
return iter(x for x in self._data)
|
|
94
92
|
|
|
95
93
|
def __len__(self, k, v):
|
|
96
|
-
return len(self._data
|
|
94
|
+
return len(self._data)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class _SchemaWithComment(ma.Schema):
|
|
98
|
+
class Meta:
|
|
99
|
+
unknown = ma.RAISE
|
|
100
|
+
|
|
101
|
+
comment = maf.Field(allow_none=True, data_key="#", required=False)
|
|
97
102
|
|
|
98
103
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
sy.Str(),
|
|
106
|
-
sy.Any(),
|
|
107
|
-
)
|
|
104
|
+
class SchemaRemoteRepository(_SchemaWithComment):
|
|
105
|
+
uri = maf.String(required=True)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class SchemaConfig(_SchemaWithComment):
|
|
109
|
+
remote_repositories = maf.Dict(maf.String(), maf.Nested(SchemaRemoteRepository, required=False))
|
|
108
110
|
|
|
109
111
|
|
|
110
112
|
class ImageType(enum.Enum):
|
|
@@ -112,18 +114,16 @@ class ImageType(enum.Enum):
|
|
|
112
114
|
|
|
113
115
|
|
|
114
116
|
@attr.s(eq=False, hash=False)
|
|
115
|
-
class
|
|
117
|
+
class JSONFileWithCaching:
|
|
116
118
|
path: Path = attr.ib()
|
|
117
|
-
schema = attr.ib(default=None)
|
|
119
|
+
schema: ma.Schema = attr.ib(default=None)
|
|
118
120
|
_mtime = None
|
|
119
121
|
_document = None
|
|
120
122
|
|
|
121
123
|
@property
|
|
122
124
|
def document(self):
|
|
123
125
|
if (mtime := (p := self.path).stat().st_mtime_ns) != self._mtime:
|
|
124
|
-
self._document = doc =
|
|
125
|
-
p.read_bytes().decode("utf-8"), schema=self.schema, label=str(self.path)
|
|
126
|
-
)
|
|
126
|
+
self._document = doc = self.schema.load(json.loads(p.read_bytes()))
|
|
127
127
|
self._mtime = mtime
|
|
128
128
|
else:
|
|
129
129
|
doc = self._document
|
|
@@ -134,7 +134,7 @@ class StrictYamlFileWithCaching:
|
|
|
134
134
|
with atomicwrites.atomic_write(
|
|
135
135
|
str(self.path), mode="wt", overwrite=True, encoding="utf-8", newline="\n"
|
|
136
136
|
) as fp:
|
|
137
|
-
|
|
137
|
+
json.dump(self.schema.dump(new_value), fp, indent=2)
|
|
138
138
|
self._document = new_value
|
|
139
139
|
|
|
140
140
|
|
|
@@ -418,13 +418,13 @@ class System:
|
|
|
418
418
|
|
|
419
419
|
self.path_repo_local.mkdir(exist_ok=True, parents=True)
|
|
420
420
|
|
|
421
|
-
config_path = self.path_base / "
|
|
422
|
-
cfg =
|
|
421
|
+
config_path = self.path_base / "vocker.json"
|
|
422
|
+
cfg = JSONFileWithCaching(config_path, schema=SchemaConfig())
|
|
423
423
|
try:
|
|
424
424
|
cfg.document
|
|
425
425
|
except FileNotFoundError:
|
|
426
426
|
config_path.parent.mkdir(exist_ok=True, parents=True)
|
|
427
|
-
config_path.write_bytes(b"")
|
|
427
|
+
config_path.write_bytes(b"{}")
|
|
428
428
|
cfg.document
|
|
429
429
|
self._config_file = cfg
|
|
430
430
|
self._init_config()
|
|
@@ -433,10 +433,17 @@ class System:
|
|
|
433
433
|
c = self._config
|
|
434
434
|
modified = False
|
|
435
435
|
|
|
436
|
-
if
|
|
436
|
+
if c.get(k := "remote_repositories") is None:
|
|
437
437
|
c[k] = {}
|
|
438
438
|
modified = True
|
|
439
439
|
|
|
440
|
+
if c.get(k := "comment") is None:
|
|
441
|
+
c[k] = [
|
|
442
|
+
"Since JSON doesn't allow comments, you can place them inside the '#' key inside",
|
|
443
|
+
"most of the dictionaries.",
|
|
444
|
+
]
|
|
445
|
+
modified = True
|
|
446
|
+
|
|
440
447
|
if modified:
|
|
441
448
|
self._config_write(c)
|
|
442
449
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vocker
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Docker-like manager for virtualenvs
|
|
5
5
|
Author-email: Eduard Christian Dumitrescu <eduard.c.dumitrescu@gmail.com>
|
|
6
6
|
License: General Public License v3
|
|
@@ -18,7 +18,6 @@ Requires-Dist: platformdirs
|
|
|
18
18
|
Requires-Dist: sansio_tools>=1.0.0
|
|
19
19
|
Requires-Dist: sqlalchemy_boltons>=2.4.0
|
|
20
20
|
Requires-Dist: SQLAlchemy
|
|
21
|
-
Requires-Dist: strictyaml
|
|
22
21
|
Requires-Dist: structlog
|
|
23
22
|
Requires-Dist: cbor2
|
|
24
23
|
Provides-Extra: zstandard
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|