Skip to content

Add simple UUID module with uuid4()#1137

Open
dpgeorge wants to merge 3 commits into
micropython:masterfrom
dpgeorge:add-uuid
Open

Add simple UUID module with uuid4()#1137
dpgeorge wants to merge 3 commits into
micropython:masterfrom
dpgeorge:add-uuid

Conversation

@dpgeorge

Copy link
Copy Markdown
Member

Summary

This PR pulls in @andrewleech 's minimal UUID implementation from https://github.com/pfalcon/pycopy-lib (originally submitted here as #312, #313 long ago).

Then I made a few updates to it:

  • add manifest.py
  • convert test to use unittest and run it under CI
  • use bytes.hex() instead of binascii.hexlify().decode()
  • run ruff format

Testing

Test added that runs under CI.

Trade-offs and Alternatives

This adds a minimal implementation of uuid.uuid4() which is arguably the more important of the uuidX functions.

Alternatives:

Generative AI

Not used.

andrewleech and others added 3 commits July 11, 2026 15:17
Includes unit test.

Signed-off-by: Damien George <damien@micropython.org>
And run it as part of CI.

Signed-off-by: Damien George <damien@micropython.org>
Using `bytes.hex()` eliminates an import, and eliminates the call to
`.decode()` to convert it to a str.

Also run ruff format.

Signed-off-by: Damien George <damien@micropython.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants