diffsync 2.0.0__tar.gz → 2.0.1__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.
- {diffsync-2.0.0 → diffsync-2.0.1}/CHANGELOG.md +15 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/PKG-INFO +6 -5
- {diffsync-2.0.0 → diffsync-2.0.1}/README.md +3 -3
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/__init__.py +8 -13
- {diffsync-2.0.0 → diffsync-2.0.1}/pyproject.toml +3 -3
- {diffsync-2.0.0 → diffsync-2.0.1}/LICENSE +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/diff.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/enum.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/exceptions.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/helpers.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/logging.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/py.typed +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/store/__init__.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/store/local.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/store/redis.py +0 -0
- {diffsync-2.0.0 → diffsync-2.0.1}/diffsync/utils.py +0 -0
|
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
|
|
7
|
+
## [2.0.1]
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- #276 - Removed upper version boud for `structlog` dependency
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- #281 - Properly deprecated `DiffSync` class name
|
|
16
|
+
- #273 - Properly capitalized `DiffSync` in documentation
|
|
17
|
+
- #273 - Removed more mentions of `DiffSync` in favor of `Adapter`
|
|
18
|
+
- #274 - Fixed doc section title for getting started
|
|
19
|
+
- #269 - Fixed wording for a couple of docstrings
|
|
20
|
+
- #265 - Fixed readthedocs build
|
|
21
|
+
|
|
7
22
|
## [2.0.0]
|
|
8
23
|
|
|
9
24
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: diffsync
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Library to easily sync/diff/update 2 different data sources
|
|
5
5
|
Home-page: https://diffsync.readthedocs.io
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,12 +15,13 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
19
|
Provides-Extra: redis
|
|
19
20
|
Requires-Dist: colorama (>=0.4.3,<0.5.0)
|
|
20
21
|
Requires-Dist: packaging (>=21.3,<24.0)
|
|
21
22
|
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
22
23
|
Requires-Dist: redis (>=4.3,<5.0) ; extra == "redis"
|
|
23
|
-
Requires-Dist: structlog (>=20.1.0
|
|
24
|
+
Requires-Dist: structlog (>=20.1.0)
|
|
24
25
|
Requires-Dist: typing-extensions (>=4.0.1) ; python_version < "3.11"
|
|
25
26
|
Project-URL: Documentation, https://diffsync.readthedocs.io
|
|
26
27
|
Project-URL: Repository, https://github.com/networktocode/diffsync
|
|
@@ -45,16 +46,16 @@ DiffSync is at its most useful when you have multiple sources or sets of data to
|
|
|
45
46
|
|
|
46
47
|
DiffSync acts as an intermediate translation layer between all of the data sets you are diffing and/or syncing. In practical terms, this means that to use DiffSync, you will define a set of data models as well as the “adapters” needed to translate between each base data source and the data model. In Python terms, the adapters will be subclasses of the `Adapter` class, and each data model class will be a subclass of the `DiffSyncModel` class.
|
|
47
48
|
|
|
48
|
-

|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
Once you have used each adapter to load each data source into a collection of data model records, you can then ask DiffSync to “diff” the two data sets, and it will produce a structured representation of the difference between them. In Python, this is accomplished by calling the `diff_to()` or `diff_from()` method on one adapter and passing the other adapter as a parameter.
|
|
52
53
|
|
|
53
|
-

|
|
54
55
|
|
|
55
56
|
You can also ask DiffSync to “sync” one data set onto the other, and it will instruct your adapter as to the steps it needs to take to make sure that its data set accurately reflects the other. In Python, this is accomplished by calling the `sync_to()` or `sync_from()` method on one adapter and passing the other adapter as a parameter.
|
|
56
57
|
|
|
57
|
-

|
|
58
59
|
|
|
59
60
|
# Simple Example
|
|
60
61
|
|
|
@@ -17,16 +17,16 @@ DiffSync is at its most useful when you have multiple sources or sets of data to
|
|
|
17
17
|
|
|
18
18
|
DiffSync acts as an intermediate translation layer between all of the data sets you are diffing and/or syncing. In practical terms, this means that to use DiffSync, you will define a set of data models as well as the “adapters” needed to translate between each base data source and the data model. In Python terms, the adapters will be subclasses of the `Adapter` class, and each data model class will be a subclass of the `DiffSyncModel` class.
|
|
19
19
|
|
|
20
|
-

|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
Once you have used each adapter to load each data source into a collection of data model records, you can then ask DiffSync to “diff” the two data sets, and it will produce a structured representation of the difference between them. In Python, this is accomplished by calling the `diff_to()` or `diff_from()` method on one adapter and passing the other adapter as a parameter.
|
|
24
24
|
|
|
25
|
-

|
|
26
26
|
|
|
27
27
|
You can also ask DiffSync to “sync” one data set onto the other, and it will instruct your adapter as to the steps it needs to take to make sure that its data set accurately reflects the other. In Python, this is accomplished by calling the `sync_to()` or `sync_from()` method on one adapter and passing the other adapter as a parameter.
|
|
28
28
|
|
|
29
|
-

|
|
30
30
|
|
|
31
31
|
# Simple Example
|
|
32
32
|
|
|
@@ -28,7 +28,7 @@ from typing import (
|
|
|
28
28
|
Any,
|
|
29
29
|
Set,
|
|
30
30
|
)
|
|
31
|
-
import
|
|
31
|
+
from typing_extensions import deprecated
|
|
32
32
|
|
|
33
33
|
from pydantic import ConfigDict, BaseModel, PrivateAttr
|
|
34
34
|
import structlog # type: ignore
|
|
@@ -425,7 +425,7 @@ class DiffSyncModel(BaseModel):
|
|
|
425
425
|
|
|
426
426
|
|
|
427
427
|
class Adapter: # pylint: disable=too-many-public-methods
|
|
428
|
-
"""Class for storing a group of DiffSyncModel instances and diffing/synchronizing to another
|
|
428
|
+
"""Class for storing a group of DiffSyncModel instances and diffing/synchronizing to another Adapter instance."""
|
|
429
429
|
|
|
430
430
|
# In any subclass, you would add mapping of names to specific model classes here:
|
|
431
431
|
# modelname1 = MyModelClass1
|
|
@@ -480,7 +480,7 @@ class Adapter: # pylint: disable=too-many-public-methods
|
|
|
480
480
|
raise AttributeError(f'top_level references attribute "{name}" but it is not a DiffSyncModel subclass!')
|
|
481
481
|
|
|
482
482
|
def __str__(self) -> StrType:
|
|
483
|
-
"""String representation of
|
|
483
|
+
"""String representation of an Adapter."""
|
|
484
484
|
if self.type != self.name:
|
|
485
485
|
return f'{self.type} "{self.name}"'
|
|
486
486
|
return self.type
|
|
@@ -526,7 +526,7 @@ class Adapter: # pylint: disable=too-many-public-methods
|
|
|
526
526
|
return data
|
|
527
527
|
|
|
528
528
|
def str(self, indent: int = 0) -> StrType:
|
|
529
|
-
"""Build a detailed string representation of this
|
|
529
|
+
"""Build a detailed string representation of this Adapter."""
|
|
530
530
|
margin = " " * indent
|
|
531
531
|
output = ""
|
|
532
532
|
for modelname in self.top_level:
|
|
@@ -835,7 +835,7 @@ class Adapter: # pylint: disable=too-many-public-methods
|
|
|
835
835
|
def get_or_instantiate(
|
|
836
836
|
self, model: Type[DiffSyncModel], ids: Dict, attrs: Optional[Dict] = None
|
|
837
837
|
) -> Tuple[DiffSyncModel, bool]:
|
|
838
|
-
"""Attempt to get the object with provided identifiers or instantiate it with provided identifiers and attrs.
|
|
838
|
+
"""Attempt to get the object with provided identifiers or instantiate and add it with provided identifiers and attrs.
|
|
839
839
|
|
|
840
840
|
Args:
|
|
841
841
|
model: The DiffSyncModel to get or create.
|
|
@@ -848,7 +848,7 @@ class Adapter: # pylint: disable=too-many-public-methods
|
|
|
848
848
|
return self.store.get_or_instantiate(model=model, ids=ids, attrs=attrs)
|
|
849
849
|
|
|
850
850
|
def get_or_add_model_instance(self, obj: DiffSyncModel) -> Tuple[DiffSyncModel, bool]:
|
|
851
|
-
"""Attempt to get the object with provided obj identifiers or
|
|
851
|
+
"""Attempt to get the object with provided obj identifiers or add obj.
|
|
852
852
|
|
|
853
853
|
Args:
|
|
854
854
|
obj: An obj of the DiffSyncModel to get or add.
|
|
@@ -894,15 +894,10 @@ class Adapter: # pylint: disable=too-many-public-methods
|
|
|
894
894
|
return self.store.count(model=model)
|
|
895
895
|
|
|
896
896
|
|
|
897
|
-
|
|
897
|
+
@deprecated("'diffsync.DiffSync' is deprecated and will be removed with 2.1, use 'diffsync.Adapter' instead.")
|
|
898
|
+
class DiffSync(Adapter):
|
|
898
899
|
"""For backwards-compatibility, keep around the old name."""
|
|
899
900
|
|
|
900
|
-
warnings.warn(
|
|
901
|
-
"'diffsync.DiffSync' is deprecated and will be removed with 2.1, use 'diffsync.Adapter' instead.",
|
|
902
|
-
DeprecationWarning,
|
|
903
|
-
)
|
|
904
|
-
return Adapter(*args, **kwargs)
|
|
905
|
-
|
|
906
901
|
|
|
907
902
|
# DiffSyncModel references Adapter and Adapter references DiffSyncModel. Break the typing loop:
|
|
908
903
|
DiffSyncModel.model_rebuild()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "diffsync"
|
|
3
|
-
version = "v2.0.
|
|
3
|
+
version = "v2.0.1"
|
|
4
4
|
description = "Library to easily sync/diff/update 2 different data sources"
|
|
5
5
|
authors = ["Network to Code, LLC <info@networktocode.com>"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -18,7 +18,7 @@ include = [
|
|
|
18
18
|
[tool.poetry.dependencies]
|
|
19
19
|
python = ">=3.8,<4.0"
|
|
20
20
|
pydantic = "^2.0.0"
|
|
21
|
-
structlog = ">= 20.1.0
|
|
21
|
+
structlog = ">= 20.1.0"
|
|
22
22
|
packaging = ">= 21.3, < 24.0"
|
|
23
23
|
colorama = {version = "^0.4.3", optional = true}
|
|
24
24
|
redis = {version = "^4.3", optional = true}
|
|
@@ -42,7 +42,7 @@ mypy = "*"
|
|
|
42
42
|
pytest-cov = "*"
|
|
43
43
|
pytest-structlog = "*"
|
|
44
44
|
coverage = {extras = ["toml"], version = "*"}
|
|
45
|
-
Sphinx = "
|
|
45
|
+
Sphinx = "^6.0.0"
|
|
46
46
|
m2r2 = "*"
|
|
47
47
|
sphinx-rtd-theme = "*"
|
|
48
48
|
toml = "*"
|
|
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
|