datamaestro 1.5.1__py3-none-any.whl → 1.6.0__py3-none-any.whl
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.
- datamaestro/__init__.py +1 -2
- datamaestro/__main__.py +2 -1
- datamaestro/context.py +32 -16
- datamaestro/definitions.py +3 -1
- datamaestro/version.py +4 -21
- {datamaestro-1.5.1.dist-info → datamaestro-1.6.0.dist-info}/METADATA +18 -48
- {datamaestro-1.5.1.dist-info → datamaestro-1.6.0.dist-info}/RECORD +10 -11
- {datamaestro-1.5.1.dist-info → datamaestro-1.6.0.dist-info}/WHEEL +1 -2
- datamaestro-1.5.1.dist-info/top_level.txt +0 -1
- {datamaestro-1.5.1.dist-info → datamaestro-1.6.0.dist-info}/entry_points.txt +0 -0
- {datamaestro-1.5.1.dist-info → datamaestro-1.6.0.dist-info}/licenses/LICENSE +0 -0
datamaestro/__init__.py
CHANGED
|
@@ -7,7 +7,6 @@ from .context import (
|
|
|
7
7
|
prepare_dataset,
|
|
8
8
|
)
|
|
9
9
|
|
|
10
|
-
from pkg_resources import get_distribution, DistributionNotFound
|
|
11
10
|
from .definitions import dataset, metadata
|
|
12
11
|
from .data import Base
|
|
13
|
-
from .version import
|
|
12
|
+
from .version import __version__
|
datamaestro/__main__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# flake8: noqa: T201
|
|
3
3
|
|
|
4
|
+
from importlib.metadata import entry_points
|
|
4
5
|
import sys
|
|
5
6
|
import logging
|
|
6
7
|
from functools import update_wrapper
|
|
@@ -38,7 +39,7 @@ def pass_cfg(f):
|
|
|
38
39
|
# Get all the available repositories
|
|
39
40
|
|
|
40
41
|
REPOSITORIES = {}
|
|
41
|
-
for entry_point in
|
|
42
|
+
for entry_point in entry_points(group="datamaestro.repositories"):
|
|
42
43
|
REPOSITORIES[entry_point.name] = entry_point
|
|
43
44
|
|
|
44
45
|
|
datamaestro/context.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import Iterable, Iterator, Dict, Union
|
|
2
|
+
from typing import Iterable, Iterator, Dict, Optional, Union
|
|
3
3
|
import importlib
|
|
4
4
|
import os
|
|
5
5
|
import hashlib
|
|
@@ -8,8 +8,7 @@ import inspect
|
|
|
8
8
|
import json
|
|
9
9
|
from abc import ABC, abstractmethod
|
|
10
10
|
from experimaestro import Config
|
|
11
|
-
import
|
|
12
|
-
from experimaestro.compat import cached_property
|
|
11
|
+
from functools import cached_property
|
|
13
12
|
from experimaestro.mkdocs.metaloader import Module
|
|
14
13
|
from .utils import CachedFile, downloadURL
|
|
15
14
|
from .settings import UserSettings, Settings
|
|
@@ -18,6 +17,22 @@ from typing import TYPE_CHECKING
|
|
|
18
17
|
if TYPE_CHECKING:
|
|
19
18
|
from datamaestro.definitions import AbstractDataset, DatasetWrapper
|
|
20
19
|
|
|
20
|
+
from importlib.metadata import (
|
|
21
|
+
entry_points as _entry_points,
|
|
22
|
+
version as _version,
|
|
23
|
+
PackageNotFoundError as _PackageNotFoundError,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def iter_entry_points(group, name=None):
|
|
28
|
+
"""Yield entry points for a given group (and optional name) using importlib.metadata."""
|
|
29
|
+
eps = _entry_points()
|
|
30
|
+
selected = eps.select(group=group)
|
|
31
|
+
if name:
|
|
32
|
+
selected = [ep for ep in selected if ep.name == name]
|
|
33
|
+
for ep in selected:
|
|
34
|
+
yield ep
|
|
35
|
+
|
|
21
36
|
|
|
22
37
|
class Compression:
|
|
23
38
|
@staticmethod
|
|
@@ -106,7 +121,7 @@ class Context:
|
|
|
106
121
|
|
|
107
122
|
def repositories(self) -> Iterable["Repository"]:
|
|
108
123
|
"""Returns an iterator over repositories"""
|
|
109
|
-
for entry_point in
|
|
124
|
+
for entry_point in iter_entry_points("datamaestro.repositories"):
|
|
110
125
|
yield entry_point.load().instance()
|
|
111
126
|
|
|
112
127
|
def repository(self, repositoryid):
|
|
@@ -114,10 +129,7 @@ class Context:
|
|
|
114
129
|
return None
|
|
115
130
|
|
|
116
131
|
entry_points = [
|
|
117
|
-
x
|
|
118
|
-
for x in pkg_resources.iter_entry_points(
|
|
119
|
-
"datamaestro.repositories", repositoryid
|
|
120
|
-
)
|
|
132
|
+
x for x in iter_entry_points("datamaestro.repositories", repositoryid)
|
|
121
133
|
]
|
|
122
134
|
if not entry_points:
|
|
123
135
|
raise Exception("No datasets repository named %s", repositoryid)
|
|
@@ -299,8 +311,7 @@ class BaseRepository(ABC):
|
|
|
299
311
|
self.basedir = Path(p).parent
|
|
300
312
|
|
|
301
313
|
@abstractmethod
|
|
302
|
-
def __iter__(self) -> Iterator["AbstractDataset"]:
|
|
303
|
-
...
|
|
314
|
+
def __iter__(self) -> Iterator["AbstractDataset"]: ...
|
|
304
315
|
|
|
305
316
|
def search(self, name: str):
|
|
306
317
|
"""Search for a dataset in the definitions"""
|
|
@@ -353,11 +364,9 @@ class Repository(BaseRepository):
|
|
|
353
364
|
|
|
354
365
|
@classmethod
|
|
355
366
|
def version(cls):
|
|
356
|
-
from pkg_resources import get_distribution, DistributionNotFound
|
|
357
|
-
|
|
358
367
|
try:
|
|
359
|
-
return
|
|
360
|
-
except
|
|
368
|
+
return _version(cls.__module__)
|
|
369
|
+
except _PackageNotFoundError:
|
|
361
370
|
return None
|
|
362
371
|
|
|
363
372
|
def __repr__(self):
|
|
@@ -423,16 +432,23 @@ def find_dataset(dataset_id: str):
|
|
|
423
432
|
return AbstractDataset.find(dataset_id)
|
|
424
433
|
|
|
425
434
|
|
|
426
|
-
def prepare_dataset(
|
|
435
|
+
def prepare_dataset(
|
|
436
|
+
dataset_id: Union[str, "DatasetWrapper", Config],
|
|
437
|
+
context: Optional[Union[Context, Path]] = None,
|
|
438
|
+
):
|
|
427
439
|
"""Find a dataset given its id and download the resources"""
|
|
428
440
|
from .definitions import AbstractDataset, DatasetWrapper
|
|
429
441
|
|
|
442
|
+
match context:
|
|
443
|
+
case Path() | str():
|
|
444
|
+
context = Context(Path(context))
|
|
445
|
+
|
|
430
446
|
if isinstance(dataset_id, DatasetWrapper):
|
|
431
447
|
ds = dataset_id
|
|
432
448
|
elif isinstance(dataset_id, Config):
|
|
433
449
|
ds = dataset_id.__datamaestro_dataset__
|
|
434
450
|
else:
|
|
435
|
-
ds = AbstractDataset.find(dataset_id)
|
|
451
|
+
ds = AbstractDataset.find(dataset_id, context=context)
|
|
436
452
|
|
|
437
453
|
return ds.prepare(download=True)
|
|
438
454
|
|
datamaestro/definitions.py
CHANGED
|
@@ -236,10 +236,12 @@ class AbstractDataset(AbstractData):
|
|
|
236
236
|
return success
|
|
237
237
|
|
|
238
238
|
@staticmethod
|
|
239
|
-
def find(name: str) -> "DataDefinition":
|
|
239
|
+
def find(name: str, context: Optional["Context"] = None) -> "DataDefinition":
|
|
240
240
|
"""Find a dataset given its name"""
|
|
241
241
|
from datamaestro.context import Context # noqa: F811
|
|
242
242
|
|
|
243
|
+
context = Context.instance() if context is None else context
|
|
244
|
+
|
|
243
245
|
logging.debug("Searching dataset %s", name)
|
|
244
246
|
for repository in Context.instance().repositories():
|
|
245
247
|
logging.debug("Searching dataset %s in %s", name, repository)
|
datamaestro/version.py
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
# file generated by
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
TYPE_CHECKING = False
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from typing import Tuple
|
|
9
|
-
from typing import Union
|
|
10
|
-
|
|
11
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
-
else:
|
|
13
|
-
VERSION_TUPLE = object
|
|
14
|
-
|
|
15
|
-
version: str
|
|
16
|
-
__version__: str
|
|
17
|
-
__version_tuple__: VERSION_TUPLE
|
|
18
|
-
version_tuple: VERSION_TUPLE
|
|
19
|
-
|
|
20
|
-
__version__ = version = '1.5.1'
|
|
21
|
-
__version_tuple__ = version_tuple = (1, 5, 1)
|
|
1
|
+
# This file is auto-generated by Hatchling. As such, do not:
|
|
2
|
+
# - modify
|
|
3
|
+
# - track in version control e.g. be sure to add to .gitignore
|
|
4
|
+
__version__ = VERSION = '1.6.0'
|
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datamaestro
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: benjamin@piwowarski.fr
|
|
8
|
-
License: GPL-3
|
|
9
|
-
Keywords: dataset manager
|
|
10
|
-
Platform: any
|
|
3
|
+
Version: 1.6.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: Benjamin Piwowarski <benjamin@piwowarski.fr>
|
|
6
|
+
License-File: LICENSE
|
|
11
7
|
Classifier: Development Status :: 4 - Beta
|
|
12
8
|
Classifier: Intended Audience :: Science/Research
|
|
13
9
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
10
|
Classifier: Operating System :: OS Independent
|
|
15
11
|
Classifier: Programming Language :: Python
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
13
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Requires-Dist: click
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist: urllib3
|
|
26
|
-
Requires-Dist: marshmallow
|
|
27
|
-
Requires-Dist: cached_property
|
|
28
|
-
Requires-Dist: requests
|
|
29
|
-
Requires-Dist: bitmath
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: bitmath>=1.3.3.1
|
|
16
|
+
Requires-Dist: cached-property>=2.0.1
|
|
17
|
+
Requires-Dist: click>=8.2.1
|
|
18
|
+
Requires-Dist: docstring-parser>=0.16
|
|
30
19
|
Requires-Dist: experimaestro>=1.8.9
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist: mkdocs
|
|
34
|
-
Requires-Dist: docstring_parser
|
|
20
|
+
Requires-Dist: marshmallow>=3.26.1
|
|
21
|
+
Requires-Dist: mkdocs-material>=9.6.15
|
|
22
|
+
Requires-Dist: mkdocs>=1.6.1
|
|
35
23
|
Requires-Dist: numpy
|
|
36
|
-
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
Requires-Dist: pymdown-extensions>=10.16
|
|
25
|
+
Requires-Dist: requests>=2.32.4
|
|
26
|
+
Requires-Dist: tqdm>=4.67.1
|
|
27
|
+
Requires-Dist: urllib3>=2.5.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
40
29
|
|
|
41
30
|
[](https://badge.fury.io/py/datamaestro) [](https://github.com/pre-commit/pre-commit) [](https://zenodo.org/badge/latestdoi/4573876)
|
|
42
31
|
|
|
@@ -192,22 +181,3 @@ This will allow to
|
|
|
192
181
|
|
|
193
182
|
1. Document the dataset
|
|
194
183
|
2. Allow to use the command line interface to manipulate it (download resources, etc.)
|
|
195
|
-
|
|
196
|
-
# 0.8.0
|
|
197
|
-
|
|
198
|
-
- Integration with other repositories: abstracting away the notion of dataset
|
|
199
|
-
- Repository prefix
|
|
200
|
-
- Set sub-datasets IDs automatically
|
|
201
|
-
|
|
202
|
-
# 0.7.3
|
|
203
|
-
|
|
204
|
-
- Updates for new experimaestro (0.8.5)
|
|
205
|
-
- Search types with "type:..."
|
|
206
|
-
|
|
207
|
-
# 0.6.17
|
|
208
|
-
|
|
209
|
-
- Allow remote access through rpyc
|
|
210
|
-
|
|
211
|
-
# 0.6.9
|
|
212
|
-
|
|
213
|
-
`version` command
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
datamaestro/__init__.py,sha256=
|
|
2
|
-
datamaestro/__main__.py,sha256=
|
|
3
|
-
datamaestro/context.py,sha256=
|
|
4
|
-
datamaestro/definitions.py,sha256
|
|
1
|
+
datamaestro/__init__.py,sha256=oh9M4VODuvTc9EFHKirtDxpCJkLUANzpzBOIwzHc_mw,246
|
|
2
|
+
datamaestro/__main__.py,sha256=esbe4LcRA9SrRdBzMnJ02R7LvY3KeK_UqlkXbboHhxc,9227
|
|
3
|
+
datamaestro/context.py,sha256=AL2BTi6dLA8rDGBE0PFyfV9ua29JHvBgx6_w6hDj9Dg,13977
|
|
4
|
+
datamaestro/definitions.py,sha256=-9rKgFxqn103HslqWLovq4EdoSkJmx9FNTKneLGBfTo,19812
|
|
5
5
|
datamaestro/record.py,sha256=IxxcrSIf99iluohtpnuMBTFkqeHRe5S-T_hWEqBgeME,5812
|
|
6
6
|
datamaestro/registry.py,sha256=M7QJkcWJP_cxAoqIioLQ01ou2Zg9RqGQvW0XGVspYFE,1421
|
|
7
7
|
datamaestro/search.py,sha256=bRT-91-2VJJ2JSfNaS1mzaVfqq_HMVBVs-RBj0w-ypM,2906
|
|
8
8
|
datamaestro/settings.py,sha256=HYSElTUYZ6DZocBb9o3ifm6WW9knRO64XJUwxGIpvwQ,1304
|
|
9
9
|
datamaestro/sphinx.py,sha256=bp7x_2BFoTSwTqcVZDM8R8cWa7G2pz0Zb8GS054lLYM,6996
|
|
10
10
|
datamaestro/utils.py,sha256=9m-AVVww6InAZfGFiGy6XJzfExpYNqH1fhWQEezjafA,6536
|
|
11
|
-
datamaestro/version.py,sha256=
|
|
11
|
+
datamaestro/version.py,sha256=lfHpvMHdtMD7zPueNTzYopOoKdIsSEJoCUS3amAUa5g,171
|
|
12
12
|
datamaestro/annotations/__init__.py,sha256=jLprrxSBa5QIqc--vqycEcxU4CR9WjVNRaqR5lH0EuE,39
|
|
13
13
|
datamaestro/annotations/agreement.py,sha256=xEH0ddZxdJ_oG_150PoOa-WjY_OaeQja3FzMzY5IB6k,955
|
|
14
14
|
datamaestro/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -40,9 +40,8 @@ datamaestro/test/conftest.py,sha256=it4S5Qq1CA_U8qM0pr4m7v-1dhLj5Y49WjVg5Ee3mpM,
|
|
|
40
40
|
datamaestro/test/test_annotations.py,sha256=XUjDWb3FJimSD91wcItJ0lLwTBmvN4wVu_EgTKSvV2c,278
|
|
41
41
|
datamaestro/test/test_download_handlers.py,sha256=-Gofr89zqIyeI8C4rZqfYR3JfiZVImdcSz9s6q361zQ,641
|
|
42
42
|
datamaestro/test/test_record.py,sha256=hNZ3uo2i5FZ0VsOHRwvLO1Z6Zce92PdipAF65UptPB8,1156
|
|
43
|
-
datamaestro-1.
|
|
44
|
-
datamaestro-1.
|
|
45
|
-
datamaestro-1.
|
|
46
|
-
datamaestro-1.
|
|
47
|
-
datamaestro-1.
|
|
48
|
-
datamaestro-1.5.1.dist-info/RECORD,,
|
|
43
|
+
datamaestro-1.6.0.dist-info/METADATA,sha256=RmJeWy1yUhVfI5_S6Z85Z5rrMcdM6oZMjybvyalE284,7635
|
|
44
|
+
datamaestro-1.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
45
|
+
datamaestro-1.6.0.dist-info/entry_points.txt,sha256=8qMhwSRvFG2iBqtJYVD22Zd4s4c3YkODtcp0Ajw1knw,133
|
|
46
|
+
datamaestro-1.6.0.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
47
|
+
datamaestro-1.6.0.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
datamaestro
|
|
File without changes
|
|
File without changes
|