Skip to content

Commit fe4717e

Browse files
committed
Bootstrap 2.0 migration docs for pydantic 2.0 change
1 parent 394c78f commit fe4717e

File tree

5 files changed

+65
-18
lines changed

5 files changed

+65
-18
lines changed

CHANGELOG.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Changelog
22

3-
## v1.8.0 - 2023-04-18
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
### Changed
10+
11+
- **BREAKING CHANGE** #236/240 - Upgrade to Pydantic v2.
12+
13+
## [1.8.0] - 2023-04-18
414

515
### Added
616

@@ -13,7 +23,7 @@
1323
- #77/#188 - `sync_from()` and `sync_to()` now return the `Diff` that was applied.
1424
- #211 - Loosened `packaging` and `structlog` library dependency constraints for broader compatibility.
1525

16-
## v1.7.0 - 2022-11-03
26+
## [1.7.0] - 2022-11-03
1727

1828
### Changed
1929

@@ -31,15 +41,15 @@
3141

3242
### Fixed
3343

34-
- #149 Limit redundant CI concurrency
44+
- #149 - Limit redundant CI concurrency
3545

36-
## v1.6.0 - 2022-07-09
46+
## [1.6.0] - 2022-07-09
3747

3848
### Changed
3949

4050
- #120 - Dropped support for Python 3.6, new minimum is Python 3.7
4151

42-
## v1.5.1 - 2022-06-30
52+
## [1.5.1] - 2022-06-30
4353

4454
### Added
4555

@@ -54,13 +64,13 @@
5464
- #115 - Fixed ReadTheDocs rendering pipeline
5565
- #118 - Fixed a regression in `DiffSync.get(modelname, identifiers)` introduced in 1.5.0
5666

57-
## v1.5.0 - 2022-06-07
67+
## [1.5.0] - 2022-06-07
5868

5969
### Added
6070

6171
- #106 - Add a new, optional, backend store based in Redis
6272

63-
## v1.4.3 - 2022-03-03
73+
## [1.4.3] - 2022-03-03
6474

6575
### Fixed
6676

@@ -70,25 +80,25 @@
7080

7181
### Changed
7282

73-
- #103 Update development dependencies
83+
- #103 - Update development dependencies
7484

75-
## v1.4.2 - 2022-02-28
85+
## [1.4.2] - 2022-02-28
7686

7787
**WARNING** - #90 inadvertently introduced a breaking API change in DiffSync 1.4.0 through 1.4.2 (#101); this change was reverted in #102 for DiffSync 1.4.3 and later. We recommend not using this release, and moving to 1.4.3 instead.
7888

7989
### Fixed
8090

8191
- #100 - Added explicit dependency on `packaging`.
8292

83-
## v1.4.1 - 2022-01-26
93+
## [1.4.1] - 2022-01-26
8494

8595
**WARNING** - #90 inadvertently introduced a breaking API change in DiffSync 1.4.0 through 1.4.2 (#101); this change was reverted in #102 for DiffSync 1.4.3 and later. We recommend not using this release, and moving to 1.4.3 instead.
8696

8797
### Fixed
8898

8999
- #95 - Removed optional dependencies on `sphinx`, `m2r2`, `sphinx-rtd-theme`, `toml`.
90100

91-
## v1.4.0 - 2022-01-24
101+
## [1.4.0] - 2022-01-24
92102

93103
**WARNING** - #90 inadvertently introduced a breaking API change in DiffSync 1.4.0 through 1.4.2 (#101); this change was reverted in #102 for DiffSync 1.4.3 and later. We recommend not using this release, and moving to 1.4.3 instead.
94104

@@ -117,19 +127,19 @@
117127
- #51 - Update minimum Pydantic version due to security advisory GHSA-5jqp-qgf6-3pvh
118128
- #63 - Fix type in Readme
119129

120-
## v1.3.0 - 2021-04-07
130+
## [1.3.0] - 2021-04-07
121131

122132
### Added
123133

124134
- #48 - added optional `callback` argument to `diff_from`/`diff_to`/`sync_from`/`sync_to` for use with progress reporting.
125135

126-
## v1.2.0 - 2020-12-08
136+
## [1.2.0] - 2020-12-08
127137

128138
### Added
129139

130140
- #45 - minimum Python version lowered from 3.7 to 3.6, also now tested against Python 3.9.
131141

132-
## v1.1.0 - 2020-12-01
142+
## [1.1.0] - 2020-12-01
133143

134144
### Added
135145

@@ -147,6 +157,6 @@
147157

148158
- #44 - On CRUD failure, do not generate an extraneous "success" log message in addition to the "failed" message
149159

150-
## v1.0.0 - 2020-10-23
160+
## [1.0.0] - 2020-10-23
151161

152162
Initial release
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
###############
2-
Getting Started
3-
###############
1+
#########
2+
Upgrading
3+
#########
44

55
.. mdinclude:: 01-getting-started.md

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Welcome to DiffSync's documentation!
99
getting_started/index
1010
core_engine/index
1111
examples/index
12+
upgrading/index
1213
api/diffsync
1314
license/index
1415

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Upgrading to 2.0
2+
3+
With diffsync 2.0, there a couple of breaking changes. What they are and how to deal with them is described in this document.
4+
5+
## Upgrade to Pydantic's major version 2
6+
7+
A [migration guide](https://docs.pydantic.dev/latest/migration/) is available in the Pydantic documentation. Here are the key things that may apply to your usage of diffsync:
8+
9+
- Any fields that are of type `Optional` now need to provide an explicit `None` default (you can use [bump-pydantic](https://github.com/pydantic/bump-pydantic) to deal with this automatically for the most part)
10+
11+
```python
12+
from typing import Optional
13+
14+
from diffsync import DiffSyncModel
15+
16+
# Before
17+
class Person(DiffSyncModel):
18+
_identifiers = ("name",)
19+
_attributes = ("age",)
20+
21+
name: str
22+
age: Optional[int]
23+
24+
# After
25+
class BetterPerson(DiffSyncModel)
26+
_identifiers = ("name",)
27+
_attributes = ("age",)
28+
29+
name: str
30+
age: Optional[int] = None
31+
```

docs/source/upgrading/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#########
2+
Upgrading
3+
#########
4+
5+
.. mdinclude:: 01-upgrading-to-2.0.md

0 commit comments

Comments
 (0)