datamaestro 1.5.2__py3-none-any.whl → 1.6.1__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 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
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 pkg_resources.iter_entry_points("datamaestro.repositories"):
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
@@ -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 pkg_resources
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 pkg_resources.iter_entry_points("datamaestro.repositories"):
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 get_distribution(cls.__module__).version
360
- except DistributionNotFound:
368
+ return _version(cls.__module__)
369
+ except _PackageNotFoundError:
361
370
  return None
362
371
 
363
372
  def __repr__(self):
@@ -21,8 +21,6 @@ from typing import (
21
21
  _GenericAlias,
22
22
  )
23
23
  from experimaestro import ( # noqa: F401 (re-exports)
24
- argument,
25
- constant,
26
24
  Param,
27
25
  Option,
28
26
  Config,
@@ -183,8 +181,7 @@ class AbstractDataset(AbstractData):
183
181
  self.hooks[hookname].append(hook)
184
182
 
185
183
  @abstractmethod
186
- def _prepare(self) -> "Base":
187
- ...
184
+ def _prepare(self) -> "Base": ...
188
185
 
189
186
  def format(self, encoder: str) -> str:
190
187
  s = self.prepare()
datamaestro/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is auto-generated by Hatchling. As such, do not:
2
2
  # - modify
3
3
  # - track in version control e.g. be sure to add to .gitignore
4
- __version__ = VERSION = '1.5.2'
4
+ __version__ = VERSION = '1.6.1'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datamaestro
3
- Version: 1.5.2
3
+ Version: 1.6.1
4
4
  Summary: Add your description here
5
5
  Author-email: Benjamin Piwowarski <benjamin@piwowarski.fr>
6
6
  License-File: LICENSE
@@ -1,14 +1,14 @@
1
- datamaestro/__init__.py,sha256=WA9Jrikg-1GcQ6TRezV0qBAv7wQfsfRLdtBwzEWQE6Q,311
2
- datamaestro/__main__.py,sha256=2p36ZcJcZAL9NZBUkMaYRUhKyqhheVPXMGw6K1KNwhk,9196
3
- datamaestro/context.py,sha256=kVbChQy2Nr7Z0Jz9Qbz8AC-XCAIes50SIpROwez910k,13712
4
- datamaestro/definitions.py,sha256=-9rKgFxqn103HslqWLovq4EdoSkJmx9FNTKneLGBfTo,19812
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=byJyuh1AJ03zcaeEYOcbJQwjVI8cYJK2rrA_vAE8O1s,19776
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=nuWd41kVXDQdWyAwYcshPXgiAAgKAIVDM6QbgRkd4GE,171
11
+ datamaestro/version.py,sha256=IxaSAOS_6Bwc-3kPmW6mbhmmX7qOVHpf69gI0hfrfQs,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,8 +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.5.2.dist-info/METADATA,sha256=hHB6tXBNZjirZXG7II5ff3bovHhoig1I51JGIImnHkw,7635
44
- datamaestro-1.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
45
- datamaestro-1.5.2.dist-info/entry_points.txt,sha256=8qMhwSRvFG2iBqtJYVD22Zd4s4c3YkODtcp0Ajw1knw,133
46
- datamaestro-1.5.2.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
47
- datamaestro-1.5.2.dist-info/RECORD,,
43
+ datamaestro-1.6.1.dist-info/METADATA,sha256=T73NHl0zE2na-yxx4Bbtdn4Vm7kSx2yULu0TFG-mcAw,7635
44
+ datamaestro-1.6.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
45
+ datamaestro-1.6.1.dist-info/entry_points.txt,sha256=8qMhwSRvFG2iBqtJYVD22Zd4s4c3YkODtcp0Ajw1knw,133
46
+ datamaestro-1.6.1.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
47
+ datamaestro-1.6.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any