lastuuid 0.2.1__cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl → 0.2.2__cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl

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.

Potentially problematic release.


This version of lastuuid might be problematic. Click here for more details.

lastuuid/dummies.py CHANGED
@@ -1,4 +1,9 @@
1
- """A dummy uuid usefull for unit testing purpose."""
1
+ """
2
+ A dummy uuid usefull for unit testing purpose.
3
+
4
+ UUID generated here are full of 0, they does not respect any kind of UUID version,
5
+ they remove a bit of cognitive load while testing.
6
+ """
2
7
 
3
8
  from typing import Iterator
4
9
  from uuid import UUID
@@ -19,6 +24,43 @@ next_id = gen_id()
19
24
  def uuidgen(i: int = 0, j: int = 0, k: int = 0, x: int = 0, y: int = 0) -> UUID:
20
25
  """
21
26
  A UUID generator that makes UUIDs more readable for humans.
27
+
28
+ # Generate autoincrement UUID that you need to predict
29
+
30
+ Sometime you prepare fixtures with well known UUID and you want to repeat them,
31
+
32
+ uuidgen(1) is more readable that UUID('00000001-0000-0000-0000-000000000000'),
33
+ this is why this function is made for.
34
+ Every section of the uuid can be filled out using `i`, `j`, `k`, `x`, `y` but,
35
+ I personnaly never use more than `i` and `j`.
36
+
37
+ ```python
38
+ >>> from lastuuid.dummies import uuidgen
39
+ >>> uuidgen(1)
40
+ UUID('00000001-0000-0000-0000-000000000000')
41
+ >>> uuidgen(1, 2)
42
+ UUID('00000001-0002-0000-0000-000000000000')
43
+ >>> uuidgen(1, 2, 3, 4, 5)
44
+ UUID('00000001-0002-0003-0004-000000000005')
45
+ ```
46
+
47
+ ```{tip}
48
+ if you don't want a dependency for that, the standard library let you write
49
+ UUID(int=1) which produce UUID('00000000-0000-0000-0000-000000000001').
50
+ ```
51
+
52
+ # Generate autoincrement UUID that you don't need to predict
53
+
54
+ Without any parameter, it will generate UUID where the last bits are incremented.
55
+
56
+ ```python
57
+ >>> from lastuuid.dummies import uuidgen
58
+ >>> uuidgen()
59
+ UUID('00000000-0000-0000-0000-000000000001')
60
+ >>> uuidgen()
61
+ UUID('00000000-0000-0000-0000-000000000002')
62
+ ```
63
+
22
64
  """
23
65
  if i == 0 and y == 0:
24
66
  y = next(next_id)
lastuuid/utils.py CHANGED
@@ -1,13 +1,24 @@
1
1
  """
2
2
  Utilities methods that may be used for database querying purpose.
3
3
 
4
- uuid7 are timestamped sorted, so there are a good solution for generating
5
- primary keys. Because they contains a date time, a UUID range can be compute
4
+ Because UUIDv7 are timestamped ordered and monotonically increasing,
5
+ there are a good solution for generating primary keys.
6
+
7
+ The design of UUIDv7 feet well with the design of BTree.
8
+
9
+ Because they contains a date time, a UUID range can be compute
6
10
  in order to retrieve UUIDs generated at a given time.
7
11
 
8
- Note that in any distribyted system, only using a datetime, or an uuid
9
- has its limit to properly sort items. This documentation does not cover
10
- the design data intensive application book ;).
12
+
13
+ ```{important}
14
+ In a distributed system, relying solely on a datetime or UUIDv7 for sorting
15
+ has limitations.
16
+ While UUIDv7 ensures sequential ordering on a single machine, there is no guarantee
17
+ that a UUIDv7 generated later on one machine will be greater than one generated
18
+ earlier on another machine.
19
+
20
+ This documentation does not cover the book Designing Data-Intensive Applications ;).
21
+ ```
11
22
  """
12
23
 
13
24
  from datetime import UTC, date, datetime, time, timedelta
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lastuuid
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Rust
@@ -35,8 +35,10 @@ Project-URL: Changelog, https://mardiros.github.io/lastuuid/changelog.html
35
35
  UUID type is awesome, but, at the moment, the UUID type in the standard library
36
36
  does not support the uuid7 format.
37
37
 
38
- You may find plenty of library that implement uuid7, but they have downside,
39
- such has ignoring pull request to fix issues, or not compatible with Pydantic.
38
+ **lastuuid** provide **fast UUIDv7 generation** made by the
39
+ [rust crate uuid7](https://crates.io/crates/uuid7) **compatible with Pydantic**.
40
+
41
+ It has additional features that may helps for testing or inspecting UUIDv7.
40
42
 
41
43
  ```{note}
42
44
  lastuuid is a developer joke based on the nature of UUIDv7,
@@ -70,7 +72,7 @@ from pydantic import BaseModel, Field
70
72
  from lastuuid import uuid7
71
73
 
72
74
 
73
- class Dummy(BaseModel):
75
+ class Event(BaseModel):
74
76
  id: UUID = Field(default_factory=uuid7)
75
77
 
76
78
  ```
@@ -0,0 +1,9 @@
1
+ lastuuid-0.2.2.dist-info/METADATA,sha256=cgW4wG5bSCTox0hUYk6JtHSKJvmATHDsZWYAfK4wMs0,3425
2
+ lastuuid-0.2.2.dist-info/WHEEL,sha256=K1bjXPMS8YPrfm-NniZ56pKt35BhcSuEwnrrKNTyUdw,121
3
+ lastuuid/__init__.py,sha256=QwhIMAj4P8cB98_6Qj3mUceQXkHtS9G3bNfGrgb-R1w,122
4
+ lastuuid/lastuuid.pyi,sha256=s-ll8KBbUeUUqQz087pADg3Y3HLnOikty6dpmYC8fMs,340
5
+ lastuuid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ lastuuid/dummies.py,sha256=qXs-fm8oztJ0sUhX9H8If66u5H1JPq6Vx28Dczy5zbc,1883
7
+ lastuuid/utils.py,sha256=4770hKz093r6psV4zczXwQKnfCBjS-l_NEnJ3laZpIQ,2834
8
+ lastuuid/lastuuid.cpython-310-i386-linux-gnu.so,sha256=lXpY462KrZAEoD2fuaKuI58f6COiqEEeIBspmZ1HYYM,547004
9
+ lastuuid-0.2.2.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- lastuuid-0.2.1.dist-info/METADATA,sha256=L3PIVuRQrjOFjyF-JbNsSRYNYAWdEn49d72veTLBOyY,3363
2
- lastuuid-0.2.1.dist-info/WHEEL,sha256=K1bjXPMS8YPrfm-NniZ56pKt35BhcSuEwnrrKNTyUdw,121
3
- lastuuid/__init__.py,sha256=QwhIMAj4P8cB98_6Qj3mUceQXkHtS9G3bNfGrgb-R1w,122
4
- lastuuid/lastuuid.pyi,sha256=s-ll8KBbUeUUqQz087pADg3Y3HLnOikty6dpmYC8fMs,340
5
- lastuuid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- lastuuid/dummies.py,sha256=0YcdycGKVya59RUnBZSlJg49WeYwjxBcVZKEwuflu4E,520
7
- lastuuid/utils.py,sha256=PPxM7WYP_Bjy1uXn_dg6rc1GMVEkleh2Z0vjb91XXUo,2538
8
- lastuuid/lastuuid.cpython-310-i386-linux-gnu.so,sha256=q8ECbnkeTMEyFNnR_hiWaSRuVRwfnAFp2IPZqLYgZuc,547000
9
- lastuuid-0.2.1.dist-info/RECORD,,