python-ulid 2.3.0__tar.gz → 2.4.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 (27) hide show
  1. {python_ulid-2.3.0 → python_ulid-2.4.0}/CHANGELOG.rst +10 -1
  2. {python_ulid-2.3.0 → python_ulid-2.4.0}/PKG-INFO +4 -1
  3. {python_ulid-2.3.0 → python_ulid-2.4.0}/pyproject.toml +5 -0
  4. {python_ulid-2.3.0 → python_ulid-2.4.0}/tests/test_ulid.py +11 -0
  5. {python_ulid-2.3.0 → python_ulid-2.4.0}/ulid/__init__.py +3 -0
  6. {python_ulid-2.3.0 → python_ulid-2.4.0}/.github/workflows/lint-and-test.yml +0 -0
  7. {python_ulid-2.3.0 → python_ulid-2.4.0}/.github/workflows/publish.yml +0 -0
  8. {python_ulid-2.3.0 → python_ulid-2.4.0}/.gitignore +0 -0
  9. {python_ulid-2.3.0 → python_ulid-2.4.0}/.pre-commit-config.yaml +0 -0
  10. {python_ulid-2.3.0 → python_ulid-2.4.0}/.readthedocs.yml +0 -0
  11. {python_ulid-2.3.0 → python_ulid-2.4.0}/LICENSE +0 -0
  12. {python_ulid-2.3.0 → python_ulid-2.4.0}/README.rst +0 -0
  13. {python_ulid-2.3.0 → python_ulid-2.4.0}/docs/Makefile +0 -0
  14. {python_ulid-2.3.0 → python_ulid-2.4.0}/docs/requirements.txt +0 -0
  15. {python_ulid-2.3.0 → python_ulid-2.4.0}/docs/source/api.rst +0 -0
  16. {python_ulid-2.3.0 → python_ulid-2.4.0}/docs/source/changelog.rst +0 -0
  17. {python_ulid-2.3.0 → python_ulid-2.4.0}/docs/source/conf.py +0 -0
  18. {python_ulid-2.3.0 → python_ulid-2.4.0}/docs/source/index.rst +0 -0
  19. {python_ulid-2.3.0 → python_ulid-2.4.0}/hatch.toml +0 -0
  20. {python_ulid-2.3.0 → python_ulid-2.4.0}/logo.png +0 -0
  21. {python_ulid-2.3.0 → python_ulid-2.4.0}/tests/__init__.py +0 -0
  22. {python_ulid-2.3.0 → python_ulid-2.4.0}/tests/test_base32.py +0 -0
  23. {python_ulid-2.3.0 → python_ulid-2.4.0}/tests/test_cli.py +0 -0
  24. {python_ulid-2.3.0 → python_ulid-2.4.0}/ulid/__main__.py +0 -0
  25. {python_ulid-2.3.0 → python_ulid-2.4.0}/ulid/base32.py +0 -0
  26. {python_ulid-2.3.0 → python_ulid-2.4.0}/ulid/constants.py +0 -0
  27. {python_ulid-2.3.0 → python_ulid-2.4.0}/ulid/py.typed +0 -0
@@ -5,7 +5,15 @@ Changelog
5
5
 
6
6
  Versions follow `Semantic Versioning <http://www.semver.org>`_
7
7
 
8
- `2.3.0`_ - 2023-09-21
8
+ `2.4.0`_ - 2024-04-02
9
+ ---------------------
10
+
11
+ Added
12
+ ~~~~~
13
+ * :class:`.ULID` objects are now properly serialized when used as Pydantic types `@Avihais12344 <https://github.com/Avihais12344>`_.
14
+
15
+
16
+ `2.3.0`_ - 2024-03-21
9
17
  ---------------------
10
18
 
11
19
  Added
@@ -143,6 +151,7 @@ Changed
143
151
  * The package now has no external dependencies.
144
152
  * The test-coverage has been raised to 100%.
145
153
 
154
+ .. _2.4.0: https://github.com/mdomke/python-ulid/compare/2.3.0...2.4.0
146
155
  .. _2.3.0: https://github.com/mdomke/python-ulid/compare/2.2.0...2.3.0
147
156
  .. _2.2.0: https://github.com/mdomke/python-ulid/compare/2.1.0...2.2.0
148
157
  .. _2.1.0: https://github.com/mdomke/python-ulid/compare/2.0.0...2.1.0
@@ -1,7 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-ulid
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Universally unique lexicographically sortable identifier
5
+ Project-URL: Homepage, https://github.com/mdomke/python-ulid
6
+ Project-URL: Repository, https://github.com/mdomke/python-ulid
7
+ Project-URL: Documentation, https://python-ulid.readthedocs.io/
5
8
  Author-email: Martin Domke <mail@martindomke.net>
6
9
  License-Expression: MIT
7
10
  License-File: LICENSE
@@ -26,6 +26,11 @@ classifiers = [
26
26
  "Topic :: Software Development :: Libraries",
27
27
  ]
28
28
 
29
+ [project.urls]
30
+ Homepage = "https://github.com/mdomke/python-ulid"
31
+ Repository = "https://github.com/mdomke/python-ulid"
32
+ Documentation = "https://python-ulid.readthedocs.io/"
33
+
29
34
  [project.optional-dependencies]
30
35
  pydantic = [
31
36
  "pydantic>=2.0"
@@ -1,3 +1,4 @@
1
+ import json
1
2
  import time
2
3
  import uuid
3
4
  from collections.abc import Callable
@@ -177,3 +178,13 @@ def test_pydantic_protocol() -> None:
177
178
  for value in [b"not-enough", "not-enough"]:
178
179
  with pytest.raises(ValidationError):
179
180
  Model(ulid=value)
181
+
182
+ model_dict = model.model_dump()
183
+ ulid_from_dict = model_dict["ulid"]
184
+ assert ulid_from_dict == ulid
185
+ assert isinstance(ulid_from_dict, ULID)
186
+ assert Model(**model_dict) == model
187
+
188
+ model_json = model.model_dump_json()
189
+ assert isinstance(json.loads(model_json)["ulid"], str)
190
+ assert Model.model_validate_json(model_json) == model
@@ -261,6 +261,9 @@ class ULID:
261
261
  core_schema.no_info_plain_validator_function(ULID),
262
262
  ]
263
263
  ),
264
+ serialization=core_schema.to_string_ser_schema(
265
+ when_used="json-unless-none",
266
+ ),
264
267
  )
265
268
 
266
269
  @classmethod
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes