{"id":4252,"library":"segno","title":"Segno","description":"Segno is a pure Python library for generating QR Codes and Micro QR Codes according to ISO/IEC 18004:2015(E). It provides various serialization formats like Scalable Vector Graphics (SVG), Portable Network Graphics (PNG), Encapsulated PostScript (EPS), Portable Document Format (PDF), and more, without external dependencies for these core functionalities. Currently at version 1.6.6, Segno maintains an active release cadence with several updates per year.","status":"active","version":"1.6.6","language":"en","source_language":"en","source_url":"https://github.com/heuer/segno/","tags":["qr code","micro qr code","image generation","barcode","svg","png","pdf"],"install":[{"cmd":"pip install segno","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for Python versions < 3.10 after Segno 1.6.0, as it replaced pkg_resources for plugin discovery.","package":"importlib-metadata","optional":true}],"imports":[{"note":"The `make` function is the primary entry point for creating QR codes and Micro QR codes.","symbol":"make","correct":"import segno\nqrcode = segno.make('Your data')"},{"note":"The `helpers` module provides high-level functions for specific data types like vCard or Wi-Fi configurations.","symbol":"helpers","correct":"from segno import helpers"}],"quickstart":{"code":"import segno\n\n# Create a QR code for a URL\nqrcode = segno.make('https://example.com/your-data')\n\n# Save the QR code as a PNG file with a scale of 5\nqrcode.save('my_qrcode.png', scale=5)\n\n# Or save as SVG\n# qrcode.save('my_qrcode.svg', scale=5)\n\n# Create a colorful QR code\ncolorful_qrcode = segno.make('https://example.com/colorful', dark='darkblue', light='lightblue')\ncolorful_qrcode.save('my_colorful_qrcode.png', scale=5)\n\nprint('QR codes generated successfully: my_qrcode.png and my_colorful_qrcode.png')","lang":"python","description":"This quickstart generates two QR codes: a basic one and a colorful one, saving them as PNG images. Segno automatically determines the minimal version and optimal error correction level by default."},"warnings":[{"fix":"Migrate your project to Python 3.5+ (ideally 3.10+ to avoid additional dependencies) if using Segno 1.6.0 or newer.","message":"Segno dropped support for Python 2.7 starting from version 1.6.0. Python 2.7 reached its End-of-Life on January 1, 2020.","severity":"breaking","affected_versions":">=1.6.0"},{"fix":"If running on Python < 3.10 with Segno 1.6.0 or newer, ensure `importlib-metadata` is installed (e.g., `pip install segno 'importlib-metadata<5.0.0'` for Python < 3.8, or simply `pip install segno` for 3.8+ as it's often handled implicitly by modern pip resolving dependencies).","message":"Starting with Segno 1.6.0, the internal dependency on `pkg_resources` was removed and replaced by `importlib.metadata`. For Python versions older than 3.10, this introduces a new explicit dependency on the `importlib-metadata` backport package.","severity":"breaking","affected_versions":">=1.6.0"},{"fix":"Always use the latest stable patch release (e.g., 1.6.6) to avoid such packaging issues.","message":"Segno releases 1.6.4 and 1.6.5 (fixed in 1.6.6) had packaging issues where man pages were placed in the wrong directory or source distributions did not include all relevant files. While fixed, this highlights a potential for minor distribution-related glitches in point releases.","severity":"gotcha","affected_versions":"1.6.4, 1.6.5"},{"fix":"Upgrade to Segno 1.3.3 or newer to ensure correct generation of Wi-Fi QR codes, as this issue was resolved.","message":"In versions prior to 1.3.3, the `segno.helpers.make_wifi` and `segno.helpers.make_wifi_data` functions could generate invalid data if input strings contained characters that could be misinterpreted as integers.","severity":"gotcha","affected_versions":"<1.3.3"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}