Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SOURCE_FILE=./resources/samples/input4_LatLon.pickle
# development settings
CONFIGURATION_FILE=./app-configuration.json
CONFIGURATION_FILE=./app-configuration.json
PRINT_CONFIGURATION=yes
9 changes: 7 additions & 2 deletions CHANGELOG_SDK.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Changelog SDK

## 2025-07 `v2.3.0`

- introduce app-setting-type `SECRET`

## 2024-xx

- addition of examples in app.py of importing functions from other .py files, creating artifacts, translating result back to a TrajectoryCollection

## 2024-09 `v2.2.1`

- exchange samples: generated by next MoveApps move2 to movingpandas translator app

## 2024-09 `v2.2.0`
## 2024-09 `v2.2.1`

- switch build from `micromamba` to `miniforge3`
- switch build from `micromamba` to [miniforge](https://github.com/conda-forge/miniforge)

## 2024-03 `v2.1.0`

Expand Down
2 changes: 2 additions & 0 deletions developer_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Critical parts of the SDK can be adjusted by `environment variables`. Keep in mi

- `SOURCE_FILE`: path to the input file for your App.
- `CONFIGURATION_FILE`: path to the configuration/settings file of your App (in [JSON](https://www.w3schools.com/js/js_json_intro.asp) format - must correspondent with the `settings` of your `appspec.json`, see [MoveApps parameters](https://docs.moveapps.org/#/copilot-python-sdk.md#moveapps-parameters) for an example of the `app-configuration.json` file).
- `PRINT_CONFIGURATION`: prints the configuration your App receives (`yes|no`)
- `MASK_SETTING_IDS`: A comma-separated list of setting IDs whose values will be hidden in the SDK logs

You can adjust these environment variables by adjusting the file `./.env`.

Expand Down
18 changes: 15 additions & 3 deletions sdk/moveapps_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,22 @@ def __load_config():
else:
config = os.environ.get('CONFIGURATION', '{}')
parsed = json.loads(config)

if os.environ.get("PRINT_CONFIGURATION", "no") == "yes":
logging.info(f'app will be started with configuration: {parsed}')
# Create a copy of parsed for logging
logging_config = parsed.copy()
# Get and process MASK_SETTING_IDS
mask_setting_ids = os.environ.get('MASK_SETTING_IDS', '').strip()
if mask_setting_ids:
# Split by comma and trim each value
mask_keys = [key.strip() for key in mask_setting_ids.split(',')]
# Replace values with "***masked***" for specified keys in the logging copy
for key in mask_keys:
if key in logging_config:
logging_config[key] = "***masked***"
logging.info(f'app will be started with configuration: {logging_config}')
return parsed

def __store_output(self, data):
logging.info(f'storing output: {data}')
pd.to_pickle(data, self.env.output_file)
Expand All @@ -74,4 +86,4 @@ def __store_error(self, error: Exception):

def __call_app(self, data):
outputs = self._pm.hook.execute(data=data, config=self.env.app_configuration)
return outputs[0]
return outputs[0]