From 2e6e4fff1dc29ebca54cd50f254c4069793e15f9 Mon Sep 17 00:00:00 2001 From: Bee Webb Date: Thu, 1 Aug 2024 17:18:40 +0000 Subject: [PATCH] geo: Add example pip install command to geo warning https://github.com/OpenDataServices/flatten-tool/issues/445 --- CHANGELOG.md | 1 + flattentool/input.py | 7 ++++++- flattentool/json_input.py | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fec822..e4566f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Use custom warnings and exceptions [#450](https://github.com/OpenDataServices/flatten-tool/issues/450) [#451](https://github.com/OpenDataServices/flatten-tool/issues/451) +- Add example pip install command to geo dependencies missing warning [#445](https://github.com/OpenDataServices/flatten-tool/issues/445) ## [0.25.0] - 2024-07-05 diff --git a/flattentool/input.py b/flattentool/input.py index 00dcff4..e35cce2 100644 --- a/flattentool/input.py +++ b/flattentool/input.py @@ -42,6 +42,11 @@ from zipfile import BadZipfile as BadZipFile +GEO_DEPENDENCIES_MESSAGE = ( + "Install flattentool's optional geo dependencies to use geo features, for example pip install flattentool[geo]" +) + + class Cell: def __init__(self, cell_value, cell_location): self.cell_value = cell_value @@ -148,7 +153,7 @@ def convert_type(type_string, value, timezone=pytz.timezone("UTC"), convert_flag return feature.geometry else: warn( - "Install flattentool's optional geo dependencies to use geo features.", + GEO_DEPENDENCIES_MESSAGE, FlattenToolWarning, ) return str(value) diff --git a/flattentool/json_input.py b/flattentool/json_input.py index 3bb9881..bba3a5e 100644 --- a/flattentool/json_input.py +++ b/flattentool/json_input.py @@ -35,7 +35,7 @@ FlattenToolWarning, ) from flattentool.i18n import _ -from flattentool.input import path_search +from flattentool.input import GEO_DEPENDENCIES_MESSAGE, path_search from flattentool.schema import make_sub_sheet_name from flattentool.sheet import PersistentSheet @@ -404,7 +404,7 @@ def parse_json_dict( skip_type_and_coordinates = True else: warn( - "Install flattentool's optional geo dependencies to use geo features.", + GEO_DEPENDENCIES_MESSAGE, FlattenToolWarning, )