ialdev-core 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.
Files changed (90) hide show
  1. ialdev_core-0.2.0/PKG-INFO +91 -0
  2. ialdev_core-0.2.0/README.md +48 -0
  3. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/pyproject.toml +7 -8
  4. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/cache.py +1 -1
  5. ialdev_core-0.2.0/src/iad/core/data/__init__.py +1 -0
  6. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/array.py +3 -3
  7. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/label.py +2 -2
  8. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/pdtools.py +6 -6
  9. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/events.py +5 -4
  10. ialdev_core-0.2.0/src/iad/core/fs/__init__.py +3 -0
  11. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/fs}/env.py +4 -4
  12. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/fs}/filesproc.py +12 -7
  13. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/fs}/paths.py +3 -3
  14. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/logs.py +1 -1
  15. ialdev_core-0.2.0/src/iad/core/param/__init__.py +1 -0
  16. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/param/confargparse.py +1 -1
  17. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/param/paramaze.py +1 -1
  18. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/strings.py +2 -2
  19. {ialdev_core-0.1.0/src/iad/core/param → ialdev_core-0.2.0/src/iad/core}/tbox.py +4 -4
  20. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/wrap.py +1 -1
  21. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/conftest.py +2 -2
  22. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_array.py +2 -2
  23. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_binar.py +1 -1
  24. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_filesproc.py +1 -1
  25. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_nptools.py +1 -1
  26. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_paths.py +1 -1
  27. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_pdtools.py +3 -3
  28. {ialdev_core-0.1.0/tests/param → ialdev_core-0.2.0/tests}/test_tbox.py +1 -1
  29. ialdev_core-0.1.0/PKG-INFO +0 -73
  30. ialdev_core-0.1.0/README.md +0 -29
  31. ialdev_core-0.1.0/src/iad/core/dotstyle.py +0 -99
  32. ialdev_core-0.1.0/src/iad/core/param/__init__.py +0 -17
  33. ialdev_core-0.1.0/src/iad/core/pydantools/__init__.py +0 -5
  34. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/__init__.py +0 -32
  35. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/__init__.py +0 -0
  36. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/hacks.py +0 -76
  37. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/old_enums.py +0 -37
  38. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/representers.py +0 -92
  39. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/types.py +0 -122
  40. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/yaml_lib.py +0 -104
  41. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/ext/__init__.py +0 -1
  42. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/ext/semver.py +0 -152
  43. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/ext/versioned_model.py +0 -113
  44. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/main.py +0 -30
  45. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/mixin.py +0 -281
  46. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/model.py +0 -20
  47. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/py.typed +0 -1
  48. ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/version.py +0 -1
  49. ialdev_core-0.1.0/src/iad/core/pydantools/models.py +0 -560
  50. ialdev_core-0.1.0/tests/param/__init__.py +0 -0
  51. ialdev_core-0.1.0/tests/param/data/dump.json +0 -1
  52. ialdev_core-0.1.0/tests/param/data/dump.yaml +0 -4
  53. ialdev_core-0.1.0/tests/param/data/example_yaml.yml +0 -41
  54. ialdev_core-0.1.0/tests/param/test_param.py +0 -99
  55. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/__init__.py +0 -1
  56. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/recursive.yaml +0 -5
  57. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_advanced_yaml.py +0 -40
  58. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_basic.py +0 -67
  59. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_io.py +0 -52
  60. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_resursive.py +0 -27
  61. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_secret_types.py +0 -60
  62. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_sorting.py +0 -17
  63. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_types.py +0 -71
  64. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_versioned.py +0 -72
  65. ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/versioned.yaml +0 -2
  66. ialdev_core-0.1.0/tests/test_dotstyle.py +0 -268
  67. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/.gitignore +0 -0
  68. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/.pixi/config.toml +0 -0
  69. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/__init__.py +0 -0
  70. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/codetools.py +0 -0
  71. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/binary.py +0 -0
  72. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/nptools.py +0 -0
  73. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/unc_panda.py +0 -0
  74. {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.0/src/iad/core/data}/units.py +0 -0
  75. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/datatools.py +0 -0
  76. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/docs/locators.ipynb +0 -0
  77. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/fnctools.py +0 -0
  78. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/one_dark.puml +0 -0
  79. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/regexp.py +0 -0
  80. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/src/iad/core/short.py +0 -0
  81. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/array.ipynb +0 -0
  82. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/data/.env +0 -0
  83. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/dot_styles_examples.ipynb +0 -0
  84. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_cachepipe.py +0 -0
  85. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_codetools.py +0 -0
  86. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_coltools.py +0 -0
  87. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_datatools.py +0 -0
  88. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_events.py +0 -0
  89. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_regexp.py +0 -0
  90. {ialdev_core-0.1.0 → ialdev_core-0.2.0}/tests/test_shorts.py +0 -0
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: ialdev-core
3
+ Version: 0.2.0
4
+ Summary: iad.core — algorithmic utilities: data tools, parameters, paths, caching, and more
5
+ Author: ipcoder
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Dist: pydantic>=2.0
18
+ Requires-Dist: pandas>=2.1.0
19
+ Requires-Dist: numpy>=2.0
20
+ Requires-Dist: pyyaml>=5.4.0
21
+ Requires-Dist: ruamel.yaml>=0.15.0
22
+ Requires-Dist: regex>=2021.0.0
23
+ Requires-Dist: rapidfuzz>=3.0
24
+ Requires-Dist: tqdm>=4.60.0
25
+ Requires-Dist: frozendict>=2.0.0
26
+ Requires-Dist: python-box>=6.0.0
27
+ Requires-Dist: joblib>=1.0.0
28
+ Requires-Dist: configargparse>=1.0.0
29
+ Requires-Dist: deprecated>=1.2.0
30
+ Requires-Dist: semver>=2.13.0
31
+ Requires-Dist: uncertainties>=3.1.0
32
+ Requires-Dist: pint>=0.20.0
33
+ Requires-Dist: zfpy
34
+ Requires-Dist: xxhash>=3.0.0
35
+ Requires-Dist: toolz>=0.11.0
36
+ Requires-Dist: numba>=0.55.0
37
+ Requires-Dist: scikit-learn>=1.0.0
38
+ Requires-Dist: python-dotenv>=0.19.0
39
+ Project-URL: Homepage, https://github.com/ipcoder/ialdev/tree/master/algutils
40
+ Project-URL: Issues, https://github.com/ipcoder/ialdev/issues
41
+ Project-URL: Repository, https://github.com/ipcoder/ialdev
42
+
43
+ # ialdev-core
44
+
45
+ Core utilities for the `iad` toolbox, published as `ialdev-core` and imported as `iad.core`.
46
+
47
+ Use this package when you need the shared building blocks used by the other `ialdev-*` libraries: collection helpers, typed dictionaries, path transformations, file discovery, caching, logging, event timing, decorators, and NumPy/Pandas utility functions.
48
+
49
+ ## Install
50
+
51
+ ```bash
52
+ pip install ialdev-core
53
+ ```
54
+
55
+ Requires Python `>=3.10`, NumPy `>=2.0`, and pandas `>=2.1.0`.
56
+
57
+ ## Highlights
58
+
59
+ - `iad.core.short`: scalar/list normalization and keyword filtering (`as_list`, `as_iter`, `drop_undef`).
60
+ - `iad.core.tbox`: `TBox`, a convenience wrapper around `python-box`.
61
+ - `iad.core.fs`: path normalization, file discovery, locators, and transformable path templates.
62
+ - `iad.core.cache`: pickle-based caches and cached processing pipes.
63
+ - `iad.core.data`: NumPy/Pandas helpers, labels, units, binary packing, and table utilities.
64
+ - `iad.core.events`: timers, progress helpers, and joblib/tqdm integration.
65
+
66
+ ## Examples
67
+
68
+ ```python
69
+ from iad.core import as_list, drop_undef
70
+ from iad.core.tbox import TBox
71
+
72
+ names = as_list("sample")
73
+ config = TBox(drop_undef(root="/data", cache=None, batch=8))
74
+ ```
75
+
76
+ ```python
77
+ from iad.core.fs.filesproc import Locator
78
+ from iad.core.fs.paths import TransPath
79
+
80
+ locator = Locator("/data/project")
81
+ path_template = TransPath("{scene}/{frame}.png")
82
+ ```
83
+
84
+ ## Development
85
+
86
+ ```bash
87
+ pip install -e .
88
+ pixi run test
89
+ pixi run lint
90
+ ```
91
+
@@ -0,0 +1,48 @@
1
+ # ialdev-core
2
+
3
+ Core utilities for the `iad` toolbox, published as `ialdev-core` and imported as `iad.core`.
4
+
5
+ Use this package when you need the shared building blocks used by the other `ialdev-*` libraries: collection helpers, typed dictionaries, path transformations, file discovery, caching, logging, event timing, decorators, and NumPy/Pandas utility functions.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install ialdev-core
11
+ ```
12
+
13
+ Requires Python `>=3.10`, NumPy `>=2.0`, and pandas `>=2.1.0`.
14
+
15
+ ## Highlights
16
+
17
+ - `iad.core.short`: scalar/list normalization and keyword filtering (`as_list`, `as_iter`, `drop_undef`).
18
+ - `iad.core.tbox`: `TBox`, a convenience wrapper around `python-box`.
19
+ - `iad.core.fs`: path normalization, file discovery, locators, and transformable path templates.
20
+ - `iad.core.cache`: pickle-based caches and cached processing pipes.
21
+ - `iad.core.data`: NumPy/Pandas helpers, labels, units, binary packing, and table utilities.
22
+ - `iad.core.events`: timers, progress helpers, and joblib/tqdm integration.
23
+
24
+ ## Examples
25
+
26
+ ```python
27
+ from iad.core import as_list, drop_undef
28
+ from iad.core.tbox import TBox
29
+
30
+ names = as_list("sample")
31
+ config = TBox(drop_undef(root="/data", cache=None, batch=8))
32
+ ```
33
+
34
+ ```python
35
+ from iad.core.fs.filesproc import Locator
36
+ from iad.core.fs.paths import TransPath
37
+
38
+ locator = Locator("/data/project")
39
+ path_template = TransPath("{scene}/{frame}.png")
40
+ ```
41
+
42
+ ## Development
43
+
44
+ ```bash
45
+ pip install -e .
46
+ pixi run test
47
+ pixi run lint
48
+ ```
@@ -4,13 +4,13 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "ialdev-core"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "iad.core — algorithmic utilities: data tools, parameters, paths, caching, and more"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = {text = "MIT"}
12
12
  authors = [
13
- {name = "Your Name", email = "your.email@example.com"}
13
+ {name = "ipcoder"}
14
14
  ]
15
15
  classifiers = [
16
16
  "Development Status :: 4 - Beta",
@@ -25,10 +25,9 @@ classifiers = [
25
25
  ]
26
26
 
27
27
  dependencies = [
28
- "ialdev-io",
29
28
  "pydantic>=2.0",
30
- "pandas>=1.3.0",
31
- "numpy>=1.20.0",
29
+ "pandas>=2.1.0",
30
+ "numpy>=2.0",
32
31
  "pyyaml>=5.4.0",
33
32
  "ruamel.yaml>=0.15.0",
34
33
  "regex>=2021.0.0",
@@ -51,9 +50,9 @@ dependencies = [
51
50
  ]
52
51
 
53
52
  [project.urls]
54
- Homepage = "https://github.com/yourusername/toolbox"
55
- Repository = "https://github.com/yourusername/toolbox"
56
- Issues = "https://github.com/yourusername/toolbox/issues"
53
+ Homepage = "https://github.com/ipcoder/ialdev/tree/master/algutils"
54
+ Repository = "https://github.com/ipcoder/ialdev"
55
+ Issues = "https://github.com/ipcoder/ialdev/issues"
57
56
 
58
57
  # Distribution name (ialdev-core) ≠ import name (iad.core)
59
58
  [tool.flit.module]
@@ -12,7 +12,7 @@ from tqdm import tqdm
12
12
  from . import logs
13
13
  from . import logger
14
14
  from .events import Timer
15
- from .filesproc import Locator
15
+ from .fs import Locator
16
16
  from .strings import hash_str
17
17
 
18
18
  _log = logger('caching')
@@ -0,0 +1 @@
1
+ """Numeric, pandas, labeled-data, units, and binary helpers."""
@@ -11,10 +11,10 @@ import numpy as np
11
11
  import numba
12
12
  from numbers import Number
13
13
 
14
- from .codetools import NamedObj
15
- from . import as_list
14
+ from ..codetools import NamedObj
15
+ from .. import as_list
16
16
  from . import nptools as npt
17
- from .datatools import rm_keys
17
+ from ..datatools import rm_keys
18
18
 
19
19
  __all__ = ['DForm', 'Array', 'FormArray', 'form_array', 'Color', '_wC2G']
20
20
 
@@ -7,9 +7,9 @@ from typing import Dict, Sequence, Any, Collection, NamedTuple, Iterable
7
7
 
8
8
  import pandas as pd
9
9
 
10
- from . import as_list
10
+ from .. import as_list
11
11
  from .nptools import Array
12
- from .strings import compact_repr
12
+ from ..strings import compact_repr
13
13
 
14
14
 
15
15
  class Keys(pd.core.indexes.frozen.FrozenList): # TODO: Merge Keys into Labeled?
@@ -19,10 +19,10 @@ import pandas as pd
19
19
  from IPython import display as ipy_disp
20
20
  from pandas.core.dtypes.common import is_list_like
21
21
 
22
- from . import strings as stt, codetools as cdt, nptools as npt
23
- from . import wrap
24
- from .datatools import select_from, issubset_report
25
- from .short import as_list, unless_subset
22
+ from .. import strings as stt, codetools as cdt, wrap
23
+ from . import nptools as npt
24
+ from ..datatools import select_from, issubset_report
25
+ from ..short import as_list, unless_subset
26
26
 
27
27
  # https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
28
28
  # Copy-on-Write will become the new default in pandas 3.0. This means than chained indexing will never work.
@@ -185,7 +185,7 @@ class Parallel:
185
185
  :return: resulted table (same class as df)
186
186
  """
187
187
  import joblib as jb
188
- from .events import tqdm_joblib
188
+ from ..events import tqdm_joblib
189
189
 
190
190
  par = self.jobs if isinstance(self.jobs, dict) else dict(
191
191
  backend='loky',
@@ -2004,7 +2004,7 @@ def path_fixer(root, fixer_name, cols='path') -> Callable[[pd.DataFrame], pd.Dat
2004
2004
 
2005
2005
  cols = set(as_list(cols))
2006
2006
 
2007
- from . import filesproc as proc
2007
+ from ..fs import filesproc as proc
2008
2008
  fixer = {
2009
2009
  'add': proc.root_adder,
2010
2010
  'crop': proc.root_cropper
@@ -605,7 +605,7 @@ class Dump(dict):
605
605
  self.configure()
606
606
 
607
607
  def configure(self, new_config=None):
608
- from .paths import TransPath
608
+ from .fs.paths import TransPath
609
609
  # TODO add
610
610
  # 1) support to selective config along the tree
611
611
  # 2) clearer way to configure
@@ -620,7 +620,6 @@ class Dump(dict):
620
620
 
621
621
  def __call__(self, data=None, labels: dict = None, **kwargs):
622
622
  import os
623
- from iad.io import imsave
624
623
 
625
624
  if not self.active or data is None:
626
625
  return self.labels
@@ -640,8 +639,10 @@ class Dump(dict):
640
639
  if os.path.isfile(path) and not self.config.exist_ok:
641
640
  raise FileExistsError(f"File {path} already exists")
642
641
  path.parent.mkdir(mode=0o777, parents=True, exist_ok=True)
643
- # TODO add support for other file types
644
- imsave(path, data)
642
+ writer = getattr(self.config, 'writer', None)
643
+ if writer is None:
644
+ raise RuntimeError("Dump requires config.writer callable to save data")
645
+ writer(path, data)
645
646
 
646
647
  def fork(self, other: dict):
647
648
  return Dump(config=self.config, root=self.root, labels=other | self.labels, scheme=self.scheme)
@@ -0,0 +1,3 @@
1
+ """Filesystem paths, path templates, and environment/locator helpers."""
2
+
3
+ from .filesproc import Locator
@@ -3,7 +3,7 @@ import os
3
3
  from pathlib import Path
4
4
  import dotenv
5
5
 
6
- from iad.core.filesproc import Locator
6
+ from .filesproc import Locator
7
7
 
8
8
  env_log = logging.getLogger('env')
9
9
 
@@ -172,7 +172,7 @@ class EnvLoc:
172
172
 
173
173
  @classmethod
174
174
  def _process_dotenv(cls, env_file, override=None):
175
- from iad.core.filesproc import represents_path, normalize
175
+ from .filesproc import represents_path, normalize
176
176
 
177
177
  def same_value(v1, v2):
178
178
  """Return true if two values are the same.
@@ -234,10 +234,10 @@ class EnvLoc:
234
234
  if not Path(env_path).is_file():
235
235
  if not fail: return None
236
236
  raise FileNotFoundError(f'Not found dotenv defined in {ENV_FILE_VAR}="{env_path}"')
237
- env_log.debug(f'dotenv set by the environmnet variable {ENV_FILE_VAR}={env_path}')
237
+ env_log.debug(f'dotenv set by the environment variable {ENV_FILE_VAR}={env_path}')
238
238
  elif not (env_path := dotenv.find_dotenv(usecwd=True)): # try first search from the current dir
239
239
  msg = f'Getting default .env after not found at CDW: {os.getcwd()}'
240
- env_log.error(msg)
240
+ env_log.debug(msg)
241
241
  if not fail: return None
242
242
  raise FileNotFoundError(msg)
243
243
  return env_path
@@ -2,16 +2,16 @@
2
2
  """
3
3
  from __future__ import annotations
4
4
 
5
+ import logging
5
6
  import os
6
7
  import re
7
8
  import sys
8
9
  from pathlib import Path
9
10
  from typing import List, Tuple, Union, Iterable, Callable, Literal, Type, Any, Generator
10
11
 
11
- from .datatools import unique as unique_filter
12
- from .short import as_iter
13
- from .events import timed, Timer
14
- import logging
12
+ from ..datatools import unique as unique_filter
13
+ from ..events import Timer
14
+ from ..short import as_iter
15
15
 
16
16
  PathT = Union[Path, str]
17
17
  UNDEF = object()
@@ -129,9 +129,14 @@ def compress_numpy_file(file, clean=True):
129
129
  :param clean: remove the sources
130
130
  """
131
131
  import numpy as np
132
- from iad.io.imread import imread
133
132
  file = Path(file)
134
- np.savez_compressed(file.with_suffix('.npz'), **imread(file, out=dict))
133
+ loaded = np.load(file, allow_pickle=True)
134
+ if isinstance(loaded, np.lib.npyio.NpzFile):
135
+ with loaded:
136
+ payload = {key: loaded[key] for key in loaded.files}
137
+ else:
138
+ payload = {file.stem: loaded}
139
+ np.savez_compressed(file.with_suffix('.npz'), **payload)
135
140
  if clean:
136
141
  os.remove(file)
137
142
 
@@ -810,7 +815,7 @@ def glob_folders(folders, file_pattern) -> Iterable[str]:
810
815
  :param file_pattern: glob pattern for path under the folder
811
816
  :return: Iterator over the files found
812
817
  """
813
- from . import as_list
818
+ from .. import as_list
814
819
  from more_itertools import collapse
815
820
 
816
821
  return list(collapse(
@@ -5,7 +5,7 @@ from typing import Any, Callable, Literal, Sequence
5
5
 
6
6
  import regex as re
7
7
 
8
- from .regexp import format_to_regex, regex_to_format, is_regex, partition
8
+ from ..regexp import format_to_regex, regex_to_format, is_regex, partition
9
9
 
10
10
 
11
11
  def ng(name=None, exp=None, /, **kw):
@@ -329,7 +329,7 @@ class Form:
329
329
 
330
330
  def _repr_parts_tree(self, indent=' ' * 4, head='Form:\n'):
331
331
  """String representing parsed tree of parts"""
332
- from .strings import indent_lines
332
+ from ..strings import indent_lines
333
333
 
334
334
  return head + '\n'.join(indent_lines(
335
335
  p._repr_parts_tree(indent=indent, head=head) if isinstance(p, Form) else p
@@ -516,7 +516,7 @@ class TransPath:
516
516
  if no_tag and not self.has_unnamed:
517
517
  raise ValueError("Unnamed tag is not defined but requested!")
518
518
  if no_tag is True:
519
- from .datatools import split_dict
519
+ from ..datatools import split_dict
520
520
  labels, no_tag = split_dict(labels, lambda k, v: k in self.expected_tags)
521
521
  no_tag = no_tag or None
522
522
  if no_tag:
@@ -40,7 +40,7 @@ def _add_levels_attrs(obj: T) -> T:
40
40
 
41
41
  def module_log_file(file: str | Path):
42
42
  """Constructs default log file name from module file"""
43
- from .filesproc import Locator
43
+ from .fs import Locator
44
44
  out_folder = Locator('/tmp/ramdisk', '/tmp', envar='TEMP').first_existing()
45
45
  if not out_folder:
46
46
  from tempfile import mkdtemp
@@ -0,0 +1 @@
1
+ """Parameter definitions, CLI/YAML config parsing, and related helpers."""
@@ -35,7 +35,7 @@ class ArgumentParserYAML(cap.ArgumentParser):
35
35
 
36
36
  :return: dict {grp_name: hash_str}
37
37
  """
38
- from .tbox import TBox
38
+ from ..tbox import TBox
39
39
  groups = self.hash_groups or {'cfg': [*vars(ns)]}
40
40
  ns = vars(ns)
41
41
 
@@ -4,7 +4,7 @@ from enum import IntEnum, unique
4
4
  from typing import Union, Callable, Optional, Dict, Sequence
5
5
 
6
6
  from .. import as_list, fnctools as fnt, wrap
7
- from .tbox import TBox
7
+ from ..tbox import TBox
8
8
 
9
9
  Rule = Union[Callable, str, None]
10
10
 
@@ -201,8 +201,8 @@ def compact_repr(v, max_len=60) -> str:
201
201
  :param max_len: maximal length of the resulting string
202
202
  :return: str
203
203
  """
204
- from .units import Quantity
205
- from .nptools import array_info_str, np
204
+ from .data.units import Quantity
205
+ from .data.nptools import array_info_str, np
206
206
  import pandas as pd
207
207
 
208
208
  def crop(s, mx):
@@ -6,9 +6,9 @@ import pandas as pd
6
6
  import pydantic.v1 as pydantic
7
7
  from box import Box
8
8
 
9
- from ..datatools import complete_missing, UndefCond, UndefTypes
10
- from ..strings import compact_repr, hash_str
11
- from ..wrap import name_tuple
9
+ from .datatools import complete_missing, UndefCond, UndefTypes
10
+ from .strings import compact_repr, hash_str
11
+ from .wrap import name_tuple
12
12
 
13
13
  __all__ = ['TBox', 'UndefCond']
14
14
 
@@ -151,7 +151,7 @@ class TBox(Box):
151
151
 
152
152
  def to_yaml(self, filename=None, *, default_flow_style=False,
153
153
  encoding="utf-8", errors="strict", **yaml_kwargs):
154
- from ..filesproc import prepare_parent_folder, Path
154
+ from .fs import prepare_parent_folder, Path
155
155
 
156
156
  par = self.copy() # type: TBox
157
157
  for k, v in par.items(True):
@@ -150,7 +150,7 @@ class NamedTupleI:
150
150
  ::
151
151
  isinstance(type(obj), NamedTupleMeta)
152
152
  """
153
- from .nptools import array_info_str
153
+ from .data.nptools import array_info_str
154
154
 
155
155
  _fields: list[str]
156
156
  __iter__: Callable
@@ -15,8 +15,8 @@ def multi_label_data_table():
15
15
 
16
16
  """
17
17
  import numpy as np
18
- from iad.core.pdtools import DataTable, pd
19
- from iad.core.label import Keys
18
+ from iad.core.data.pdtools import DataTable, pd
19
+ from iad.core.data.label import Keys
20
20
 
21
21
  shape = (10, 10)
22
22
  imL, imR = (np.ones(shape) * 1, np.ones(shape) * 2)
@@ -1,5 +1,5 @@
1
- from iad.core.array import *
2
- from iad.core.array import _wC2G
1
+ from iad.core.data.array import *
2
+ from iad.core.data.array import _wC2G
3
3
  import pytest
4
4
  import numpy as np
5
5
 
@@ -1,4 +1,4 @@
1
- from iad.core.binary import *
1
+ from iad.core.data.binary import *
2
2
 
3
3
 
4
4
  def test_set_bits():
@@ -1,6 +1,6 @@
1
1
  import pytest
2
2
 
3
- from iad.core.filesproc import Locator, Path
3
+ from iad.core.fs.filesproc import Locator, Path
4
4
 
5
5
 
6
6
  def test_locator(tmp_path):
@@ -1,6 +1,6 @@
1
1
  import numpy as np
2
2
 
3
- from iad.core.nptools import *
3
+ from iad.core.data.nptools import *
4
4
 
5
5
 
6
6
  def test_xy2idx():
@@ -22,7 +22,7 @@ pat = r"""
22
22
 
23
23
  @pytest.fixture(scope='module')
24
24
  def trans_path():
25
- from iad.core.paths import TransPath
25
+ from iad.core.fs.paths import TransPath
26
26
  tp = TransPath(pat)
27
27
  print(tp.regex.regex.pattern)
28
28
  return tp
@@ -4,9 +4,9 @@ import numpy as np
4
4
  import pandas as pd
5
5
  import pytest
6
6
 
7
- from iad.core import pdtools as pdt
8
- from iad.core.label import Keys
9
- from iad.core.pdtools import add_row
7
+ from iad.core.data import pdtools as pdt
8
+ from iad.core.data.label import Keys
9
+ from iad.core.data.pdtools import add_row
10
10
  from iad.core.wrap import name_tuple
11
11
 
12
12
 
@@ -3,7 +3,7 @@ from copy import copy
3
3
  import box
4
4
  import pytest
5
5
 
6
- from iad.core.param import TBox
6
+ from iad.core.tbox import TBox
7
7
 
8
8
 
9
9
  def test_construct():
@@ -1,73 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ialdev-core
3
- Version: 0.1.0
4
- Summary: iad.core — algorithmic utilities: data tools, parameters, paths, caching, and more
5
- Author-email: Your Name <your.email@example.com>
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Intended Audience :: Science/Research
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Requires-Dist: ialdev-io
18
- Requires-Dist: pydantic>=2.0
19
- Requires-Dist: pandas>=1.3.0
20
- Requires-Dist: numpy>=1.20.0
21
- Requires-Dist: pyyaml>=5.4.0
22
- Requires-Dist: ruamel.yaml>=0.15.0
23
- Requires-Dist: regex>=2021.0.0
24
- Requires-Dist: rapidfuzz>=3.0
25
- Requires-Dist: tqdm>=4.60.0
26
- Requires-Dist: frozendict>=2.0.0
27
- Requires-Dist: python-box>=6.0.0
28
- Requires-Dist: joblib>=1.0.0
29
- Requires-Dist: configargparse>=1.0.0
30
- Requires-Dist: deprecated>=1.2.0
31
- Requires-Dist: semver>=2.13.0
32
- Requires-Dist: uncertainties>=3.1.0
33
- Requires-Dist: pint>=0.20.0
34
- Requires-Dist: zfpy
35
- Requires-Dist: xxhash>=3.0.0
36
- Requires-Dist: toolz>=0.11.0
37
- Requires-Dist: numba>=0.55.0
38
- Requires-Dist: scikit-learn>=1.0.0
39
- Requires-Dist: python-dotenv>=0.19.0
40
- Project-URL: Homepage, https://github.com/yourusername/toolbox
41
- Project-URL: Issues, https://github.com/yourusername/toolbox/issues
42
- Project-URL: Repository, https://github.com/yourusername/toolbox
43
-
44
- # algutils
45
-
46
- Algorithmic utilities: data tools, I/O, parameters, paths, caching, image transforms, and math (hist, geom, regress).
47
-
48
- Extracted from the toolbox project as a standalone, installable package.
49
-
50
- ## Installation
51
-
52
- ```bash
53
- # From this directory (editable)
54
- pip install -e .
55
-
56
- # With optional extras
57
- pip install -e ".[io,units,dev]"
58
- ```
59
-
60
- ## Usage
61
-
62
- ```python
63
- from algutils import logger, as_list
64
- from algutils.param import TBox, YamlModel
65
- from algutils.io.format import FileFormat
66
- from algutils.io.imread import imread
67
- ```
68
-
69
- ## Development
70
-
71
- - **pixi**: `pixi install` then `pixi run test` or `pixi run lint`
72
- - **pip**: `pip install -e ".[dev]"` then `pytest src/algutils -v`
73
-
@@ -1,29 +0,0 @@
1
- # algutils
2
-
3
- Algorithmic utilities: data tools, I/O, parameters, paths, caching, image transforms, and math (hist, geom, regress).
4
-
5
- Extracted from the toolbox project as a standalone, installable package.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- # From this directory (editable)
11
- pip install -e .
12
-
13
- # With optional extras
14
- pip install -e ".[io,units,dev]"
15
- ```
16
-
17
- ## Usage
18
-
19
- ```python
20
- from algutils import logger, as_list
21
- from algutils.param import TBox, YamlModel
22
- from algutils.io.format import FileFormat
23
- from algutils.io.imread import imread
24
- ```
25
-
26
- ## Development
27
-
28
- - **pixi**: `pixi install` then `pixi run test` or `pixi run lint`
29
- - **pip**: `pip install -e ".[dev]"` then `pytest src/algutils -v`