Skip to content

infra: replace qrcode/png/uri with best-in-class external libraries (optional conan deps) #247

@fpelliccioni

Description

@fpelliccioni

Current state

  • qrcode: wraps libqrencode (C library, with_qrencode conan option, default off). 92 lines of wrapper code.
  • png: with_png conan option exists. Used for QR code output as PNG.
  • uri: hand-written RFC 3986 parser (~200 lines). No external dependency.

Goal

Replace these with the best available external libraries, keeping them as optional conan dependencies (same pattern as today). Evaluate:

QR code

  • If there's a library that generates QR codes directly as PNG (or SVG), that would eliminate the need for a separate PNG dependency. Candidates:
    • nayuki/QR-Code-generator — header-only C/C++, generates QR matrix (no image output)
    • libqrencode (current) — C library, generates QR matrix, needs separate PNG lib for image
    • Look for a single lib that does QR → PNG in one step

PNG

  • Only needed if the QR library doesn't produce PNG directly
  • libpng (likely current), stb_image_write (header-only, simpler), etc.

URI

  • ada-url — fast, standards-compliant URL parser (used by Node.js). Available on conan.
  • Or keep the hand-written parser if it's sufficient (it's small and works)

Conan integration pattern

Follow the existing with_qrencode pattern:

options = {"with_qrencode": [True, False]}
default_options = {"with_qrencode": False}

def requirements(self):
    if self.options.with_qrencode:
        self.requires("libqrencode/4.1.1", ...)

All three should remain optional — the node works without QR/PNG/URI support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions