From 7bf123b09b2d7df8a4b2783720cdd017003fe107 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Tue, 3 Sep 2024 16:08:35 +0200 Subject: [PATCH 01/22] handle in function "collect_legend_entries_by_bbox" all law status --- .../data_sources/interlis_2_3/sources/plr.py | 41 +++++++++++------- .../data_sources/standard/sources/plr.py | 43 ++++++++++++------- 2 files changed, 54 insertions(+), 30 deletions(-) diff --git a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py index 0306a86b29..b3a5664814 100644 --- a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py @@ -470,7 +470,7 @@ def collect_related_geometries_by_real_estate(self, session, real_estate): .selectinload(self.models.MultilingualUri.localised_uri) ).all() - def collect_legend_entries_by_bbox(self, session, bbox, law_status): + def collect_legend_entries_by_bbox(self, session, bbox): """ Extracts all legend entries in the topic which have spatial relation with the passed bounding box of visible extent. @@ -478,12 +478,11 @@ def collect_legend_entries_by_bbox(self, session, bbox, law_status): Args: session (sqlalchemy.orm.Session): The requested clean session instance ready for use bbox (shapely.geometry.base.BaseGeometry): The bbox to search the records. - law_status (str): String of the law status for which the legend entries should be queried. Returns: list: The result of the related geometries unique by the public law restriction id and law status """ - distinct_legend_entry_ids = [] + # Select the legend entries of all plr within bbox geometries = session.query(self._model_).filter( or_( self._model_.point.ST_Intersects(from_shape(bbox, srid=Config.get('srid'))), @@ -493,13 +492,31 @@ def collect_legend_entries_by_bbox(self, session, bbox, law_status): selectinload(self.models.Geometry.public_law_restriction) ).all() + # Compile a list of unique legend entry ids for each law status + legend_entry_ids = dict() for geometry in geometries: - if geometry.public_law_restriction.legend_entry_id not in distinct_legend_entry_ids\ - and geometry.public_law_restriction.law_status == law_status: - distinct_legend_entry_ids.append(geometry.public_law_restriction.legend_entry_id) + if geometry.public_law_restriction.law_status not in legend_entry_ids.keys(): + legend_entry_ids[geometry.public_law_restriction.law_status] = { + geometry.public_law_restriction.legend_entry_id + } + else: + legend_entry_ids[geometry.public_law_restriction.law_status].add( + geometry.public_law_restriction.legend_entry_id + ) + + # Retrieve legend entries + legend_entries_from_db = [] + for law_status in legend_entry_ids.keys(): + legend_entries_from_db.append( + [ + session.query(self.legend_entry_model).filter( + self.legend_entry_model.t_id.in_(list(legend_entry_ids[law_status])) + ).all(), + law_status + ] + ) - return session.query(self.legend_entry_model).filter( - self.legend_entry_model.t_id.in_((distinct_legend_entry_ids))).all() + return legend_entries_from_db def read(self, params, real_estate, bbox): """ @@ -543,14 +560,8 @@ def read(self, params, real_estate, bbox): if (geometry.public_law_restriction.law_status not in law_status_of_geometry): law_status_of_geometry.append(geometry.public_law_restriction.law_status) - legend_entries_from_db = [] # get legend_entries per law_status - for law_status in law_status_of_geometry: - legend_entry_with_law_status = [ - self.collect_legend_entries_by_bbox(session, bbox, law_status), - law_status - ] - legend_entries_from_db.append(legend_entry_with_law_status) + legend_entries_from_db = self.collect_legend_entries_by_bbox(session, bbox) self.records = [] for geometry_result in geometry_results: diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index 3aa9028ae1..ab5c2a653c 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -614,7 +614,7 @@ def collect_related_geometries_by_real_estate(self, session, real_estate): .selectinload(self.models.PublicLawRestriction.responsible_office), ).all() - def collect_legend_entries_by_bbox(self, session, bbox, law_status): + def collect_legend_entries_by_bbox(self, session, bbox): """ Extracts all legend entries in the topic which have spatial relation with the passed bounding box of visible extent. @@ -622,22 +622,41 @@ def collect_legend_entries_by_bbox(self, session, bbox, law_status): Args: session (sqlalchemy.orm.Session): The requested clean session instance ready for use bbox (shapely.geometry.base.BaseGeometry): The bbox to search the records. - law_status (str): String of the law status for which the legend entries should be queried. Returns: list: The result of the related geometries unique by the public law restriction id and law status """ - distinct_legend_entry_ids = [] + # Select the legend entries of all plr within bbox geometries = self.handle_collection(session, bbox).options( selectinload(self.models.Geometry.public_law_restriction) ).all() + + # Compile a list of unique legend entry ids for each law status + legend_entry_ids = dict() for geometry in geometries: - if geometry.public_law_restriction.legend_entry_id not in distinct_legend_entry_ids \ - and geometry.public_law_restriction.law_status == law_status: - distinct_legend_entry_ids.append(geometry.public_law_restriction.legend_entry_id) - return session.query(self.legend_entry_model).filter( - self.legend_entry_model.id.in_((distinct_legend_entry_ids))).all() + if geometry.public_law_restriction.law_status not in legend_entry_ids.keys(): + legend_entry_ids[geometry.public_law_restriction.law_status] = { + geometry.public_law_restriction.legend_entry_id + } + else: + legend_entry_ids[geometry.public_law_restriction.law_status].add( + geometry.public_law_restriction.legend_entry_id + ) + + # Retrieve legend entries + legend_entries_from_db = [] + for law_status in legend_entry_ids.keys(): + legend_entries_from_db.append( + [ + session.query(self.legend_entry_model).filter( + self.legend_entry_model.id.in_(list(legend_entry_ids[law_status])) + ).all(), + law_status + ] + ) + + return legend_entries_from_db def read(self, params, real_estate, bbox): # pylint: disable=W:0221 """ @@ -680,14 +699,8 @@ def read(self, params, real_estate, bbox): # pylint: disable=W:0221 if (geometry.public_law_restriction.law_status not in law_status_of_geometry): law_status_of_geometry.append(geometry.public_law_restriction.law_status) - legend_entries_from_db = [] # get legend_entries per law_status - for law_status in law_status_of_geometry: - legend_entry_with_law_status = [ - self.collect_legend_entries_by_bbox(session, bbox, law_status), - law_status - ] - legend_entries_from_db.append(legend_entry_with_law_status) + legend_entries_from_db = self.collect_legend_entries_by_bbox(session, bbox) self.records = [] for geometry_result in geometry_results: From 15dd32e6a5bb0cca77ff220f2752764d771c8003 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Tue, 8 Oct 2024 11:03:37 +0200 Subject: [PATCH 02/22] remove not used code --- .../contrib/data_sources/interlis_2_3/sources/plr.py | 5 ----- pyramid_oereb/contrib/data_sources/standard/sources/plr.py | 6 ------ 2 files changed, 11 deletions(-) diff --git a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py index b3a5664814..4d15c5beef 100644 --- a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py @@ -554,11 +554,6 @@ def read(self, params, real_estate, bbox): else: # We found spatially related elements. This means we need to extract the actual plr # information related to the found geometries. - law_status_of_geometry = [] - # get distinct values of law_status for all geometries found - for geometry in geometry_results: - if (geometry.public_law_restriction.law_status not in law_status_of_geometry): - law_status_of_geometry.append(geometry.public_law_restriction.law_status) # get legend_entries per law_status legend_entries_from_db = self.collect_legend_entries_by_bbox(session, bbox) diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index ab5c2a653c..3d61ed567c 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -693,12 +693,6 @@ def read(self, params, real_estate, bbox): # pylint: disable=W:0221 # We found spatially related elements. This means we need to extract the actual plr # information related to the found geometries. - law_status_of_geometry = [] - # get distinct values of law_status for all geometries found - for geometry in geometry_results: - if (geometry.public_law_restriction.law_status not in law_status_of_geometry): - law_status_of_geometry.append(geometry.public_law_restriction.law_status) - # get legend_entries per law_status legend_entries_from_db = self.collect_legend_entries_by_bbox(session, bbox) From cf380376c91938acfa02f8a57131b7aadb350f06 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 16 Oct 2024 11:07:30 +0200 Subject: [PATCH 03/22] add test for collect_legend_entries_by_bbox --- .../data_sources/interlis_2_3/sources/plr.py | 18 ++- .../data_sources/standard/sources/plr.py | 19 ++- .../sources/test_plr.py | 120 ++++++++++++++++++ .../sources/test_plr.py | 87 +++++++++++++ 4 files changed, 238 insertions(+), 6 deletions(-) diff --git a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py index 4d15c5beef..8a5fdacb51 100644 --- a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py @@ -470,6 +470,20 @@ def collect_related_geometries_by_real_estate(self, session, real_estate): .selectinload(self.models.MultilingualUri.localised_uri) ).all() + def get_legend_entries_from_db(self, session, legend_entry_ids): + """ + Retrieves the legend entries for a list of t_id-values. + + Args: + session (sqlalchemy.orm.Session): The requested clean session instance ready for use + legend_entry_ids (list): list of the egend entry ids + + Returns: + list: the query result represented as a list. + """ + return session.query(self.legend_entry_model).filter( + self.legend_entry_model.t_id.in_(legend_entry_ids)).all() + def collect_legend_entries_by_bbox(self, session, bbox): """ Extracts all legend entries in the topic which have spatial relation with the passed bounding box of @@ -509,9 +523,7 @@ def collect_legend_entries_by_bbox(self, session, bbox): for law_status in legend_entry_ids.keys(): legend_entries_from_db.append( [ - session.query(self.legend_entry_model).filter( - self.legend_entry_model.t_id.in_(list(legend_entry_ids[law_status])) - ).all(), + self.get_legend_entries_from_db(session, list(legend_entry_ids[law_status])), law_status ] ) diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index 3d61ed567c..0df7ad1431 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -614,6 +614,21 @@ def collect_related_geometries_by_real_estate(self, session, real_estate): .selectinload(self.models.PublicLawRestriction.responsible_office), ).all() + def get_legend_entries_from_db(self, session, legend_entry_ids): + """ + Retrieves the legend entries for a list of id-values. + + Args: + session (sqlalchemy.orm.Session): The requested clean session instance ready for use + legend_entry_ids (list): list of the egend entry ids + + Returns: + list: the query result represented as a list. + """ + + return session.query(self.legend_entry_model).filter( + self.legend_entry_model.id.in_(legend_entry_ids)).all() + def collect_legend_entries_by_bbox(self, session, bbox): """ Extracts all legend entries in the topic which have spatial relation with the passed bounding box of @@ -649,9 +664,7 @@ def collect_legend_entries_by_bbox(self, session, bbox): for law_status in legend_entry_ids.keys(): legend_entries_from_db.append( [ - session.query(self.legend_entry_model).filter( - self.legend_entry_model.id.in_(list(legend_entry_ids[law_status])) - ).all(), + self.get_legend_entries_from_db(session, list(legend_entry_ids[law_status])), law_status ] ) diff --git a/tests/contrib.data_sources.interlis_2_3/sources/test_plr.py b/tests/contrib.data_sources.interlis_2_3/sources/test_plr.py index 5cc5598897..b7844e0ed9 100644 --- a/tests/contrib.data_sources.interlis_2_3/sources/test_plr.py +++ b/tests/contrib.data_sources.interlis_2_3/sources/test_plr.py @@ -20,6 +20,7 @@ from pyramid_oereb.contrib.data_sources.interlis_2_3.sources.plr import ( StandardThemeConfigParser ) +from pyramid_oereb.contrib.data_sources.interlis_2_3.sources.plr import DatabaseSource @pytest.fixture(scope='session') @@ -209,6 +210,21 @@ def oblique_limit_real_estate_record(): ) +@pytest.fixture +def plr_source_params(db_connection): + yield { + "source": { + "class": "pyramid_oereb.contrib.data_sources.interlis_2_3.sources.plr.DatabaseSource", + "params": { + "db_connection": db_connection, + "model_factory": "pyramid_oereb.contrib.data_sources.interlis_2_3." + "models.theme.model_factory_integer_pk", + "schema_name": "land_use_plans" + } + } + } + + # @pytest.fixture # def interlis_real_estate(): # theme = ThemeRecord('code', dict(), 100) @@ -286,3 +302,107 @@ def test_related_geometries(processor_data, pyramid_oereb_test_config, interlis_ assert len(extract_raw.real_estate.public_law_restrictions) == nb_results extract = processor.plr_tolerance_check(extract_raw) assert len(extract.real_estate.public_law_restrictions) == nb_results + + +def mock_session_object_query_geometries(items_list): + class PublicLawRestrictionTest(): + def __init__(self, law_status, legend_entry_id): + self.law_status = law_status + self.legend_entry_id = legend_entry_id + + class GeometryTest(): + def __init__(self, public_law_restriction): + self.public_law_restriction = public_law_restriction + + geometries = [] + for item in items_list: + geometries.append(GeometryTest(PublicLawRestrictionTest(item[0], item[1]))) + + class AllTest(): + def all(): + return iter(geometries) + + class DistinctTest(): + def __init__(self): + pass + + def options(arg2): + return AllTest + + class FilterTest(): + def __init__(self): + pass + + def distinct(arg2): + return DistinctTest + + class QueryTest(): + def __init__(self): + pass + + def filter(arg3): + return FilterTest + + class SessionTest(): + def __init__(self): + pass + + def query(arg1): + return QueryTest + + return SessionTest + + +def get_return_vals_of_get_legend_entries_from_db(arg1, arg2, list_of_ids): + return_value = [] + for id in list_of_ids: + return_value.append((id, )) + return return_value + + +@pytest.mark.parametrize('idx,items_list', [ + (0, [ + ["inForce", 1], + ["changeWithoutPreEffect", 1], + ["changeWithoutPreEffect", 2], + ["inForce", 3], + ["inForce", 4], + ["inForce", 3], + ["changeWithoutPreEffect", 6], + ["inForce", 7], + ["changeWithoutPreEffect", 2], + ["inForce", 9], + ["changeWithoutPreEffect", 7] + ]), + (1, [ + ["inForce", 1], + ["inForce", 3], + ["inForce", 4], + ["inForce", 3], + ["inForce", 7], + ["inForce", 9], + ]) +]) +def test_collect_legend_entries_by_bbox(idx, items_list, plr_source_params): + with ( + patch.object( + DatabaseSource, + 'get_legend_entries_from_db', + get_return_vals_of_get_legend_entries_from_db + ) + ): + source = DatabaseSource(**plr_source_params) + result = source.collect_legend_entries_by_bbox( + mock_session_object_query_geometries(items_list), + Polygon(((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.)))) + + if idx == 0: + assert len(result) == 2 + assert sorted([x[0] for x in result if x[1] == 'inForce'][0]) == \ + [(1, ), (3, ), (4, ), (7, ), (9, )] + assert sorted([x[0] for x in result if x[1] == 'changeWithoutPreEffect'][0]) == \ + [(1, ), (2, ), (6, ), (7, )] + if idx == 1: + assert len(result) == 1 + assert sorted([x[0] for x in result if x[1] == 'inForce'][0]) == \ + [(1, ), (3, ), (4, ), (7, ), (9, )] diff --git a/tests/contrib.data_sources.standard/sources/test_plr.py b/tests/contrib.data_sources.standard/sources/test_plr.py index 33fe945136..8e4a8c7713 100644 --- a/tests/contrib.data_sources.standard/sources/test_plr.py +++ b/tests/contrib.data_sources.standard/sources/test_plr.py @@ -1247,3 +1247,90 @@ def test_handle_collection(plr_source_params, all_plr_result_session, real_estat ST_GeomFromWKB(%(ST_GeomFromWKB_1)s, %(ST_GeomFromWKB_2)s) ) '''.replace('\n', '').replace(' ', '') + + +def mock_return_value_handle_collection(items_list): + class PublicLawRestrictionTest(): + def __init__(self, law_status, legend_entry_id): + self.law_status = law_status + self.legend_entry_id = legend_entry_id + + class GeometryTest(): + def __init__(self, public_law_restriction): + self.public_law_restriction = public_law_restriction + + geometries = [] + for item in items_list: + geometries.append(GeometryTest(PublicLawRestrictionTest(item[0], item[1]))) + + class AllTest(): + def __init__(arg1, arg2): + pass + + def all(arg3): + return iter(geometries) + + class OptionsTest(): + def __init__(self, arg1, arg2): + pass + options = AllTest + + return OptionsTest + + +def get_return_vals_of_get_legend_entries_from_db(arg1, arg2, list_of_ids): + return_value = [] + for id in list_of_ids: + return_value.append((id, )) + return return_value + + +@pytest.mark.parametrize('idx,items_list', [ + (0, [ + ["inForce", 1], + ["changeWithoutPreEffect", 1], + ["changeWithoutPreEffect", 2], + ["inForce", 3], + ["inForce", 4], + ["inForce", 3], + ["changeWithoutPreEffect", 6], + ["inForce", 7], + ["changeWithoutPreEffect", 2], + ["inForce", 9], + ["changeWithoutPreEffect", 7] + ]), + (1, [ + ["inForce", 1], + ["inForce", 3], + ["inForce", 4], + ["inForce", 3], + ["inForce", 7], + ["inForce", 9], + ]) +]) +def test_collect_legend_entries_by_bbox(idx, items_list, plr_source_params): + with ( + patch.object( + DatabaseSource, + 'handle_collection', + mock_return_value_handle_collection(items_list) + ), + patch.object( + DatabaseSource, + 'get_legend_entries_from_db', + get_return_vals_of_get_legend_entries_from_db + ) + ): + source = DatabaseSource(**plr_source_params) + result = source.collect_legend_entries_by_bbox("", "") + + if idx == 0: + assert len(result) == 2 + assert sorted([x[0] for x in result if x[1] == 'inForce'][0]) == \ + [(1, ), (3, ), (4, ), (7, ), (9, )] + assert sorted([x[0] for x in result if x[1] == 'changeWithoutPreEffect'][0]) == \ + [(1, ), (2, ), (6, ), (7, )] + if idx == 1: + assert len(result) == 1 + assert sorted([x[0] for x in result if x[1] == 'inForce'][0]) == \ + [(1, ), (3, ), (4, ), (7, ), (9, )] From ef972291d51f41dde01d1558fb2dc5e98fd37fa1 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 16 Oct 2024 11:37:26 +0200 Subject: [PATCH 04/22] remove "keys()" --- .../contrib/data_sources/interlis_2_3/sources/plr.py | 4 ++-- pyramid_oereb/contrib/data_sources/standard/sources/plr.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py index 8a5fdacb51..21cb0edfe9 100644 --- a/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/interlis_2_3/sources/plr.py @@ -509,7 +509,7 @@ def collect_legend_entries_by_bbox(self, session, bbox): # Compile a list of unique legend entry ids for each law status legend_entry_ids = dict() for geometry in geometries: - if geometry.public_law_restriction.law_status not in legend_entry_ids.keys(): + if geometry.public_law_restriction.law_status not in legend_entry_ids: legend_entry_ids[geometry.public_law_restriction.law_status] = { geometry.public_law_restriction.legend_entry_id } @@ -520,7 +520,7 @@ def collect_legend_entries_by_bbox(self, session, bbox): # Retrieve legend entries legend_entries_from_db = [] - for law_status in legend_entry_ids.keys(): + for law_status in legend_entry_ids: legend_entries_from_db.append( [ self.get_legend_entries_from_db(session, list(legend_entry_ids[law_status])), diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index 0df7ad1431..c041c1caf1 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -650,7 +650,7 @@ def collect_legend_entries_by_bbox(self, session, bbox): # Compile a list of unique legend entry ids for each law status legend_entry_ids = dict() for geometry in geometries: - if geometry.public_law_restriction.law_status not in legend_entry_ids.keys(): + if geometry.public_law_restriction.law_status not in legend_entry_ids: legend_entry_ids[geometry.public_law_restriction.law_status] = { geometry.public_law_restriction.legend_entry_id } @@ -661,7 +661,7 @@ def collect_legend_entries_by_bbox(self, session, bbox): # Retrieve legend entries legend_entries_from_db = [] - for law_status in legend_entry_ids.keys(): + for law_status in legend_entry_ids: legend_entries_from_db.append( [ self.get_legend_entries_from_db(session, list(legend_entry_ids[law_status])), From 90e106fe9602eecf084808dc1ac09dc62381eb5c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:27:27 +0100 Subject: [PATCH 05/22] Update dependency sqlalchemy to v2.0.36 (#2051) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dcf901b44b..d5a4830b15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ recommend = [ "qrcode==7.4.2", "image==1.5.33", "shapely==2.0.6", - "SQLAlchemy==2.0.32", + "SQLAlchemy==2.0.36", "pyaml-env==1.2.1", "urllib3==2.2.2", "waitress==3.0.0", From a426685b0c0d4f22ad7bc325747406a9918705d0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:27:44 +0100 Subject: [PATCH 06/22] Update dependency urllib3 to v2.2.3 (#2054) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d5a4830b15..2db7f70a31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ recommend = [ "shapely==2.0.6", "SQLAlchemy==2.0.36", "pyaml-env==1.2.1", - "urllib3==2.2.2", + "urllib3==2.2.3", "waitress==3.0.0", "pyreproj==3.0.0", "mako-render==0.1.0", From f99a50030ea373b0b2a06bf9b16b74bdc7a9f218 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:28:01 +0100 Subject: [PATCH 07/22] Update dependency webtest to v3.0.1 (#2048) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2db7f70a31..ee5f47a1d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,7 +80,7 @@ testing = [ "pytest-ordering==0.6", "requests-mock==1.12.1", "responses==0.25.3", - "webtest==3.0.0", + "webtest==3.0.1", "pillow==10.4.0"] dev = [ "flake8==7.1.1", From 946bc58067c68bfa5e205a9fedbf212d874e6f76 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:28:25 +0100 Subject: [PATCH 08/22] Update dependency pypdf to v5 (#2055) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee5f47a1d4..e67cfe6672 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ Changelog = "https://github.com/openoereb/pyramid_oereb/blob/master/CHANGES.rst" [project.optional-dependencies] # Dependencies listed in "recommend" must be included in "no-version" without explicit version number recommend = [ - "pypdf==4.3.1", + "pypdf==5.1.0", "filetype==1.2.0", "geoalchemy2==0.15.2", "pyramid==2.0.2", From 300479f01cb57b90cbed40c78e9232b3afbb6bd7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:28:54 +0100 Subject: [PATCH 09/22] Update dependency qrcode to v8 (#2058) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e67cfe6672..6079c9fdef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ recommend = [ "geoalchemy2==0.15.2", "pyramid==2.0.2", "pyramid-debugtoolbar==4.12.1", - "qrcode==7.4.2", + "qrcode==8.0", "image==1.5.33", "shapely==2.0.6", "SQLAlchemy==2.0.36", From 2738acced4becffa74d7c9dcf7bffa0f8024b956 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:29:41 +0100 Subject: [PATCH 10/22] Update dependency pytest to v8.3.3 (#2053) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6079c9fdef..ea8b06cad5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ no-version = [ testing = [ "jsonschema==4.23.0", "lxml==5.3.0", - "pytest==8.3.2", + "pytest==8.3.3", "pytest-cov==5.0.0", "pytest-ordering==0.6", "requests-mock==1.12.1", From 4dc5325c7fe2eb0cc524a097b242c02ab0064191 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:37:06 +0100 Subject: [PATCH 11/22] Update dependency psycopg2 to v2.9.10 (#2062) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ea8b06cad5..084c4519e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,7 @@ dev = [ "pycodestyle==2.12.1", "Sphinx==7.4.7", "sphinx_rtd_theme==2.0.0", - "psycopg2==2.9.9", + "psycopg2==2.9.10", "mccabe==0.7.0", "c2c.template==2.4.2", "yappi"] From 1751e9e3f491d022b3896986d5ea9ec6b0ace0c2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:37:44 +0100 Subject: [PATCH 12/22] Update actions/checkout digest to 11bd719 (#2061) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 10 +++++----- .github/workflows/daily_check.yaml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7ff42ec7de..5f2d082638 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ jobs: name: Check style (lint) runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list - run: sudo apt update - run: sudo apt-get install libpq-dev @@ -18,7 +18,7 @@ jobs: name: Check style (git-attributes) runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list - run: sudo apt update - run: sudo apt-get install libpq-dev @@ -52,7 +52,7 @@ jobs: - '3.11' - '3.12' steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python v${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -78,7 +78,7 @@ jobs: name: Check federal data definitions runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list - run: sudo apt update - run: sudo apt-get install xsltproc @@ -95,7 +95,7 @@ jobs: if: github.ref == 'refs/heads/master' runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Make documentation run: | sudo rm /etc/apt/sources.list.d/*.list diff --git a/.github/workflows/daily_check.yaml b/.github/workflows/daily_check.yaml index 72d7c7abcc..198ee010b4 100644 --- a/.github/workflows/daily_check.yaml +++ b/.github/workflows/daily_check.yaml @@ -8,7 +8,7 @@ jobs: name: Check federal data definitions runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list - run: sudo apt update - run: sudo apt-get install xsltproc @@ -47,7 +47,7 @@ jobs: - python3.11 - python3.12 steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list - run: sudo apt update - run: sudo apt-get install libpq-dev From c8a98ed8b301aaa44cafc393b9bfbd49d646a1d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:38:38 +0100 Subject: [PATCH 13/22] Update JamesIves/github-pages-deploy-action action to v4.6.8 (#2049) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5f2d082638..4a1e7613ce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -103,7 +103,7 @@ jobs: sudo apt-get install libpq-dev make doc-html - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.6.3 + uses: JamesIves/github-pages-deploy-action@v4.6.8 with: branch: gh-pages # The branch the action should deploy to. folder: doc/build/html # The folder the action should deploy. From fbf59beda9beff7eab2826f5216cc2bb0f8f997b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:39:29 +0100 Subject: [PATCH 14/22] Update dependency ubuntu to v24 (#2057) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 12 ++++++------ .github/workflows/daily_check.yaml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4a1e7613ce..c20d0dfe66 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,7 @@ jobs: lint: name: Check style (lint) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list @@ -16,7 +16,7 @@ jobs: gitattributes: name: Check style (git-attributes) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list @@ -27,7 +27,7 @@ jobs: test-py: name: Test Python - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 services: # Label used to access the service container postgres: @@ -76,7 +76,7 @@ jobs: test-fed-data: name: Check federal data definitions - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list @@ -93,7 +93,7 @@ jobs: doc: name: Make and deploy documentation if: github.ref == 'refs/heads/master' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Make documentation @@ -110,7 +110,7 @@ jobs: build-and-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 needs: [lint, gitattributes] steps: - uses: actions/checkout@master diff --git a/.github/workflows/daily_check.yaml b/.github/workflows/daily_check.yaml index 198ee010b4..5145f33a22 100644 --- a/.github/workflows/daily_check.yaml +++ b/.github/workflows/daily_check.yaml @@ -6,7 +6,7 @@ on: jobs: test-fed-data: name: Check federal data definitions - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - run: sudo rm /etc/apt/sources.list.d/*.list @@ -22,7 +22,7 @@ jobs: test-py: name: Test Python - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 services: # Label used to access the service container postgres: From 1545caa6f2ca2da3f1d7e3ea098f4ed59bb02150 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:45:18 +0100 Subject: [PATCH 15/22] Update dependency waitress to v3.0.1 (#2063) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 084c4519e9..a20b0dec6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ recommend = [ "SQLAlchemy==2.0.36", "pyaml-env==1.2.1", "urllib3==2.2.3", - "waitress==3.0.0", + "waitress==3.0.1", "pyreproj==3.0.0", "mako-render==0.1.0", "requests==2.32.3", From 5d9db7b0ce9a64e41ef7c64b423adf748479f027 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:46:42 +0100 Subject: [PATCH 16/22] Update dependency pytest-cov to v6 (#2066) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a20b0dec6a..45c3517a34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ testing = [ "jsonschema==4.23.0", "lxml==5.3.0", "pytest==8.3.3", - "pytest-cov==5.0.0", + "pytest-cov==6.0.0", "pytest-ordering==0.6", "requests-mock==1.12.1", "responses==0.25.3", From a608fd69b9214aae700be70c540b0f6c702af71d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:47:14 +0100 Subject: [PATCH 17/22] Update dependency pillow to v11 (#2065) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 45c3517a34..7c6751d296 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,7 @@ testing = [ "requests-mock==1.12.1", "responses==0.25.3", "webtest==3.0.1", - "pillow==10.4.0"] + "pillow==11.0.0"] dev = [ "flake8==7.1.1", "Flake8-pyproject==1.2.3", From 8246e329c9133b842c1869bb0ae16b3589057c5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:47:41 +0100 Subject: [PATCH 18/22] Update python Docker tag to v3.13.0 (#2052) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8edd46b9f1..69ad332aa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12.5-bullseye +FROM python:3.13.0-bullseye ENV DEBIAN_FRONTEND=noninteractive From bdd2e34f36346b102d8a5b3b677023b31cfc810f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:10:40 +0100 Subject: [PATCH 19/22] Update dependency sphinx-rtd-theme to v3 (#2067) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7c6751d296..abecba69de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ dev = [ "pyflakes==3.2.0", "pycodestyle==2.12.1", "Sphinx==7.4.7", - "sphinx_rtd_theme==2.0.0", + "sphinx_rtd_theme==3.0.1", "psycopg2==2.9.10", "mccabe==0.7.0", "c2c.template==2.4.2", From 3e04f31a451c2ce4e9d801bd4465363d15baacae Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Mon, 4 Nov 2024 14:34:25 +0100 Subject: [PATCH 20/22] New release --- CHANGES.rst | 6 ++++++ doc/source/changes.rst | 6 +++++- pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 38f62b2b09..3e91a5d054 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,12 @@ Notes: ------ - This python package specifies the version numbers only of directly imported python packages. This approach may result in a build failure of older versions of the project if incompatibilities arise between imported packages over time. The build process of the master branch is regularly tested in an automatic process. +2.5.4 +----- +- New parameter default_toc_length to define a default table of content pages number (#2042) +- Add timeout in address source (#2043) +- Library upgrades (waitress, sqlalchemy, psycopg2, urllib3) + 2.5.3 ----- - Provide a general WMS verify certificate option diff --git a/doc/source/changes.rst b/doc/source/changes.rst index cf0c1542ca..d911234de9 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -6,12 +6,16 @@ Changes/Hints for migration This chapter will give you hints on how to handle version migration, in particular regarding what you may need to adapt in your project configuration, database etc. when upgrading to a new version. -Version 2.6.0 +Version 2.5.4 ------------- +Feature and maintenance release: + * New parameter 'expected_toc_length' allows to define a default table of content pages number avoiding a second call for the pdf extract in most cases. This value may be be set if most of the PDF extracts have the same number of TOC pages. It complements the 'compute_toc_pages' parameter. If the latter is set to true 'expected_toc_length' is ignored. +* Add timeout in address source (#2043) +* Library upgrades (waitress, sqlalchemy, psycopg2, urllib3) Version 2.5.3 ------------- diff --git a/pyproject.toml b/pyproject.toml index abecba69de..8026e0c8ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyramid_oereb" -version = "2.5.3" +version = "2.5.4" description = "pyramid_oereb, extension for pyramid web frame work to provide a basic server part for the oereb project" classifiers=[ From d18517009ea28ce98cde0c05dac1d6210cb8be0f Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Mon, 4 Nov 2024 14:43:24 +0100 Subject: [PATCH 21/22] Repair doc formatting --- doc/source/changes.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index d911234de9..a70a750f10 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -10,10 +10,10 @@ Version 2.5.4 ------------- Feature and maintenance release: -* New parameter 'expected_toc_length' allows to define a default table of content pages number avoiding a second -call for the pdf extract in most cases. This value may be be set if most of the PDF extracts have the same number -of TOC pages. It complements the 'compute_toc_pages' parameter. If the latter is set to true 'expected_toc_length' -is ignored. +* New parameter 'expected_toc_length' allows to define a default table of content pages number avoiding a + second call for the pdf extract in most cases. This value may be be set if most of the PDF extracts have + the same number of TOC pages. It complements the 'compute_toc_pages' parameter. If the latter is set to true, + 'expected_toc_length' is ignored. * Add timeout in address source (#2043) * Library upgrades (waitress, sqlalchemy, psycopg2, urllib3) From 176b4b3245ed243d2892c9a604e370751283a98f Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Mon, 4 Nov 2024 15:09:04 +0100 Subject: [PATCH 22/22] Release notes: add missing pr --- CHANGES.rst | 1 + doc/source/changes.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 3e91a5d054..60d47f73fb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,7 @@ Notes: ----- - New parameter default_toc_length to define a default table of content pages number (#2042) - Add timeout in address source (#2043) +- Optimize legend entries retrieval (#2050) - Library upgrades (waitress, sqlalchemy, psycopg2, urllib3) 2.5.3 diff --git a/doc/source/changes.rst b/doc/source/changes.rst index a70a750f10..00c41de280 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -15,6 +15,7 @@ Feature and maintenance release: the same number of TOC pages. It complements the 'compute_toc_pages' parameter. If the latter is set to true, 'expected_toc_length' is ignored. * Add timeout in address source (#2043) +* Optimize legend entries retrieval (#2050) * Library upgrades (waitress, sqlalchemy, psycopg2, urllib3) Version 2.5.3