samgis_core 3.0.10__tar.gz → 3.0.12__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.
- {samgis_core-3.0.10 → samgis_core-3.0.12}/PKG-INFO +1 -1
- {samgis_core-3.0.10 → samgis_core-3.0.12}/pyproject.toml +2 -2
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/frontend_builder.py +1 -1
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/update_requirements_txt.py +26 -8
- {samgis_core-3.0.10 → samgis_core-3.0.12}/LICENSE +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/README.md +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/__init__.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/__version__.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/prediction_api/__init__.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/prediction_api/sam_onnx2.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/prediction_api/sam_onnx_inference.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/__init__.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/constants.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/create_folders_if_not_exists.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/plot_images.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/serialize.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/session_logger.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/type_hints.py +0 -0
- {samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/utilities.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "samgis_core"
|
3
|
-
version = "3.0.
|
3
|
+
version = "3.0.12"
|
4
4
|
description = "SamGIS CORE"
|
5
5
|
authors = ["alessandro trinca tornidor <alessandro@trinca.tornidor.com>"]
|
6
6
|
license = "MIT license"
|
@@ -8,7 +8,7 @@ readme = "README.md"
|
|
8
8
|
|
9
9
|
[metadata]
|
10
10
|
name = "samgis_core"
|
11
|
-
version = "3.0.
|
11
|
+
version = "3.0.12"
|
12
12
|
|
13
13
|
[tool.poetry.urls]
|
14
14
|
Source = "https://gitlab.com/aletrn/samgis_core"
|
@@ -127,7 +127,7 @@ def build_frontend(
|
|
127
127
|
run_command(["pnpm", "install"])
|
128
128
|
|
129
129
|
# build frontend dist and assert for its correct build
|
130
|
-
output_css = str(
|
130
|
+
output_css = str(output_css_pathfile)
|
131
131
|
output_index_html = str(output_dist_folder / index_page_filename)
|
132
132
|
output_dist_folder = str(output_dist_folder)
|
133
133
|
app_logger.info(f"pnpm: build '{output_dist_folder}'...")
|
@@ -15,11 +15,16 @@ def get_dependencies_freeze() -> dict:
|
|
15
15
|
return {dist.metadata["name"]: dist.version for dist in metadata.distributions()}
|
16
16
|
|
17
17
|
|
18
|
-
def sanitize_path(filename: str | Path) -> Path:
|
18
|
+
def sanitize_path(filename: str | Path, strict_on_filename: bool = True) -> Path:
|
19
19
|
filename = Path(filename)
|
20
20
|
base_path = Path.cwd().resolve(strict=True)
|
21
21
|
logger.info(f"base_path (current working folder):{base_path} ...")
|
22
|
-
|
22
|
+
try:
|
23
|
+
safe_path = filename.resolve(strict=strict_on_filename)
|
24
|
+
except FileNotFoundError as fnfe:
|
25
|
+
logger.error(f"filename not found:{filename.absolute()}.")
|
26
|
+
logger.error(f"fnfe:{fnfe}.")
|
27
|
+
raise fnfe
|
23
28
|
try:
|
24
29
|
assert base_path / filename.name == safe_path
|
25
30
|
except AssertionError:
|
@@ -46,15 +51,18 @@ def get_requirements_txt(requirements_no_versions_filename: str | Path, requirem
|
|
46
51
|
logger.info("start requirements.txt update...")
|
47
52
|
freeze_dict = get_dependencies_freeze()
|
48
53
|
logger.debug(f"freeze_dict:{freeze_dict}.")
|
49
|
-
|
50
|
-
|
54
|
+
logger.debug(f"requirements_no_versions_filename:{requirements_no_versions_filename}.")
|
55
|
+
requirements_no_versions_filename_sanitized = sanitize_path(requirements_no_versions_filename)
|
56
|
+
logger.info(f"requirements_no_versions_filename_sanitized:{requirements_no_versions_filename_sanitized}.")
|
57
|
+
with open(requirements_no_versions_filename_sanitized) as req_src:
|
51
58
|
packages_no_requirements = req_src.read().split("\n")
|
52
59
|
requirements_output = {
|
53
60
|
name: version for name, version in sorted(freeze_dict.items()) if name in packages_no_requirements
|
54
61
|
}
|
55
|
-
logger.
|
56
|
-
|
57
|
-
|
62
|
+
logger.debug(f"requirements to write:{requirements_output}.")
|
63
|
+
requirements_output_filename_sanitized = sanitize_path(requirements_output_filename, strict_on_filename=False)
|
64
|
+
logger.debug(f"requirements_output_filename_sanitized:{requirements_output_filename_sanitized}.")
|
65
|
+
with open(requirements_output_filename_sanitized, "w") as dst:
|
58
66
|
out = ""
|
59
67
|
for name, version in requirements_output.items():
|
60
68
|
out += f"{name}=={version}\n"
|
@@ -65,6 +73,7 @@ def get_requirements_txt(requirements_no_versions_filename: str | Path, requirem
|
|
65
73
|
|
66
74
|
def get_args(current_args: list) -> argparse.Namespace:
|
67
75
|
warning = "This file must be within the current folder."
|
76
|
+
logger.info(f"current_args:{current_args}.")
|
68
77
|
parser = argparse.ArgumentParser(description="Update requirements.txt from current installed packages.")
|
69
78
|
parser.add_argument(
|
70
79
|
"--req_no_version_path", required=True,
|
@@ -74,11 +83,20 @@ def get_args(current_args: list) -> argparse.Namespace:
|
|
74
83
|
"--req_output_path", required=True,
|
75
84
|
help=f"file path for output requirements. {warning}."
|
76
85
|
)
|
77
|
-
|
86
|
+
parser.add_argument(
|
87
|
+
"--loglevel", required=False,
|
88
|
+
default="INFO",
|
89
|
+
choices=["DEBUG", "INFO"],
|
90
|
+
help=f"log level (default INFO)."
|
91
|
+
)
|
92
|
+
args = parser.parse_args(current_args)
|
93
|
+
logger.debug(f"args:{args}.")
|
94
|
+
return args
|
78
95
|
|
79
96
|
|
80
97
|
if __name__ == '__main__':
|
81
98
|
args = get_args(sys.argv[1:])
|
99
|
+
session_logger.setup_logging(json_logs=False, log_level=args.loglevel)
|
82
100
|
get_requirements_txt(
|
83
101
|
requirements_no_versions_filename=args.req_no_version_path,
|
84
102
|
requirements_output_filename=args.req_output_path
|
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
|
{samgis_core-3.0.10 → samgis_core-3.0.12}/samgis_core/utilities/create_folders_if_not_exists.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|