Build and Push Docker Container / build-and-push (push) Successful in 2m25s
- Require Python 3.15 for the server and Python 3.14 for the CLI. - Match the server requirement to quart_common's Python 3.15 features. - Replace future annotations with native deferred evaluation. - Defer CLI command dependencies and QR imports on Python 3.15. - Enable argparse suggestions for mistyped CLI commands. - Remove the obsolete tomllib import fallback. - Update my_helpers and quart_common submodule references. - Lock test dependencies and exclude them from Docker installations. - Add regression coverage for lazy imports and deferred annotations. - Document runtime requirements and standalone CLI validation. - Validate 276 tests on Python 3.15 and 18 CLI tests on Python 3.14. BREAKING CHANGE: The server now requires Python 3.15+ and the standalone CLI requires Python 3.14+.
23 lines
552 B
Python
23 lines
552 B
Python
# Keep QR/Pillow loading off non-QR request paths on Python 3.15.
|
|
__lazy_modules__ = ["qrcode", "qrcode.constants"]
|
|
|
|
from io import BytesIO
|
|
|
|
import qrcode
|
|
from qrcode.constants import ERROR_CORRECT_M
|
|
|
|
def make_qr_png(data: str) -> bytes:
|
|
qr = qrcode.QRCode(
|
|
version=None,
|
|
error_correction=ERROR_CORRECT_M,
|
|
box_size=10,
|
|
border=4,
|
|
)
|
|
qr.add_data(data, optimize=20)
|
|
qr.make(fit=True)
|
|
image = qr.make_image(fill_color="black", back_color="white")
|
|
|
|
buffer = BytesIO()
|
|
image.save(buffer, format="PNG")
|
|
return buffer.getvalue()
|