folio-migration-tools 1.9.10__tar.gz → 1.10.0__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 (68) hide show
  1. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/PKG-INFO +19 -28
  2. folio_migration_tools-1.10.0/pyproject.toml +146 -0
  3. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/__init__.py +3 -4
  4. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/__main__.py +53 -31
  5. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/circulation_helper.py +118 -108
  6. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/custom_dict.py +2 -2
  7. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/custom_exceptions.py +4 -5
  8. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/folder_structure.py +17 -7
  9. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/helper.py +8 -7
  10. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/holdings_helper.py +4 -3
  11. folio_migration_tools-1.10.0/src/folio_migration_tools/i18n_cache.py +79 -0
  12. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/library_configuration.py +77 -37
  13. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapper_base.py +45 -31
  14. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/courses_mapper.py +1 -1
  15. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/holdings_mapper.py +7 -3
  16. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/item_mapper.py +13 -26
  17. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/manual_fee_fines_mapper.py +1 -2
  18. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py +13 -11
  19. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/order_mapper.py +6 -5
  20. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py +3 -3
  21. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/user_mapper.py +47 -28
  22. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/conditions.py +82 -97
  23. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/holdings_statementsparser.py +13 -5
  24. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/hrid_handler.py +3 -2
  25. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/marc_file_processor.py +26 -24
  26. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/rules_mapper_base.py +56 -51
  27. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py +28 -17
  28. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py +68 -37
  29. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_report.py +18 -7
  30. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/batch_poster.py +285 -354
  31. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/bibs_transformer.py +14 -9
  32. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/courses_migrator.py +2 -3
  33. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/holdings_csv_transformer.py +23 -24
  34. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/holdings_marc_transformer.py +14 -24
  35. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/items_transformer.py +23 -34
  36. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/loans_migrator.py +67 -144
  37. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/manual_fee_fines_transformer.py +3 -3
  38. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/migration_task_base.py +47 -60
  39. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/orders_transformer.py +25 -42
  40. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/organization_transformer.py +9 -18
  41. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/requests_migrator.py +21 -24
  42. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/reserves_migrator.py +6 -5
  43. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/user_transformer.py +25 -20
  44. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/task_configuration.py +6 -7
  45. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/transaction_migration/legacy_loan.py +15 -27
  46. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/transaction_migration/legacy_request.py +1 -1
  47. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/translations/en.json +0 -7
  48. folio_migration_tools-1.9.10/LICENSE +0 -21
  49. folio_migration_tools-1.9.10/pyproject.toml +0 -94
  50. folio_migration_tools-1.9.10/src/folio_migration_tools/marc_rules_transformation/rules_mapper_authorities.py +0 -241
  51. folio_migration_tools-1.9.10/src/folio_migration_tools/migration_tasks/authority_transformer.py +0 -119
  52. folio_migration_tools-1.9.10/src/folio_migration_tools/test_infrastructure/mocked_classes.py +0 -406
  53. folio_migration_tools-1.9.10/src/folio_migration_tools/transaction_migration/__init__.py +0 -0
  54. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/README.md +0 -0
  55. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/colors.py +0 -0
  56. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/config_file_load.py +0 -0
  57. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/extradata_writer.py +0 -0
  58. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/i18n_config.py +0 -0
  59. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/__init__.py +0 -0
  60. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/notes_mapper.py +0 -0
  61. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/mapping_file_transformation/ref_data_mapping.py +0 -0
  62. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/__init__.py +0 -0
  63. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/loc_language_codes.xml +0 -0
  64. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/marc_rules_transformation/marc_reader_wrapper.py +0 -0
  65. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/migration_tasks/__init__.py +0 -0
  66. {folio_migration_tools-1.9.10/src/folio_migration_tools/test_infrastructure → folio_migration_tools-1.10.0/src/folio_migration_tools/transaction_migration}/__init__.py +0 -0
  67. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/transaction_migration/legacy_reserve.py +0 -0
  68. {folio_migration_tools-1.9.10 → folio_migration_tools-1.10.0}/src/folio_migration_tools/transaction_migration/transaction_result.py +0 -0
@@ -1,33 +1,25 @@
1
1
  Metadata-Version: 2.4
2
- Name: folio_migration_tools
3
- Version: 1.9.10
2
+ Name: folio-migration-tools
3
+ Version: 1.10.0
4
4
  Summary: A tool allowing you to migrate data from legacy ILS:s (Library systems) into FOLIO LSP
5
- License-Expression: MIT
6
- License-File: LICENSE
7
5
  Keywords: FOLIO,ILS,LSP,Library Systems,MARC21,Library data
8
- Author: Theodor Tolstoy
9
- Author-email: github.teddes@tolstoy.se
10
- Requires-Python: >=3.10,<4.0
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Programming Language :: Python :: 3.14
17
- Provides-Extra: docs
18
- Requires-Dist: argparse-prompt (>=0.0.5,<0.0.6)
19
- Requires-Dist: art (>=6.5,<7.0)
20
- Requires-Dist: deepdiff (>=6.2.3,<7.0.0)
21
- Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
22
- Requires-Dist: folio-data-import (>=0.4.1)
23
- Requires-Dist: folio-uuid (>=1.0.0,<2.0.0)
24
- Requires-Dist: folioclient (>=0.70.1,<0.71.0)
25
- Requires-Dist: pyaml (>=21.10.1,<22.0.0)
26
- Requires-Dist: pydantic (>=1.10.2,<2.0.0)
27
- Requires-Dist: pyhumps (>=3.7.3,<4.0.0)
28
- Requires-Dist: pymarc (>=5.2.3,<6.0.0)
29
- Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
30
- Requires-Dist: python-i18n (>=0.3.9,<0.4.0)
6
+ Author: Theodor Tolstoy, Lisa Sjögren, Brooks Travis, Jeremy Nelson, Clinton Bradford
7
+ Author-email: Theodor Tolstoy <github.teddes@tolstoy.se>, Brooks Travis <brooks.travis@gmail.com>
8
+ License-Expression: MIT
9
+ Requires-Dist: folioclient>=1.0.4
10
+ Requires-Dist: pyhumps>=3.7.3,<4.0.0
11
+ Requires-Dist: defusedxml>=0.7.1,<1.0.0
12
+ Requires-Dist: python-dateutil>=2.8.2,<3.0.0
13
+ Requires-Dist: folio-uuid>=1.0.0,<2.0.0
14
+ Requires-Dist: pymarc>=5.2.3,<6.0.0
15
+ Requires-Dist: pydantic>=2.12.3,<3.0.0
16
+ Requires-Dist: argparse-prompt>=0.0.5,<1.0.0
17
+ Requires-Dist: deepdiff>=6.2.3,<7.0.0
18
+ Requires-Dist: pyaml>=21.10.1,<22.0.0
19
+ Requires-Dist: python-i18n>=0.3.9,<1.0.0
20
+ Requires-Dist: art>=6.5,<7.0
21
+ Requires-Dist: folio-data-import>=0.5.0,<0.6.0
22
+ Requires-Python: >=3.10, <4.0
31
23
  Project-URL: Documentation, https://folio-migration-tools.readthedocs.io/en/latest/
32
24
  Project-URL: Homepage, https://github.com/folio-fse/folio_migration_tools
33
25
  Project-URL: Repository, https://github.com/FOLIO-FSE/folio_migration_tools
@@ -166,4 +158,3 @@ Translate all new strings, which begin with `TRANSLATE`, then commit.
166
158
  # Running the scripts
167
159
  For information on syntax, what files are needed and produced by the toolkit, refer to the documentation and example files in the [template repository](https://github.com/FOLIO-FSE/migration_repo_template). We are building out the docs section in this repository as well:[Documentation](https://folio-migration-tools.readthedocs.io/en/latest/)
168
160
  ¨
169
-
@@ -0,0 +1,146 @@
1
+ [project]
2
+ name = "folio_migration_tools"
3
+ version = "1.10.0"
4
+ description = "A tool allowing you to migrate data from legacy ILS:s (Library systems) into FOLIO LSP"
5
+ authors = [
6
+ {name = "Theodor Tolstoy", email = "github.teddes@tolstoy.se"},
7
+ {name = "Lisa Sjögren"},
8
+ {name = "Brooks Travis", email = "brooks.travis@gmail.com"},
9
+ {name = "Jeremy Nelson"},
10
+ {name = "Clinton Bradford"}
11
+ ]
12
+ license = "MIT"
13
+ readme = "README.md"
14
+ keywords = ["FOLIO", "ILS", "LSP", "Library Systems", "MARC21", "Library data"]
15
+ requires-python = ">=3.10,<4.0"
16
+ dependencies = [
17
+ "folioclient>=1.0.4",
18
+ "pyhumps>=3.7.3,<4.0.0",
19
+ "defusedxml>=0.7.1,<1.0.0",
20
+ "python-dateutil>=2.8.2,<3.0.0",
21
+ "folio-uuid>=1.0.0,<2.0.0",
22
+ "pymarc>=5.2.3,<6.0.0",
23
+ "pydantic>=2.12.3,<3.0.0",
24
+ "argparse-prompt>=0.0.5,<1.0.0",
25
+ "deepdiff>=6.2.3,<7.0.0",
26
+ "pyaml>=21.10.1,<22.0.0",
27
+ "python-i18n>=0.3.9,<1.0.0",
28
+ "art>=6.5,<7.0",
29
+ "folio-data-import>=0.5.0,<0.6.0",
30
+ ]
31
+
32
+ [dependency-groups]
33
+ dev = [
34
+ "pytest>=7.1.3,<8.0.0",
35
+ "coverage[toml]>=6.5.0,<7.0.0",
36
+ "pytest-cov>=4.0.0,<5.0.0",
37
+ "black>=22.10.0,<23.0.0",
38
+ "flake8>=7.3.0,<8.0.0",
39
+ "mypy>=0.982,<1.0.0",
40
+ "flake8-black>=0.3.6,<1.0.0",
41
+ "flake8-bugbear>=24.12.12,<25.0.0",
42
+ "flake8-bandit>=4.1.1,<5.0.0",
43
+ "flake8-isort>=6.1.2,<7.0.0",
44
+ "flake8-docstrings>=1.6.0,<2.0.0",
45
+ "darglint>=1.8.1,<2.0.0",
46
+ "types-requests>=2.28.11.17,<3.0.0",
47
+ "types-python-dateutil>=2.8.19.11,<3.0.0",
48
+ "ipykernel>=6.29.5,<7.0.0",
49
+ "pytest-asyncio>=0.23.0,<0.24.0",
50
+ "lxml>=6.0.2",
51
+ "pyrefly>=0.43.1",
52
+ "ruff>=0.14.13",
53
+ ]
54
+ docs = [
55
+ "m2r>=0.2.1,<0.3.0",
56
+ "myst-parser>=0.18.1,<4.0.0",
57
+ "sphinx>=6.0.0,<7.0.0",
58
+ "sphinx-autodoc-typehints>=1.17.0,<2.0.0",
59
+ "sphinx-rtd-theme>=1.0.0,<2.0.0",
60
+ "toml>=0.10.2,<0.11.0",
61
+ "sphinx-book-theme>=1.1.4,<2.0.0",
62
+ "sphinx-autobuild>=2024.10.3,<2025.0.0"
63
+ ]
64
+ [project.urls]
65
+ Documentation = "https://folio-migration-tools.readthedocs.io/en/latest/"
66
+ Homepage = "https://github.com/folio-fse/folio_migration_tools"
67
+ Repository = "https://github.com/FOLIO-FSE/folio_migration_tools"
68
+
69
+ [project.scripts]
70
+ folio-migration-tools = "folio_migration_tools.__main__:main"
71
+
72
+ [tool.coverage.report]
73
+ show_missing = false
74
+ fail_under = 10
75
+
76
+ [tool.coverage.paths]
77
+ source = ["src", "*/site-packages"]
78
+
79
+ [tool.coverage.run]
80
+ branch = true
81
+ source = ["folio_migration_tools"]
82
+
83
+ [build-system]
84
+ requires = ["uv_build>=0.8.6,<0.9.0"]
85
+ build-backend = "uv_build"
86
+
87
+ # Linting
88
+ [tool.ruff]
89
+ line-length = 99
90
+ exclude = [
91
+ ".bzr",
92
+ ".direnv",
93
+ ".eggs",
94
+ ".git",
95
+ ".git-rewrite",
96
+ ".hg",
97
+ ".ipynb_checkpoints",
98
+ ".mypy_cache",
99
+ ".nox",
100
+ ".pants.d",
101
+ ".pyenv",
102
+ ".pytest_cache",
103
+ ".pytype",
104
+ ".ruff_cache",
105
+ ".svn",
106
+ ".tox",
107
+ ".venv",
108
+ ".vscode",
109
+ "__pypackages__",
110
+ "_build",
111
+ "build",
112
+ "dist",
113
+ "site-packages",
114
+ "venv",
115
+ "**/tests/*.py",
116
+ "integration_test.py"
117
+ ]
118
+
119
+ indent-width = 4
120
+ target-version = "py310"
121
+
122
+ [tool.ruff.lint]
123
+ select = ["B", "B9", "C", "E", "F", "S", "W"]
124
+ ignore = ["E741", "S113"]
125
+
126
+ fixable = ["ALL"]
127
+ unfixable = []
128
+
129
+ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
130
+
131
+ [tool.ruff.lint.per-file-ignores]
132
+ "__init__.py" = ["E402", "F401"]
133
+ "**/{tests,docs,tools}/*" = ["E402"]
134
+ "**/test_*.py" = ["S101"]
135
+
136
+ [tool.ruff.format]
137
+ quote-style = "double"
138
+ indent-style = "space"
139
+ skip-magic-trailing-comma = false
140
+ line-ending = "auto"
141
+
142
+ docstring-code-format = false
143
+ docstring-code-line-length = "dynamic"
144
+
145
+ [tool.ruff.lint.mccabe]
146
+ max-complexity = 15
@@ -3,9 +3,8 @@ from typing import Protocol
3
3
 
4
4
  __version__ = importlib.metadata.version("folio_migration_tools")
5
5
 
6
+
6
7
  class StrCoercible(Protocol):
7
- def __repr__(self) -> str:
8
- ...
8
+ def __repr__(self) -> str: ...
9
9
 
10
- def __str__(self) -> str:
11
- ...
10
+ def __str__(self) -> str: ...
@@ -4,6 +4,7 @@ import logging
4
4
  import sys
5
5
  from os import environ
6
6
  from pathlib import Path
7
+ from warnings import warn
7
8
 
8
9
  import httpx
9
10
  import humps
@@ -33,23 +34,25 @@ def parse_args(args):
33
34
 
34
35
  parser.add_argument(
35
36
  "task_name",
36
- help=("Task name. Use one of: " f"{tasks_string}"),
37
+ help=(f"Task name. Use one of: {tasks_string}"),
37
38
  nargs="?" if "FOLIO_MIGRATION_TOOLS_TASK_NAME" in environ else None,
38
39
  prompt="FOLIO_MIGRATION_TOOLS_TASK_NAME" not in environ,
39
40
  default=environ.get("FOLIO_MIGRATION_TOOLS_TASK_NAME"),
40
41
  )
41
42
  parser.add_argument(
42
- "--folio_password", "--okapi_password",
43
+ "--folio_password",
44
+ "--okapi_password",
43
45
  help="password for the tenant in the configuration file",
44
46
  prompt="FOLIO_MIGRATION_TOOLS_OKAPI_PASSWORD" not in environ,
45
- default=environ.get("FOLIO_MIGRATION_TOOLS_OKAPI_PASSWORD"),
47
+ default=environ.get(
48
+ "FOLIO_MIGRATION_TOOLS_FOLIO_PASSWORD",
49
+ environ.get("FOLIO_MIGRATION_TOOLS_OKAPI_PASSWORD"),
50
+ ),
46
51
  secure=True,
47
52
  )
48
53
  parser.add_argument(
49
54
  "--base_folder_path",
50
- help=(
51
- "path to the base folder for this library. Built on migration_repo_template"
52
- ),
55
+ help=("path to the base folder for this library. Built on migration_repo_template"),
53
56
  prompt="FOLIO_MIGRATION_TOOLS_BASE_FOLDER_PATH" not in environ,
54
57
  default=environ.get("FOLIO_MIGRATION_TOOLS_BASE_FOLDER_PATH"),
55
58
  )
@@ -62,34 +65,43 @@ def parse_args(args):
62
65
  prompt=False,
63
66
  )
64
67
  parser.add_argument(
65
- "--version", "-V",
68
+ "--version",
69
+ "-V",
66
70
  help="Show the version of the FOLIO Migration Tools",
67
71
  action="store_true",
68
72
  prompt=False,
69
73
  )
70
74
  return parser.parse_args(args)
71
75
 
76
+
72
77
  def prep_library_config(args):
73
- config_file_humped = merge_load(args.configuration_path)
74
- config_file_humped["libraryInformation"]["okapiPassword"] = args.folio_password
75
- config_file_humped["libraryInformation"]["baseFolder"] = args.base_folder_path
76
- config_file = humps.decamelize(config_file_humped)
77
- library_config = LibraryConfiguration(**config_file["library_information"])
78
- if library_config.ecs_tenant_id:
79
- library_config.is_ecs = True
80
- if library_config.ecs_tenant_id and not library_config.ecs_central_iteration_identifier:
81
- print(
82
- "ECS tenant ID is set, but no central iteration identifier is provided. "
83
- "Please provide the central iteration identifier in the configuration file."
84
- )
85
- sys.exit("ECS Central Iteration Identifier Not Found")
86
- return config_file, library_config
78
+ config_file_humped = merge_load(args.configuration_path)
87
79
 
88
- def print_version(args):
89
- if "-V" in args or "--version" in args:
80
+ # Only set folioPassword if neither folioPassword nor okapiPassword exist in config
81
+ # The Pydantic validator will handle backward compatibility for existing okapiPassword
82
+ if (
83
+ "folioPassword" not in config_file_humped["libraryInformation"]
84
+ and "okapiPassword" not in config_file_humped["libraryInformation"]
85
+ ):
86
+ config_file_humped["libraryInformation"]["folioPassword"] = args.folio_password
87
+
88
+ config_file_humped["libraryInformation"]["baseFolder"] = args.base_folder_path
89
+ config_file = humps.decamelize(config_file_humped)
90
+ library_config = LibraryConfiguration(**config_file["library_information"])
91
+ if library_config.ecs_tenant_id:
92
+ library_config.is_ecs = True
93
+ if library_config.ecs_tenant_id and not library_config.ecs_central_iteration_identifier:
90
94
  print(
91
- f"FOLIO Migration Tools: {metadata.version('folio_migration_tools')}"
95
+ "ECS tenant ID is set, but no central iteration identifier is provided. "
96
+ "Please provide the central iteration identifier in the configuration file."
92
97
  )
98
+ sys.exit("ECS Central Iteration Identifier Not Found")
99
+ return config_file, library_config
100
+
101
+
102
+ def print_version(args):
103
+ if "-V" in args or "--version" in args:
104
+ print(f"FOLIO Migration Tools: {metadata.version('folio_migration_tools')}")
93
105
  sys.exit(0)
94
106
  return None
95
107
 
@@ -115,6 +127,14 @@ def main():
115
127
  i18n.set("locale", args.report_language)
116
128
  config_file, library_config = prep_library_config(args)
117
129
  try:
130
+ if args.task_name == "AuthorityTransformer":
131
+ warn(
132
+ "The AuthorityTransformer has been removed."
133
+ " Please update your configuration accordingly."
134
+ " Use Data Import to load authority records.",
135
+ DeprecationWarning,
136
+ stacklevel=2,
137
+ )
118
138
  migration_task_config = next(
119
139
  t for t in config_file["migration_tasks"] if t["name"] == args.task_name
120
140
  )
@@ -122,7 +142,7 @@ def main():
122
142
  task_names = [t.get("name", "") for t in config_file["migration_tasks"]]
123
143
  print(
124
144
  f"Referenced task name {args.task_name} not found in the "
125
- f'configuration file. Use one of {", ".join(task_names)}'
145
+ f"configuration file. Use one of {', '.join(task_names)}"
126
146
  "\nHalting..."
127
147
  )
128
148
  sys.exit("Task Name Not Found")
@@ -134,13 +154,15 @@ def main():
134
154
  )
135
155
  except StopIteration:
136
156
  print(
137
- f'Referenced task {migration_task_config["migration_task_type"]} '
157
+ f"Referenced task {migration_task_config['migration_task_type']} "
138
158
  "is not a valid option. Update your task to incorporate "
139
159
  f"one of {json.dumps([tc.__name__ for tc in task_classes], indent=4)}"
140
160
  )
141
161
  sys.exit("Task Type Not Found")
142
162
  try:
143
- logging.getLogger("httpx").setLevel(logging.WARNING) # Exclude info messages from httpx
163
+ logging.getLogger("httpx").setLevel(
164
+ logging.WARNING
165
+ ) # Exclude info messages from httpx
144
166
  with FolioClient(
145
167
  library_config.gateway_url,
146
168
  library_config.tenant_id,
@@ -161,16 +183,15 @@ def main():
161
183
  logging.critical(json_error)
162
184
  print(json_error.doc)
163
185
  print(
164
- f"\n{json_error}"
165
- f"\nError parsing the above JSON mapping or configruation file. Halting."
186
+ f"\n{json_error}\nError parsing the above JSON mapping or configruation file. Halting."
166
187
  )
167
188
  sys.exit("Invalid JSON")
168
189
  except ValidationError as e:
169
- print(e.json())
190
+ print(json.dumps(e.errors(), indent=2))
170
191
  print("Validation errors in configuration file:")
171
192
  print("==========================================")
172
193
 
173
- for validation_message in json.loads(e.json()):
194
+ for validation_message in e.errors():
174
195
  print(
175
196
  f"{validation_message['msg']}\t"
176
197
  f"{', '.join(humps.camelize(str(x)) for x in validation_message['loc'])}"
@@ -199,6 +220,7 @@ def main():
199
220
  sys.exit(ee.__class__.__name__)
200
221
  sys.exit(0)
201
222
 
223
+
202
224
  def inheritors(base_class):
203
225
  subclasses = set()
204
226
  work = [base_class]