Skip to content

Commit 104424d

Browse files
committed
Rename dsync/DSync to diffsync/DiffSync throughout
1 parent 7311415 commit 104424d

24 files changed

+458
-412
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
name: 🐛 Bug Report
3-
about: Report a reproducible bug in the current release of DSync
3+
about: Report a reproducible bug in the current release of DiffSync
44
---
55

66
### Environment
7-
* DSync version: <!-- Example: 1.0.0 -->
7+
* DiffSync version: <!-- Example: 1.0.0 -->
88
* Python version <!-- Example: 3.7.7 -->
99

1010
<!-- What happened instead? -->

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ about: Propose a new feature or enhancement
44
---
55

66
### Environment
7-
* DSync version: <!-- Example: 1.0.0 -->
7+
* DiffSync version: <!-- Example: 1.0.0 -->
88

99
<!--
1010
Describe in detail the new functionality you are proposing.
@@ -16,6 +16,6 @@ about: Propose a new feature or enhancement
1616
Convey an example use case for your proposed feature. Write from the
1717
perspective of a user who would benefit from the proposed
1818
functionality and describe how.
19-
--->
19+
-->
2020
### Use Case
2121

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# dsync
1+
# DiffSync
22

3-
DSync is a utility library that can be used to compare and synchronize different datasets.
3+
DiffSync is a utility library that can be used to compare and synchronize different datasets.
44

55
For example, it can be used to compare a list of devices from 2 inventories system and, if required, synchronize them in either direction.
66

77
```python
8-
A = DSyncSystemA()
9-
B = DSyncSystemB()
8+
A = DiffSyncSystemA()
9+
B = DiffSyncSystemB()
1010

1111
A.load()
1212
B.load()
@@ -24,24 +24,24 @@ A.sync_to(B)
2424

2525
# Getting Started
2626

27-
To be able to properly compare different datasets, DSync rely on a shared datamodel that both systems must use.
27+
To be able to properly compare different datasets, DiffSync relies on a shared datamodel that both systems must use.
2828

29-
## Define your model with DSyncModel
29+
## Define your model with DiffSyncModel
3030

31-
DSyncModel is based on [Pydantic](https://pydantic-docs.helpmanual.io/) and is using Python Typing to define the format of each attribute.
32-
Each DSyncModel class supports the following class-level attributes:
31+
DiffSyncModel is based on [Pydantic](https://pydantic-docs.helpmanual.io/) and is using Python Typing to define the format of each attribute.
32+
Each DiffSyncModel class supports the following class-level attributes:
3333
- `_modelname` (str) Define the type of the model, it's used to store the data internally (Mandatory)
3434
- `_identifiers` List(str) List of instance field names used as primary keys for this object (Mandatory)
3535
- `_shortname` List(str) List of instance field names to use for a shorter name (Optional)
3636
- `_attributes` List(str) List of additional instance field names for this object (Optional)
3737
- `_children` Dict: Dict of {`<modelname>`: `field_name`} to indicate how child objects should be stored. (Optional)
3838

39-
> DSyncModel must uniquely identified by their unique id, composed of all fields defined in `_identifiers`. DSyncModel do not support incremental IDs as primary key.
39+
> DiffSyncModel instances must be uniquely identified by their unique id, composed of all fields defined in `_identifiers`. DiffSyncModel does not support incremental IDs as primary key.
4040
4141
```python
42-
from dsync import DSyncModel
42+
from diffsync import DiffSyncModel
4343

44-
class Site(DSyncModel):
44+
class Site(DiffSyncModel):
4545
_modelname = "site"
4646
_identifiers = ("name",)
4747
_shortname = ()
@@ -54,16 +54,16 @@ class Site(DSyncModel):
5454
```
5555

5656
### Relationship between models.
57-
Currently the relationship between models are very loose, by design. Instead of storing an object, it's recommended to store the uid of an object and retrieve it from the store as needed.
57+
Currently the relationships between models are very loose by design. Instead of storing an object, it's recommended to store the uid of an object and retrieve it from the store as needed.
5858

59-
## DSync
59+
## DiffSync
6060

61-
A DSync object must reference each model available at the top of the object by its modelname and must have a `top_level` attribute defined to indicate how the diff and the synchronization should be done. In the example below, `"site"` is the only top level objects so the synchronization engine will check all sites and all children of each site (devices)
61+
A DiffSync object must reference each model available at the top of the object by its modelname and must have a `top_level` attribute defined to indicate how the diff and the synchronization should be done. In the example below, `"site"` is the only top level objects so the synchronization engine will check all sites and all children of each site (devices)
6262

6363
```python
64-
from dsync import DSync
64+
from diffsync import DiffSync
6565

66-
class BackendA(DSync):
66+
class BackendA(DiffSync):
6767

6868
site = Site
6969
device = Device
@@ -73,12 +73,12 @@ class BackendA(DSync):
7373

7474
It's up to the user to populate the internal cache with the appropriate data. In the example below we are using the `load()` method to populate the cache but it's not mandatory, it could be done differently
7575

76-
## Store data in a DSync object
76+
## Store data in a DiffSync object
7777

78-
To add a site to the local cache/store, you need to pass a valid DSyncModel object to the `add()` function.
78+
To add a site to the local cache/store, you need to pass a valid DiffSyncModel object to the `add()` function.
7979
```python
8080

81-
class BackendA(DSync):
81+
class BackendA(DiffSync):
8282
[...]
8383

8484
def load(self):
@@ -94,17 +94,17 @@ class BackendA(DSync):
9494

9595
## Update Remote system on Sync
9696

97-
To update a remote system, you need to extend your DSyncModel class(es) to define your own `create`, `update` and/or `delete` methods for each model.
98-
A DSyncModel instance stores a reference to its parent DSync class in case you need to use it to look up other model instances from the DSync's cache.
97+
To update a remote system, you need to extend your DiffSyncModel class(es) to define your own `create`, `update` and/or `delete` methods for each model.
98+
A DiffSyncModel instance stores a reference to its parent DiffSync class in case you need to use it to look up other model instances from the DiffSync's cache.
9999

100100
```python
101-
class Device(DSyncModel):
101+
class Device(DiffSyncModel):
102102
[...]
103103

104104
@classmethod
105-
def create(cls, dsync, ids, attrs):
105+
def create(cls, diffsync, ids, attrs):
106106
## TODO add your own logic here to create the device on the remote system
107-
return super().create(ids=ids, dsync=dsync, attrs=attrs)
107+
return super().create(ids=ids, diffsync=diffsync, attrs=attrs)
108108

109109
def update(self, attrs):
110110
## TODO add your own logic here to update the device on the remote system

0 commit comments

Comments
 (0)