Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade and drop Python 3.7 #46

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
sccache: "true"
manylinux: auto
- name: Install and test
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
rust-toolchain: stable
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
- uses: uraimo/run-on-arch-action@v2.7.2
if: matrix.target != 'ppc64'
name: Install built wheel
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
rust-toolchain: stable
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
- name: Install built wheel
if: matrix.target == 'x86_64-unknown-linux-musl'
uses: addnab/docker-run-action@v3
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
rust-toolchain: stable
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_2
args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
Expand All @@ -171,9 +171,9 @@ jobs:
matrix:
platform:
- target: x64
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
- target: x86
interpreter: 3.7 3.8 3.9 3.10 3.11
interpreter: 3.8 3.9 3.10 3.11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
sccache: "true"
- name: Build wheels - universal2
uses: PyO3/maturin-action@v1
Expand Down
96 changes: 57 additions & 39 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "uuid_utils"
crate-type = ["cdylib"]

[dependencies]
mac_address = "1.1.5"
pyo3 = { version = "0.19.2", features = ["extension-module", "generate-import-lib"] }
mac_address = "1.1.6"
pyo3 = { version = "0.21.2", features = ["extension-module", "generate-import-lib"] }
rand = "0.8.5"
uuid = { version = "1.4.1", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
uuid = { version = "1.8.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')
UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')
```

## Compat module

In some cases you might need `UUID` instances to be returned
from the standrad-library `uuid`, not a custom `UUID` class.
In that case you can use the `uuid_utils.compat` which comes with a performance penalty
in comparison with the `uuid_utils` default behaviour, but still faster than the standard-library.

```py
>>> import uuid_utils.compat as uuid

>>> # make a random UUID
>>> uuid.uuid4()
UUID('ffe95fcc-b818-4aca-a350-e0a35b9de6ec')
```

## Benchmarks

| Benchmark | Min | Max | Mean | Min (+) | Max (+) | Mean (+) |
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ name = "uuid_utils"
description = "Drop-in replacement for Python UUID in Rust"
authors = [{ name = "Amin Alaee", email = "me@aminalaee.dev" }]
keywords = ["rust", "uuid"]
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 1 addition & 0 deletions python/uuid_utils/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class UUID:
"""Get UUID timestamp milliseconds since epoch.
Only works for UUID versions 1, 6 and 7, otherwise raises ValueError."""
...

@property
def urn(self) -> str: ...
@property
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==23.1.0
isort==5.11.5
mypy==1.1.1
pytest==7.2.2
ruff==0.0.259
black==24.4.2
isort==5.13.2
mypy==1.10.0
pytest==8.2.0
ruff==0.4.2
Loading
Loading