OpenGeodeWeb-Back 5.10.0rc10__tar.gz → 5.10.0rc11__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 (42) hide show
  1. {opengeodeweb_back-5.10.0rc10/src/OpenGeodeWeb_Back.egg-info → opengeodeweb_back-5.10.0rc11}/PKG-INFO +1 -1
  2. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/pyproject.toml +7 -8
  3. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11/src/OpenGeodeWeb_Back.egg-info}/PKG-INFO +1 -1
  4. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/OpenGeodeWeb_Back.egg-info/SOURCES.txt +1 -2
  5. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/app_config.py +3 -1
  6. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/geode_functions.py +4 -4
  7. opengeodeweb_back-5.10.0rc11/src/opengeodeweb_back/py.typed +1 -0
  8. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/utils_functions.py +13 -5
  9. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/tests/test_models_routes.py +22 -20
  10. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/tests/test_routes.py +26 -22
  11. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/tests/test_utils_functions.py +4 -3
  12. opengeodeweb_back-5.10.0rc10/src/opengeodeweb_back/data.py +0 -45
  13. opengeodeweb_back-5.10.0rc10/src/opengeodeweb_back/database.py +0 -19
  14. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/LICENSE +0 -0
  15. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/README.md +0 -0
  16. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/requirements.txt +0 -0
  17. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/setup.cfg +0 -0
  18. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/OpenGeodeWeb_Back.egg-info/dependency_links.txt +0 -0
  19. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/OpenGeodeWeb_Back.egg-info/requires.txt +0 -0
  20. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/OpenGeodeWeb_Back.egg-info/top_level.txt +0 -0
  21. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/__init__.py +0 -0
  22. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/geode_objects.py +0 -0
  23. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/blueprint_routes.py +0 -0
  24. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/models/blueprint_models.py +0 -0
  25. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/models/schemas/mesh_components.json +0 -0
  26. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/models/schemas/vtm_component_indices.json +0 -0
  27. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/allowed_files.json +0 -0
  28. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/allowed_objects.json +0 -0
  29. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/create_point.json +0 -0
  30. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/geode_objects_and_output_extensions.json +0 -0
  31. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/geographic_coordinate_systems.json +0 -0
  32. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/inspect_file.json +0 -0
  33. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/missing_files.json +0 -0
  34. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/ping.json +0 -0
  35. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/polygon_attribute_names.json +0 -0
  36. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/polyhedron_attribute_names.json +0 -0
  37. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/save_viewable_file.json +0 -0
  38. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/texture_coordinates.json +0 -0
  39. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/upload_file.json +0 -0
  40. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/routes/schemas/vertex_attribute_names.json +0 -0
  41. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/src/opengeodeweb_back/test_utils.py +0 -0
  42. {opengeodeweb_back-5.10.0rc10 → opengeodeweb_back-5.10.0rc11}/tests/test_geode_functions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.10.0rc10
3
+ Version: 5.10.0rc11
4
4
  Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
5
5
  Author-email: Geode-solutions <team-web@geode-solutions.com>
6
6
  Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
@@ -5,18 +5,16 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "OpenGeodeWeb-Back"
8
- version = "5.10.0-rc.10"
8
+ version = "5.10.0-rc.11"
9
9
  dynamic = ["dependencies"]
10
- authors = [
11
- { name="Geode-solutions", email="team-web@geode-solutions.com" },
12
- ]
10
+ authors = [{ name = "Geode-solutions", email = "team-web@geode-solutions.com" }]
13
11
  description = "OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem"
14
12
  readme = "README.md"
15
13
  requires-python = ">=3.9, <3.13"
16
14
  classifiers = [
17
- "Programming Language :: Python :: 3",
18
- "License :: OSI Approved :: MIT License",
19
- "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
20
18
  ]
21
19
 
22
20
  [project.urls]
@@ -24,7 +22,7 @@ classifiers = [
24
22
  "Bug Tracker" = "https://github.com/Geode-solutions/OpenGeodeWeb-Back/issues"
25
23
 
26
24
  [tool.setuptools.dynamic]
27
- dependencies = {file = ["requirements.txt"]}
25
+ dependencies = { file = ["requirements.txt"] }
28
26
 
29
27
  [tool.setuptools.packages.find]
30
28
  where = ["src"]
@@ -32,3 +30,4 @@ where = ["src"]
32
30
  [tool.setuptools.package-data]
33
31
  "opengeodeweb_back.routes.schemas" = ["*.json"]
34
32
  "opengeodeweb_back.routes.models.schemas" = ["*.json"]
33
+ opengeodeweb_microservice = ["py.typed"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.10.0rc10
3
+ Version: 5.10.0rc11
4
4
  Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
5
5
  Author-email: Geode-solutions <team-web@geode-solutions.com>
6
6
  Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
@@ -9,10 +9,9 @@ src/OpenGeodeWeb_Back.egg-info/requires.txt
9
9
  src/OpenGeodeWeb_Back.egg-info/top_level.txt
10
10
  src/opengeodeweb_back/__init__.py
11
11
  src/opengeodeweb_back/app_config.py
12
- src/opengeodeweb_back/data.py
13
- src/opengeodeweb_back/database.py
14
12
  src/opengeodeweb_back/geode_functions.py
15
13
  src/opengeodeweb_back/geode_objects.py
14
+ src/opengeodeweb_back/py.typed
16
15
  src/opengeodeweb_back/test_utils.py
17
16
  src/opengeodeweb_back/utils_functions.py
18
17
  src/opengeodeweb_back/routes/blueprint_routes.py
@@ -4,7 +4,9 @@ import time
4
4
 
5
5
  # Third party imports
6
6
  # Local application imports
7
- from .database import DATABASE_FILENAME
7
+ from opengeodeweb_microservice.database.connection import get_database
8
+
9
+ DATABASE_FILENAME = "project.db"
8
10
 
9
11
 
10
12
  class Config(object):
@@ -11,8 +11,8 @@ from typing import Any
11
11
  # Local application imports
12
12
  from .geode_objects import geode_objects_dict
13
13
  from . import utils_functions
14
- from .data import Data
15
- from .database import database
14
+ from opengeodeweb_microservice.database.data import Data
15
+ from opengeodeweb_microservice.database.connection import get_session
16
16
 
17
17
 
18
18
  def geode_object_value(geode_object: str):
@@ -61,12 +61,12 @@ def load_data(data_id: str) -> Any:
61
61
  flask.abort(404, f"Data with id {data_id} not found")
62
62
 
63
63
  file_absolute_path = data_file_path(data_id, data_entry.native_file_name)
64
+ print("Loading file: ", file_absolute_path)
65
+ print("File exists: ", os.path.exists(file_absolute_path))
64
66
  return load(data_entry.geode_object, file_absolute_path)
65
67
 
66
68
 
67
69
  def get_data_info(data_id: str) -> Data:
68
- from .data import Data
69
-
70
70
  data_entry = Data.get(data_id)
71
71
  if not data_entry:
72
72
  flask.abort(404, f"Data with id {data_id} not found")
@@ -16,8 +16,8 @@ import werkzeug
16
16
 
17
17
  # Local application imports
18
18
  from . import geode_functions
19
- from .data import Data
20
- from .database import database
19
+ from opengeodeweb_microservice.database.data import Data
20
+ from opengeodeweb_microservice.database.connection import get_session
21
21
 
22
22
 
23
23
  def increment_request_counter(current_app: flask.Flask) -> None:
@@ -193,7 +193,9 @@ def save_all_viewables_and_return_info(
193
193
  data_entry.viewable_file_name = os.path.basename(saved_viewable_file_path)
194
194
  data_entry.light_viewable = os.path.basename(saved_light_viewable_file_path)
195
195
 
196
- database.session.commit()
196
+ session = get_session()
197
+ if session:
198
+ session.commit()
197
199
 
198
200
  return {
199
201
  "native_file_name": data_entry.native_file_name,
@@ -247,8 +249,14 @@ def generate_native_viewable_and_light_viewable_from_file(
247
249
 
248
250
  data = geode_functions.load(geode_object, copied_full_path)
249
251
 
250
- database.session.delete(temp_data_entry)
251
- database.session.flush()
252
+ # Remplacer :
253
+ # database.session.delete(temp_data_entry)
254
+ # database.session.flush()
255
+ # Par :
256
+ session = get_session()
257
+ if session:
258
+ session.delete(temp_data_entry)
259
+ session.flush()
252
260
 
253
261
  return save_all_viewables_and_return_info(
254
262
  geode_object,
@@ -3,8 +3,8 @@ import shutil
3
3
  import flask
4
4
 
5
5
  from src.opengeodeweb_back import geode_functions
6
- from src.opengeodeweb_back.data import Data
7
- from src.opengeodeweb_back.database import database
6
+ from opengeodeweb_microservice.database.data import Data
7
+ from opengeodeweb_microservice.database.connection import get_session
8
8
 
9
9
 
10
10
  def test_model_mesh_components(client, test_id):
@@ -33,22 +33,24 @@ def test_extract_brep_uuids(client, test_id):
33
33
  brep_filename = "cube.og_brep"
34
34
 
35
35
  with client.application.app_context():
36
- data_entry = Data.create(geode_object="BRep", input_file=brep_filename)
36
+ data_entry = Data.create(
37
+ geode_object="BRep",
38
+ input_file=brep_filename,
39
+ )
37
40
  data_entry.native_file_name = brep_filename
38
- database.session.commit()
39
-
40
- data_path = geode_functions.data_file_path(data_entry.id, brep_filename)
41
- os.makedirs(os.path.dirname(data_path), exist_ok=True)
42
- shutil.copy(f"./tests/data/{brep_filename}", data_path)
43
-
44
- json_data = {"id": data_entry.id}
45
- response = client.post(route, json=json_data)
46
-
47
- assert response.status_code == 200
48
- uuid_dict = response.json["uuid_dict"]
49
- assert isinstance(uuid_dict, dict)
50
- expected_keys = {"Block", "Line", "Surface", "Corner"}
51
- assert any(key in uuid_dict for key in expected_keys)
52
- for key, value in uuid_dict.items():
53
- assert isinstance(value, list)
54
- assert all(isinstance(v, str) for v in value)
41
+ session = get_session()
42
+ if session:
43
+ session.commit()
44
+
45
+ src_path = os.path.join("tests", "data", brep_filename)
46
+ dest_path = os.path.join(
47
+ flask.current_app.config["DATA_FOLDER_PATH"], data_entry.id, brep_filename
48
+ )
49
+ os.makedirs(os.path.dirname(dest_path), exist_ok=True)
50
+ shutil.copy2(src_path, dest_path)
51
+
52
+ response = client.post(route, json={"id": data_entry.id})
53
+ assert response.status_code == 200
54
+ assert "uuid_dict" in response.json
55
+ uuid_dict = response.json["uuid_dict"]
56
+ assert isinstance(uuid_dict, dict)
@@ -6,9 +6,9 @@ import shutil
6
6
  from werkzeug.datastructures import FileStorage
7
7
 
8
8
  # Local application imports
9
+ from opengeodeweb_microservice.database.data import Data
10
+ from opengeodeweb_microservice.database.connection import get_session
9
11
  from src.opengeodeweb_back import geode_functions, test_utils
10
- from src.opengeodeweb_back.data import Data
11
- from src.opengeodeweb_back.database import database
12
12
 
13
13
 
14
14
  def test_allowed_files(client):
@@ -173,17 +173,15 @@ def test_texture_coordinates(client, test_id):
173
173
  with client.application.app_context():
174
174
  data = Data.create(geode_object="PolygonalSurface3D", input_file="hat.vtp")
175
175
  data.native_file_name = "hat.vtp"
176
- database.session.commit()
176
+ session = get_session()
177
+ if session:
178
+ session.commit()
177
179
 
178
- data_path = geode_functions.data_file_path(data.id, "hat.vtp")
179
- print(data_path)
180
+ data_path = geode_functions.data_file_path(data.id, data.native_file_name)
180
181
  os.makedirs(os.path.dirname(data_path), exist_ok=True)
181
182
  shutil.copy("./tests/data/hat.vtp", data_path)
182
-
183
- response = client.post(
184
- "/texture_coordinates",
185
- json={"id": data.id},
186
- )
183
+ assert os.path.exists(data_path), f"File not found at {data_path}"
184
+ response = client.post("/texture_coordinates", json={"id": data.id})
187
185
  assert response.status_code == 200
188
186
  texture_coordinates = response.json["texture_coordinates"]
189
187
  assert type(texture_coordinates) is list
@@ -197,13 +195,14 @@ def test_vertex_attribute_names(client, test_id):
197
195
  with client.application.app_context():
198
196
  data = Data.create(geode_object="PolygonalSurface3D", input_file="test.vtp")
199
197
  data.native_file_name = "test.vtp"
200
- database.session.commit()
198
+ session = get_session()
199
+ if session:
200
+ session.commit()
201
201
 
202
- data_path = geode_functions.data_file_path(data.id, "test.vtp")
202
+ data_path = geode_functions.data_file_path(data.id, data.native_file_name)
203
203
  os.makedirs(os.path.dirname(data_path), exist_ok=True)
204
- if os.path.exists("./tests/data/hat.vtp"):
205
- shutil.copy("./tests/data/hat.vtp", data_path)
206
-
204
+ shutil.copy("./tests/data/test.vtp", data_path)
205
+ assert os.path.exists(data_path), f"File not found at {data_path}"
207
206
  response = client.post(route, json={"id": data.id})
208
207
  assert response.status_code == 200
209
208
  vertex_attribute_names = response.json["vertex_attribute_names"]
@@ -218,12 +217,14 @@ def test_polygon_attribute_names(client, test_id):
218
217
  with client.application.app_context():
219
218
  data = Data.create(geode_object="PolygonalSurface3D", input_file="test.vtp")
220
219
  data.native_file_name = "test.vtp"
221
- database.session.commit()
220
+ session = get_session()
221
+ if session:
222
+ session.commit()
222
223
 
223
- data_path = geode_functions.data_file_path(data.id, "test.vtp")
224
+ data_path = geode_functions.data_file_path(data.id, data.native_file_name)
224
225
  os.makedirs(os.path.dirname(data_path), exist_ok=True)
225
- shutil.copy("./tests/data/test.vtp", data_path)
226
-
226
+ shutil.copy("./tests/data/test.vtp", data_path)
227
+ assert os.path.exists(data_path), f"File not found at {data_path}"
227
228
  response = client.post(route, json={"id": data.id})
228
229
  assert response.status_code == 200
229
230
  polygon_attribute_names = response.json["polygon_attribute_names"]
@@ -238,13 +239,16 @@ def test_polyhedron_attribute_names(client, test_id):
238
239
  with client.application.app_context():
239
240
  data = Data.create(geode_object="PolyhedralSolid3D", input_file="test.vtu")
240
241
  data.native_file_name = "test.vtu"
241
- database.session.commit()
242
+ session = get_session()
243
+ if session:
244
+ session.commit()
242
245
 
243
- data_path = geode_functions.data_file_path(data.id, "test.vtu")
246
+ data_path = geode_functions.data_file_path(data.id, data.native_file_name)
244
247
  os.makedirs(os.path.dirname(data_path), exist_ok=True)
245
248
  shutil.copy("./tests/data/test.vtu", data_path)
246
-
249
+ assert os.path.exists(data_path), f"File not found at {data_path}"
247
250
  response = client.post(route, json={"id": data.id})
251
+ print(response.json)
248
252
  assert response.status_code == 200
249
253
  polyhedron_attribute_names = response.json["polyhedron_attribute_names"]
250
254
  assert type(polyhedron_attribute_names) is list
@@ -8,8 +8,8 @@ import shutil
8
8
  import uuid
9
9
 
10
10
  # Local application imports
11
- from src.opengeodeweb_back.database import database
12
- from src.opengeodeweb_back.data import Data
11
+ from opengeodeweb_microservice.database.data import Data
12
+ from opengeodeweb_microservice.database.connection import get_session
13
13
  from src.opengeodeweb_back import geode_functions, utils_functions
14
14
 
15
15
 
@@ -143,7 +143,8 @@ def test_save_all_viewables_commits_to_db(client):
143
143
  db_entry_before = Data.get(data_id)
144
144
  assert db_entry_before is not None
145
145
  assert db_entry_before.native_file_name == result["native_file_name"]
146
- database.session.rollback()
146
+ session = get_session()
147
+ session.rollback()
147
148
  db_entry_after = Data.get(data_id)
148
149
  assert (
149
150
  db_entry_after is not None
@@ -1,45 +0,0 @@
1
- from sqlalchemy import String, JSON
2
- from sqlalchemy.orm import Mapped, mapped_column
3
- from .database import database, Base
4
- import uuid
5
-
6
-
7
- class Data(Base):
8
- __tablename__ = "datas"
9
-
10
- id: Mapped[str] = mapped_column(
11
- String, primary_key=True, default=lambda: str(uuid.uuid4()).replace("-", "")
12
- )
13
- native_file_name: Mapped[str] = mapped_column(String, nullable=False)
14
- viewable_file_name: Mapped[str] = mapped_column(String, nullable=False)
15
- geode_object: Mapped[str] = mapped_column(String, nullable=False)
16
-
17
- light_viewable: Mapped[str | None] = mapped_column(String, nullable=True)
18
- input_file: Mapped[str | None] = mapped_column(String, nullable=True)
19
- additional_files: Mapped[list[str] | None] = mapped_column(JSON, nullable=True)
20
-
21
- @staticmethod
22
- def create(
23
- geode_object: str,
24
- input_file: str | None = None,
25
- additional_files: list[str] | None = None,
26
- ) -> "Data":
27
- input_file = input_file if input_file is not None else ""
28
- additional_files = additional_files if additional_files is not None else []
29
-
30
- data_entry = Data(
31
- geode_object=geode_object,
32
- input_file=input_file,
33
- additional_files=additional_files,
34
- native_file_name="",
35
- viewable_file_name="",
36
- light_viewable=None,
37
- )
38
-
39
- database.session.add(data_entry)
40
- database.session.flush()
41
- return data_entry
42
-
43
- @staticmethod
44
- def get(data_id: str) -> "Data | None":
45
- return database.session.get(Data, data_id)
@@ -1,19 +0,0 @@
1
- from flask import Flask
2
- from flask_sqlalchemy import SQLAlchemy
3
- from sqlalchemy.orm import DeclarativeBase
4
-
5
- DATABASE_FILENAME = "project.db"
6
-
7
-
8
- class Base(DeclarativeBase):
9
- pass
10
-
11
-
12
- database = SQLAlchemy(model_class=Base)
13
-
14
-
15
- def initialize_database(app: Flask) -> SQLAlchemy:
16
- database.init_app(app)
17
- with app.app_context():
18
- database.create_all()
19
- return database