tlpytools 0.2.8__tar.gz → 0.2.10__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 (60) hide show
  1. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/copilot-instructions.md +2 -2
  2. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/workflows/deploy.yml +1 -1
  3. {tlpytools-0.2.8 → tlpytools-0.2.10}/CHANGELOG.md +22 -0
  4. {tlpytools-0.2.8 → tlpytools-0.2.10}/DEVELOPER_GUIDE.md +2 -2
  5. {tlpytools-0.2.8 → tlpytools-0.2.10}/PKG-INFO +1 -1
  6. {tlpytools-0.2.8 → tlpytools-0.2.10}/pyproject.toml +1 -1
  7. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/__init__.py +1 -1
  8. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/orchestrator.py +92 -46
  9. {tlpytools-0.2.8 → tlpytools-0.2.10}/uv.lock +1 -1
  10. {tlpytools-0.2.8 → tlpytools-0.2.10}/.env.example +0 -0
  11. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/skills/README.md +0 -0
  12. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/skills/prepare-official-release/SKILL.md +0 -0
  13. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/workflows/code-formatting-pr.yml +0 -0
  14. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/workflows/code-formatting.yml +0 -0
  15. {tlpytools-0.2.8 → tlpytools-0.2.10}/.github/workflows/test.yml +0 -0
  16. {tlpytools-0.2.8 → tlpytools-0.2.10}/.gitignore +0 -0
  17. {tlpytools-0.2.8 → tlpytools-0.2.10}/.pre-commit-config.yaml +0 -0
  18. {tlpytools-0.2.8 → tlpytools-0.2.10}/.python-version +0 -0
  19. {tlpytools-0.2.8 → tlpytools-0.2.10}/ENVIRONMENT_VARIABLES.md +0 -0
  20. {tlpytools-0.2.8 → tlpytools-0.2.10}/Makefile +0 -0
  21. {tlpytools-0.2.8 → tlpytools-0.2.10}/README.md +0 -0
  22. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/adls_server.md +0 -0
  23. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/azure_credential_manager.md +0 -0
  24. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/diagrams/README.md +0 -0
  25. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/diagrams/orca_cloud_workflow.drawio +0 -0
  26. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/diagrams/orca_detailed_steps.drawio +0 -0
  27. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/diagrams/orca_file_structure.drawio +0 -0
  28. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/diagrams/orca_local_workflow.drawio +0 -0
  29. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/diagrams/orca_main_features.drawio +0 -0
  30. {tlpytools-0.2.8 → tlpytools-0.2.10}/docs/unified_logging.md +0 -0
  31. {tlpytools-0.2.8 → tlpytools-0.2.10}/requirements.txt +0 -0
  32. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/examples/batchtask.py +0 -0
  33. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/examples/data_files/example.csv +0 -0
  34. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/examples/mydataproject.py +0 -0
  35. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/examples/readwritedata.py +0 -0
  36. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/examples/unified_logging.py +0 -0
  37. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/adls_server.py +0 -0
  38. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/azure_credential.py +0 -0
  39. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/config.py +0 -0
  40. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/data.py +0 -0
  41. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/data_store.py +0 -0
  42. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/env_config.py +0 -0
  43. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/log.py +0 -0
  44. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/README.md +0 -0
  45. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/__init__.py +0 -0
  46. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/__main__.py +0 -0
  47. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/batch_task_runner.py +0 -0
  48. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/cli.py +0 -0
  49. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/orca_model_config_barebone.yaml +0 -0
  50. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/orca/orca_model_config_example.yaml +0 -0
  51. {tlpytools-0.2.8 → tlpytools-0.2.10}/src/tlpytools/sql_server.py +0 -0
  52. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/README.md +0 -0
  53. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/__init__.py +0 -0
  54. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/conftest.py +0 -0
  55. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/run_tests.py +0 -0
  56. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/test_azure_credential.py +0 -0
  57. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/test_basic.py +0 -0
  58. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/test_core.py +0 -0
  59. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/test_orca_integration.py +0 -0
  60. {tlpytools-0.2.8 → tlpytools-0.2.10}/tests/test_orca_unit.py +0 -0
@@ -98,8 +98,8 @@ Interpretation for agent PRs:
98
98
 
99
99
  Observed result:
100
100
  - Build succeeds and produces:
101
- - `dist/tlpytools-0.2.8.tar.gz`
102
- - `dist/tlpytools-0.2.8-py3-none-any.whl`
101
+ - `dist/tlpytools-0.2.10.tar.gz`
102
+ - `dist/tlpytools-0.2.10-py3-none-any.whl`
103
103
 
104
104
  ### 5) Run
105
105
  - ORCA CLI (module form):
@@ -4,7 +4,7 @@ on:
4
4
  workflow_dispatch:
5
5
  inputs:
6
6
  version:
7
- description: 'Version number to release (e.g., 0.2.8)'
7
+ description: 'Version number to release (e.g., 0.2.10)'
8
8
  required: true
9
9
  type: string
10
10
  prerelease:
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to TLPyTools will be documented in this file.
4
4
 
5
+ ## [0.2.10]
6
+
7
+ ### Fixed
8
+ - **`_copy_input_data`: `NameError` on glob-matched files with an `exclude` list:**
9
+ - The glob-pattern branch referenced an undefined variable `exclude_names` instead of the in-scope `entry_exclude` set
10
+ - Files matched by a glob pattern are now correctly skipped when their basename appears in the per-entry `exclude` list
11
+ - **`_upload_component_zips`: `IndexError`/`TypeError` when `steps` is empty:**
12
+ - `self.state.get("steps")[current_step_index - 1]` would raise if the steps list was empty or `None`
13
+ - Now guards with `steps = self.state.get("steps") or []` and uses conditional indexing; returns early with a log message if steps is empty
14
+ - **`sync_with_adls`: `TypeError` when keyword arguments are supplied:**
15
+ - `**kwargs` was forwarded to `_sync_with_cloud(self, direction: str)` which does not accept extra keyword arguments, causing a `TypeError` for any caller passing additional options
16
+ - The unused `**kwargs` forwarding has been removed from the `download` and `upload` branches
17
+
18
+ ## [0.2.9]
19
+
20
+ ### Changed
21
+ - **`initialize_scenario.input_data` now supports per-entry `exclude` lists:**
22
+ - Each source entry in an `input_data` category can now be a dict `{path: ..., exclude: [...]}` instead of a plain path string
23
+ - The `exclude` list contains file/directory names to skip when copying that specific source
24
+ - Applies to both directory copies (item-by-item scan) and glob-pattern matches
25
+ - Example: `- {path: shared/inputs, exclude: [large_file.csv, scratch/]}`
26
+
5
27
  ## [0.2.8]
6
28
 
7
29
  ### Changed
@@ -200,7 +200,7 @@ make check-all
200
200
  4. Click **"Run workflow"** button
201
201
  5. Fill in the required information:
202
202
  - **Branch**: Select `main` (or your release branch)
203
- - **Version number**: Enter the new version (e.g., `0.2.8`)
203
+ - **Version number**: Enter the new version (e.g., `0.2.10`)
204
204
  - **Is this a pre-release?**: Check if this is a pre-release version
205
205
 
206
206
  #### 3. Monitor the Release
@@ -219,7 +219,7 @@ After the workflow completes:
219
219
 
220
220
  ```bash
221
221
  # Verify the package is available on PyPI
222
- pip install tlpytools==0.2.8 # Replace with your version
222
+ pip install tlpytools==0.2.10 # Replace with your version
223
223
 
224
224
  # Test installation in a fresh environment
225
225
  python -c "import tlpytools; print(tlpytools.__version__)"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tlpytools
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: TransLink's Python Tools - A comprehensive toolkit for transportation modeling and forecasting
5
5
  Project-URL: Homepage, https://github.com/TransLinkForecasting/tlpytools
6
6
  Project-URL: Bug Tracker, https://github.com/TransLinkForecasting/tlpytools/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "tlpytools"
7
- version = "0.2.8"
7
+ version = "0.2.10"
8
8
  description = "TransLink's Python Tools - A comprehensive toolkit for transportation modeling and forecasting"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10.0, <3.13"
@@ -2,7 +2,7 @@
2
2
  TLPyTools - A set of tools for building models at the TransLink Forecasting Team
3
3
  """
4
4
 
5
- __version__ = "0.2.8"
5
+ __version__ = "0.2.10"
6
6
 
7
7
  # Core modules that should always be available (minimal dependencies)
8
8
  from . import log
@@ -1991,11 +1991,28 @@ class OrcaScenario:
1991
1991
  conflict_files = 0
1992
1992
 
1993
1993
  # Walk through the source directory and copy files
1994
- for root, _, files in os.walk(source_dir):
1994
+ for root, dirs, files in os.walk(source_dir):
1995
1995
  # Calculate the relative path to maintain directory structure
1996
1996
  rel_path = os.path.relpath(root, source_dir)
1997
1997
  target_subdir = os.path.join(target_dir, rel_path)
1998
1998
 
1999
+ # Prune excluded directories so os.walk does not descend into them.
2000
+ # Use forward slashes for consistent cross-platform pattern matching.
2001
+ if exclude_patterns:
2002
+ rel_path_fwd = rel_path.replace(os.sep, "/")
2003
+ pruned = []
2004
+ for d in dirs:
2005
+ dir_rel = (
2006
+ d if rel_path == "." else f"{rel_path_fwd}/{d}"
2007
+ ).replace(os.sep, "/")
2008
+ if not any(
2009
+ fnmatch.fnmatch(dir_rel, p)
2010
+ or fnmatch.fnmatch(dir_rel + "/", p)
2011
+ for p in exclude_patterns
2012
+ ):
2013
+ pruned.append(d)
2014
+ dirs[:] = pruned
2015
+
1999
2016
  # Create the target subdirectory if it doesn't exist
2000
2017
  os.makedirs(target_subdir, exist_ok=True)
2001
2018
 
@@ -2004,14 +2021,19 @@ class OrcaScenario:
2004
2021
  source_file = os.path.join(root, file)
2005
2022
  target_file = os.path.join(target_subdir, file)
2006
2023
 
2007
- # Apply include/exclude patterns if provided
2024
+ # Apply include/exclude patterns against the relative file path.
2025
+ rel_file = (
2026
+ file if rel_path == "." else f"{rel_path}/{file}"
2027
+ ).replace(os.sep, "/")
2008
2028
  if include_patterns and not any(
2009
- fnmatch.fnmatch(file, pattern) for pattern in include_patterns
2029
+ fnmatch.fnmatch(rel_file, pattern)
2030
+ for pattern in include_patterns
2010
2031
  ):
2011
2032
  skipped_files += 1
2012
2033
  continue
2013
2034
  if exclude_patterns and any(
2014
- fnmatch.fnmatch(file, pattern) for pattern in exclude_patterns
2035
+ fnmatch.fnmatch(rel_file, pattern)
2036
+ for pattern in exclude_patterns
2015
2037
  ):
2016
2038
  skipped_files += 1
2017
2039
  continue
@@ -2283,23 +2305,7 @@ class OrcaScenario:
2283
2305
  "Failed to copy log file %s to error dump: %s", log_name, e
2284
2306
  )
2285
2307
 
2286
- # 4. Copy outputs directory if it exists
2287
- outputs_dir = os.path.join(self.scenario_path, OUTPUTS_DIR)
2288
- if os.path.exists(outputs_dir):
2289
- outputs_dump_dir = os.path.join(error_dump_dir, OUTPUTS_DIR)
2290
- self.logger.debug("Copying outputs directory for error analysis")
2291
-
2292
- success = self.copy_template_directory(
2293
- source_dir=outputs_dir,
2294
- target_dir=outputs_dump_dir,
2295
- overwrite=True,
2296
- export_copy_log=False,
2297
- )
2298
-
2299
- if success:
2300
- error_info["dump_contents"].append(f"{OUTPUTS_DIR}/")
2301
-
2302
- # 5. Optionally copy entire scenario (excluding the error dump itself)
2308
+ # 4. Optionally copy entire scenario (excluding the error dump itself)
2303
2309
  if include_all_scenario:
2304
2310
  self.logger.debug("Including full scenario content in error dump")
2305
2311
  full_dump_dir = os.path.join(error_dump_dir, "full_scenario")
@@ -2315,14 +2321,14 @@ class OrcaScenario:
2315
2321
  if success:
2316
2322
  error_info["dump_contents"].append("full_scenario/")
2317
2323
 
2318
- # 6. Save error information
2324
+ # 5. Save error information
2319
2325
  error_info_file = os.path.join(error_dump_dir, "error_info.json")
2320
2326
  with open(error_info_file, "w", encoding="utf-8") as f:
2321
2327
  json.dump(error_info, f, indent=2, ensure_ascii=False)
2322
2328
 
2323
2329
  error_info["dump_contents"].append("error_info.json")
2324
2330
 
2325
- # 7. Create a zip archive of the error dump
2331
+ # 6. Create a zip archive of the error dump
2326
2332
  zip_name = f"error_dump_{step_name}_iter{iteration}_{timestamp}.zip"
2327
2333
  zip_path = os.path.join(error_dump_base, zip_name)
2328
2334
 
@@ -3148,13 +3154,23 @@ class OrcaOrchestrator:
3148
3154
  category_dir = os.path.join(input_data_dir, data_category)
3149
3155
  os.makedirs(category_dir, exist_ok=True)
3150
3156
 
3151
- # Process dict format and unfold to list
3152
- if isinstance(sources, dict):
3153
- sources = sources["sources"]
3157
+ # Normalise: sources may be a plain list of strings, or a list where each
3158
+ # entry is either a plain path string or a dict {path: ..., exclude: [...]}.
3159
+ # The exclude list applies only to the source entry it is defined on.
3160
+ if not isinstance(sources, list):
3161
+ sources = [sources]
3162
+
3163
+ for source_entry in sources:
3164
+ # Each entry is a plain path string OR {path: ..., exclude: [...]}
3165
+ if isinstance(source_entry, dict):
3166
+ source_path = source_entry.get("path", "")
3167
+ entry_exclude = set(source_entry.get("exclude", []))
3168
+ else:
3169
+ source_path = source_entry
3170
+ entry_exclude = set()
3154
3171
 
3155
- for source_path in sources:
3156
- if not isinstance(source_path, str):
3157
- self.logger.warning("Invalid source entry format: %s", source_path)
3172
+ if not isinstance(source_path, str) or not source_path:
3173
+ self.logger.warning("Invalid source entry format: %s", source_entry)
3158
3174
  continue
3159
3175
 
3160
3176
  # Resolve source path relative to scenario parent directory
@@ -3164,12 +3180,35 @@ class OrcaOrchestrator:
3164
3180
 
3165
3181
  if os.path.exists(full_source_path):
3166
3182
  if os.path.isdir(full_source_path):
3167
- # Copy directory
3168
- self.scenario.copy_template_directory(
3169
- source_dir=full_source_path,
3170
- target_dir=category_dir,
3171
- overwrite=False,
3172
- )
3183
+ if entry_exclude:
3184
+ # Copy directory contents item-by-item, skipping excluded names.
3185
+ for entry in os.scandir(full_source_path):
3186
+ if entry.name in entry_exclude:
3187
+ self.logger.debug(
3188
+ "Skipping excluded input data item: %s",
3189
+ entry.name,
3190
+ )
3191
+ continue
3192
+ target = os.path.join(category_dir, entry.name)
3193
+ if entry.is_dir():
3194
+ self.scenario.copy_template_directory(
3195
+ source_dir=entry.path,
3196
+ target_dir=target,
3197
+ overwrite=False,
3198
+ )
3199
+ else:
3200
+ self.scenario.copy_template_file(
3201
+ source_file=entry.path,
3202
+ target_file=target,
3203
+ overwrite=False,
3204
+ )
3205
+ else:
3206
+ # Copy directory
3207
+ self.scenario.copy_template_directory(
3208
+ source_dir=full_source_path,
3209
+ target_dir=category_dir,
3210
+ overwrite=False,
3211
+ )
3173
3212
  else:
3174
3213
  # Copy file
3175
3214
  self.scenario.copy_template_file(
@@ -3186,6 +3225,8 @@ class OrcaOrchestrator:
3186
3225
  matching_files = glob.glob(full_source_path)
3187
3226
  if matching_files:
3188
3227
  for file_path in matching_files:
3228
+ if os.path.basename(file_path) in entry_exclude:
3229
+ continue
3189
3230
  self.scenario.copy_template_file(
3190
3231
  source_file=file_path,
3191
3232
  target_file=os.path.join(
@@ -3841,7 +3882,7 @@ class OrcaOrchestrator:
3841
3882
  error_config = self.config.get("error_handling", {})
3842
3883
  create_dump = error_config.get("create_error_dump", True)
3843
3884
  include_full_scenario = error_config.get(
3844
- "include_all_files_in_dump", True
3885
+ "include_all_files_in_dump", False
3845
3886
  )
3846
3887
 
3847
3888
  if create_dump and self.mode == "cloud_production":
@@ -5407,8 +5448,14 @@ class OrcaOrchestrator:
5407
5448
  # Determine if this is scenario initialization or step completion
5408
5449
  current_iteration = self.state.get_display_iteration()
5409
5450
  current_step_index = self.state.get("current_step_index", 0)
5410
- step_name = self.state.get("steps")[current_step_index - 1]
5411
5451
  is_scenario_init = current_iteration == 1 and current_step_index == 0
5452
+ steps = self.state.get("steps") or []
5453
+ if not steps:
5454
+ self.logger.info("No steps defined, skipping component zips")
5455
+ return True
5456
+ step_name = (
5457
+ steps[current_step_index - 1] if current_step_index > 0 else None
5458
+ )
5412
5459
 
5413
5460
  for component_name in self.config["sub_components"].keys():
5414
5461
  component_dir = os.path.join(self.scenario_path, component_name)
@@ -7055,10 +7102,10 @@ class OrcaOrchestrator:
7055
7102
  return True
7056
7103
 
7057
7104
  elif direction == "download":
7058
- return self._sync_with_cloud(direction="download", **kwargs)
7105
+ return self._sync_with_cloud(direction="download")
7059
7106
 
7060
7107
  elif direction == "upload":
7061
- return self._sync_with_cloud(direction="upload", **kwargs)
7108
+ return self._sync_with_cloud(direction="upload")
7062
7109
 
7063
7110
  else:
7064
7111
  self.logger.error("Invalid sync direction: %s", direction)
@@ -7436,20 +7483,19 @@ class OrcaUtil:
7436
7483
  if output_dir and not os.path.exists(output_dir):
7437
7484
  os.makedirs(output_dir, exist_ok=True)
7438
7485
 
7439
- # Extract OMX file from zip
7486
+ # Stream directly from zip to output - avoids loading entire file into RAM
7440
7487
  with zipfile.ZipFile(zip_path, "r") as zf:
7441
7488
  try:
7442
- with zf.open(omx_path_in_zip) as omx_bytes:
7443
- byte_data = omx_bytes.read()
7489
+ with (
7490
+ zf.open(omx_path_in_zip) as omx_bytes,
7491
+ open(output_path, "wb") as f,
7492
+ ):
7493
+ shutil.copyfileobj(omx_bytes, f)
7444
7494
  except KeyError as err:
7445
7495
  raise FileNotFoundError(
7446
7496
  f"File '{omx_path_in_zip}' not found in zip archive '{zip_path}'"
7447
7497
  ) from err
7448
7498
 
7449
- # Write to output path
7450
- with open(output_path, "wb") as f:
7451
- f.write(byte_data)
7452
-
7453
7499
  return True
7454
7500
 
7455
7501
  except FileNotFoundError:
@@ -4649,7 +4649,7 @@ wheels = [
4649
4649
 
4650
4650
  [[package]]
4651
4651
  name = "tlpytools"
4652
- version = "0.2.8"
4652
+ version = "0.2.10"
4653
4653
  source = { editable = "." }
4654
4654
  dependencies = [
4655
4655
  { name = "azure-core" },
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
File without changes
File without changes