samgis_core 3.5.0__tar.gz → 3.5.2__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.
@@ -1,21 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: samgis_core
3
- Version: 3.5.0
3
+ Version: 3.5.2
4
4
  Summary: SamGIS CORE
5
5
  License: MIT
6
6
  License-File: LICENSE
7
7
  Author: alessandro trinca tornidor
8
8
  Author-email: alessandro@trinca.tornidor.com
9
- Requires-Python: >=3.10, <3.14
9
+ Requires-Python: >=3.12, <3.14
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
12
  Classifier: Programming Language :: Python :: 3.12
15
13
  Classifier: Programming Language :: Python :: 3.13
16
14
  Requires-Dist: bson (>=0.5.10,<0.6.0)
17
15
  Requires-Dist: numpy (>=2.2.4,<3.0.0)
18
- Requires-Dist: pillow (>=11.1.0,<12.0.0)
16
+ Requires-Dist: pillow (>=12.1.0,<13.0.0)
19
17
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
20
18
  Requires-Dist: structlog (>=25.2.0,<26.0.0)
21
19
  Project-URL: Source, https://gitlab.com/aletrn/samgis_core
@@ -1,15 +1,15 @@
1
1
  [project]
2
2
  name = "samgis_core"
3
- version = "3.5.0"
3
+ version = "3.5.2"
4
4
  description = "SamGIS CORE"
5
5
  authors = [{name = "alessandro trinca tornidor", email = "alessandro@trinca.tornidor.com"}]
6
6
  license = {text = "MIT license"}
7
7
  readme = "README.md"
8
- requires-python = ">=3.10, <3.14"
8
+ requires-python = ">=3.12, <3.14"
9
9
  dependencies = [
10
10
  "bson (>=0.5.10,<0.6.0)",
11
11
  "numpy (>=2.2.4,<3.0.0)",
12
- "pillow (>=11.1.0,<12.0.0)",
12
+ "pillow (>=12.1.0,<13.0.0)",
13
13
  "python-dotenv (>=1.0.1,<2.0.0)",
14
14
  "structlog (>=25.2.0,<26.0.0)"
15
15
  ]
@@ -30,9 +30,9 @@ optional = true
30
30
 
31
31
  [tool.poetry.group.test.dependencies]
32
32
  mpld3 = "^0.5.10"
33
- pytest = "^8.3.5"
34
- pytest-cov = "^6.0.0"
35
- rasterio = "^1.4.3"
33
+ pytest = "^9.0.2"
34
+ pytest-cov = "^7.0.0"
35
+ rasterio = "^1.5.0"
36
36
 
37
37
  [build-system]
38
38
  requires = ["poetry-core>=2.0.0,<3.0.0"]
@@ -36,7 +36,8 @@ def create_folder_if_not_exists(pathname: Path | str):
36
36
 
37
37
  print(f"assertion: pathname exists and is a folder: {current_pathname} ...")
38
38
  logging.info(f"assertion: pathname exists and is a folder: {current_pathname} ...")
39
- assert current_pathname.is_dir()
39
+ if not current_pathname.is_dir():
40
+ raise OSError(f"folder not found: {current_pathname}.")
40
41
 
41
42
 
42
43
  def folders_creation(folders_map: dict | str = None, ignore_errors: bool = True):
@@ -60,9 +61,9 @@ def folders_creation(folders_map: dict | str = None, ignore_errors: bool = True)
60
61
  for folder_env_ref, folder_env_path in folders_dict.items():
61
62
  logging.info(f"folder_env_ref:{folder_env_ref}, folder_env_path:{folder_env_path}.")
62
63
  create_folder_if_not_exists(folder_env_path)
63
- print("========")
64
- if enforce_validation_with_getenv:
65
- assert os.getenv(folder_env_ref) == folder_env_path
64
+ print("="*20)
65
+ if enforce_validation_with_getenv and os.getenv(folder_env_ref) != folder_env_path:
66
+ raise IOError(f"wrong folder path: {folder_env_path} #")
66
67
  except (json.JSONDecodeError, TypeError) as jde:
67
68
  logging.error(f"jde:{jde}.")
68
69
  msg = "double check your variables, e.g. for misspelling like 'FOLDER_MAP'"
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  import os
2
3
  import subprocess
3
4
  from pathlib import Path
@@ -26,11 +27,13 @@ def assert_envs(envs_list: ListStr) -> None:
26
27
 
27
28
  """
28
29
  for current_env in envs_list:
29
- try:
30
- assert current_env is not None and current_env != ""
31
- except AssertionError as aex:
32
- app_logger.error(f"error on assertion for current_env: {current_env}.")
33
- raise aex
30
+ if not current_env:
31
+ raise EnvironmentError(f"error on assertion for current_env: {current_env}.")
32
+ # try:
33
+ # assert current_env is not None and current_env != ""
34
+ # except AssertionError as aex:
35
+ # app_logger.error(f"error on assertion for current_env: {current_env}.")
36
+ # raise aex
34
37
 
35
38
 
36
39
  def read_std_out_err(std_out_err: str, output_type: str, command: ListStr) -> None:
@@ -161,16 +164,22 @@ def get_installed_node():
161
164
  if not (node_dir and Path(node_dir).exists() and Path(node_dir).is_dir()):
162
165
  app_logger.error(f"node_dir:{node_dir} not found.")
163
166
  node_dir_env = os.getenv("NODE_DIR_PARENT")
164
- assert node_dir_env is not None and node_dir_env != "", "NODE_DIR_PARENT/NODE_DIR env variable not found."
167
+ # assert node_dir_env is not None and node_dir_env != "", "NODE_DIR_PARENT/NODE_DIR env variable not found."
168
+ logging.warning(f"node_dir_env: {type(node_dir_env)}, {node_dir_env} #")
169
+ if node_dir_env is None or node_dir_env == "":
170
+ raise ValueError("NODE_DIR_PARENT/NODE_DIR env variable not found.")
165
171
  node_dir_parent = Path(os.getenv("NODE_DIR_PARENT"))
166
172
  app_logger.error(f"try with '{node_dir_parent}' ...")
167
- assert node_dir_parent.exists() and node_dir_parent.is_dir(), "node_dir_parent not found"
173
+ if not (node_dir_parent.exists() and node_dir_parent.is_dir()):
174
+ raise FileNotFoundError("node_dir_parent not found")
168
175
  list_node_folders = [f.path for f in os.scandir(node_dir_parent) if f.is_dir()]
169
176
  list_node_folders.sort()
170
- assert isinstance(list_node_folders, list) and len(list_node_folders) > 0, "no node folders found."
177
+ if not isinstance(list_node_folders, list) or len(list_node_folders) < 1:
178
+ raise FileNotFoundError("no node folders found.")
171
179
  node_dir = list_node_folders.pop()
172
180
  node_dir_bin = Path(node_dir) / "bin"
173
- assert node_dir_bin.exists() and node_dir_bin.is_dir(), f"node's bin not found or not a directory: {node_dir}."
181
+ if not (node_dir_bin.exists() and node_dir_bin.is_dir()):
182
+ raise FileNotFoundError(f"node's bin not found or not a directory: {node_dir}.")
174
183
  return node_dir_bin
175
184
 
176
185
 
@@ -30,15 +30,17 @@ def helper_imshow_output_expected(
30
30
  tuple of matplotlib Figure, Axes
31
31
 
32
32
  """
33
- n = len(img_list)
34
- assert len(titles_list) == n
33
+ n_img = len(img_list)
34
+ n_titles = len(titles_list)
35
+ if n_titles != n_img:
36
+ raise ValueError(f"wrong number of titles ({n_titles}) vs number of img ({n_img})")
35
37
  fig, ax = plt.subplot_mosaic([
36
38
  titles_list
37
- ], figsize=(n * plot_size, plot_size))
39
+ ], figsize=(n_img * plot_size, plot_size))
38
40
 
39
41
  for title, img in zip(titles_list, img_list):
40
42
  ax[title].imshow(img, cmap=cmap)
41
- ax[title].legend()
43
+ ax[title].legend(title)
42
44
  if show:
43
45
  if debug:
44
46
  plt.pause(0.01)
File without changes
File without changes