Skip to content

Commit

Permalink
Merge pull request #251 from networktocode/release-1.9.1
Browse files Browse the repository at this point in the history
Release 1.10.0
  • Loading branch information
Kircheneer authored Nov 16, 2023
2 parents e5a41be + d3b3ee5 commit 44d7838
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: "ubuntu-20.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v1.10.0 - 2023-11-16

### Fixed

- #249 - Fixes natural deletion order flag
- #247 - Fixes underspecified typing_extensions dependency

### Changed

- #247 - Deprecates Python 3.7

## v1.9.0 - 2023-10-16

### Added
Expand Down
7 changes: 6 additions & 1 deletion diffsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import sys
from inspect import isclass
from typing import Callable, ClassVar, Dict, List, Optional, Tuple, Type, Union, Any, Set
from typing_extensions import Self

from pydantic import BaseModel, PrivateAttr
import structlog # type: ignore
Expand All @@ -29,6 +29,11 @@
from diffsync.store.local import LocalStore
from diffsync.utils import get_path, set_key, tree_string

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self

# This workaround is used because we are defining a method called `str` in our class definition, which therefore renders
# the builtin `str` type unusable.
StrType = str
Expand Down
4 changes: 3 additions & 1 deletion diffsync/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,13 @@ def sync_diff_element(self, element: DiffElement, parent_model: Optional["DiffSy
natural_deletion_order = bool(dst_model.model_flags & DiffSyncModelFlags.NATURAL_DELETION_ORDER)
skip_children = bool(dst_model.model_flags & DiffSyncModelFlags.SKIP_CHILDREN_ON_DELETE)

# Recurse through children to delete if we are supposed to delete the current diff element
changed = False
if natural_deletion_order and self.action == DiffSyncActions.DELETE and not skip_children:
for child in element.get_children():
changed |= self.sync_diff_element(child, parent_model=dst_model)

# Sync the current model - this will delete the current model if self.action is DELETE
changed, modified_model = self.sync_model(src_model=src_model, dst_model=dst_model, ids=ids, attrs=attrs)
dst_model = modified_model or dst_model

Expand All @@ -396,7 +398,7 @@ def sync_diff_element(self, element: DiffElement, parent_model: Optional["DiffSy

self.incr_elements_processed()

if not natural_deletion_order:
if not natural_deletion_order or self.action is not DiffSyncActions.DELETE:
for child in element.get_children():
changed |= self.sync_diff_element(child, parent_model=dst_model)

Expand Down
107 changes: 8 additions & 99 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "diffsync"
version = "1.9.0"
version = "1.10.0"
description = "Library to easily sync/diff/update 2 different data sources"
authors = ["Network to Code, LLC <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -16,12 +16,14 @@ include = [
]

[tool.poetry.dependencies]
python = "^3.7"
python = ">=3.8,<4.0"
pydantic = "^1.7.4,!=1.8,!=1.8.1"
structlog = ">= 20.1.0, < 23.0.0"
packaging = ">= 21.3, < 24.0"
colorama = {version = "^0.4.3", optional = true}
redis = {version = "^4.3", optional = true}
# typing.Self introduced in 3.11
typing-extensions = { version = ">=4.0.1", python = "<3.11" }

[tool.poetry.extras]
redis = ["redis"]
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def is_truthy(arg):


# Can be set to a separate Python version to be used for launching or building image
PYTHON_VER = os.getenv("PYTHON_VER", os.getenv("TRAVIS_PYTHON_VERSION", "3.7"))
PYTHON_VER = os.getenv("PYTHON_VER", "3.8")
# Name of the docker image/image
NAME = os.getenv("IMAGE_NAME", f"diffsync-py{PYTHON_VER}")
# Tag for the image
Expand Down
Loading

0 comments on commit 44d7838

Please sign in to comment.