This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Segno – Python QR Code and Micro QR Code encoder

Segno is a QR Code and Micro QR Code encoder which has no further dependencies.

This package implements main parts of ISO/IEC 18004:2006(E) / ISO/IEC 18004:2015(E) and produces Micro QR Codes and QR Codes with nearly no effort.

Segno provides several serialization formats like SVG, EPS, PNG, PDF, PBM, LaTeX (PGF/TikZ) or text output. None of these serializers require an external lib. Segno could provide more serialization formats via a plugin architecture. Further, it provides several high level function to create QR Codes which encode contact data (MeCard) or WIFI configurations.

It requires Python 2.6, 2.7 or Python 3 and works with PyPy.

Installation

Use pip to install segno from PyPI:

$ pip install segno

Usage

Command line

The command line script prints the QR Code to the terminal:

$ segno "Comfortably Numb"

To serialize the QR Code, use the “output” argument:

$ segno "Famous Blue Raincoat" -o=raincoat.svg
$ segno "Who by Fire" --scale=10 --color=darkblue --border=0 --output=fire.svg
$ segno "Waiting for the Miracle" --scale=10 --background=transparent --output=miracle.png

Library

>>> import segno
>>> qr = segno.make('Up Jumped the Devil')  # Let Segno choose the minimal version
>>> qr.is_micro
False
>>> qr.version
2
>>> qr.error
'M'
>>> qr.save('up-jumped-the-devil.png')  # Save as PNG
>>> qr.save('up-jumped-the-devil-2.png', scale=10)  # Scaling factor 10
>>> qr.save('up-jumped-the-devil-3.png', background=None)  # Transparent background
>>> qr.save('up-jumped-the-devil.pdf', scale=10)  # Save as PDF
>>> # SVG drawing the dark modules in "dark blue"
>>> qr.save('up-jumped-the-devil.svg', scale=10, color='darkblue')

If the content to encode is small enough, a Micro QR Code is generated:

>>> import segno
>>> qr = segno.make('RAIN')
>>> qr.is_micro
True
>>> qr.version
'M2'

If this behaviour is not desired, the user may use the factory functions segno.make_qr() which generates always QR Codes (never Micro QR Codes) or segno.make_micro() which generates always Micro QR Codes (or raises an error if the content is too large for a Micro QR Code).

>>> import segno
>>> mqr = segno.make_micro('THE BEATLES')
>>> mqr.version
'M3'
>>> qr = segno.make_qr('THE BEATLES')  # Same content but enforce a QR Code
>>> qr.version
1
>>> # This won't work since the data does not fit into a Micro QR Code M1 - M4
>>> mqr = segno.make_micro('Nick Cave and the Bad Seeds')
Traceback (most recent call last):
    ...
DataOverflowError: Data too large. No Micro QR Code can handle the provided data

All factory functions use the same parameters to specify the desired error level, version, data mask etc., see Segno’s documentation for details.

Changes

0.2.3 – 2016-10-17

  • Fixed #27: E-mail URI is wrong if CC or BCC is used.
  • Fixed #32: Don’t add version attribute if SVG >= 2.0
  • Deprecated writers.get_writable; use writers.writable writers.writable closes file-like objects automatically (if necessary); replace writable, must_close = writers.get_writable(filename_or_buffer, mode) with with writers.writable(filename_or_buffer, mode) as f
  • Added option to PNG serializer to specify an optional DPI value (thanks to Markus Ueberall for support)
  • Added PAM (Portable Arbitrary Map) as serialization format (supports colors and transparency)

0.2.2 – 2016-09-21

  • Command line script reports Segno’s version (--ver) and the version is also mentioned in the help message (-h) (#24)
  • Support for creating E-mail addresses or complete messages (segno.helpers)
  • Internal optimizations and more correct minimal version finding (#26)

0.2.1 – 2016-09-15

  • Fixed Python packaging (source distribution did not work), again

0.2.0 – 2016-09-15

  • Fixed Python packaging

0.1.9 – 2016-09-15

  • Added “color” parameter to the LaTeX serializer to define the color of the dark modules.
  • Fixed serious issue #23: Segno creates invalid QR Codes if boost_error is not disabled (enabled by default)

0.1.8 – 2016-09-14

  • Removed utils.matrix_with_border_iter
  • Fixed #21 (type error while writing to terminal under Windows)
  • Added option to serialize QR Codes as LaTeX vector graphic
  • Added module segno.helpers which provides additional factory funcitons to create common QR Codes like a WIFI configuration, a geo location or MeCard

0.1.7 – 2016-09-04

  • Changed API: Added a feature to increase the error correction level if it fits. Disable this feature via boost_error=False (#16)
  • Added --no-error-boost to the command line script to disable error correction level incrementation (#17)
  • Command line script: Internal changes and better test coverage
  • Added tests for issue #18
  • Added PBM (P1 and P4) serialization.
  • Deprecated utils.matrix_with_border_iter, use utils.matrix_iter
  • utils.matrix_with_border_iter will be removed in the next release
  • API change: QRCode.matrix_iter(border) -> QRCode.matrix_iter(scale=1, border=None)

0.1.6 – 2016-08-25

  • Fixed setup

0.1.5 – 2016-08-24

  • Added QRCode.matrix_iter(border) which returns an iterator over the matrix and includes the border (as light modules).
  • Invalid (empty) SVG identifiers / class names are ignored and do not result into an invalid SVG document (issue #8).
  • SVG serializer: If unit was set to None, an invalid SVG document was generated (issue #14).
  • Better command line support:
    • The command line script recognizes all SVG options (#9)
    • Added --mode/-m, renamed --mask/-m to --pattern/-p (issue #10)
    • The script used an empty string as default value for the data to encode. The data to encode has no default value anymore (issue #11)
    • Added --no-ad to omit the comment Software in PNG images (issue #12)

0.1.4 – 2016-08-21

  • Better terminal output
  • Fixed issue #5: QRCode.terminal() uses a special output function (if it detects Windows) to support MS Windows which may not support ANSI escape codes.

0.1.3 – 2016-08-20

  • Added command line script “segno”
  • Registered new file extension “ans” which serializes the QR Code as ANSI escape code (same output as QRCode.terminal())
  • Removed deprecated methods “eps”, “svg”, “png”, “pdf”, and “txt” from segno.QRCode
  • Switched from nose tests to py.test

0.1.2 – 2016-08-17

  • Updated docs
  • Backwards incompatible change: Deprecated “eps”, “svg”, “png”, “pdf”, and “txt” methods from QRCode. Use QRCode.save. Methods will be removed in 0.1.3
  • Fixed issue #3 (M1 and M3 codes may have undefined areas)
  • Fixed issue #4 (wrong ‘error’ default value for encoder.encode(), factory function segno.make() wasn’t affected)

0.1.1 – 2016-08-14

  • Initial release
Release History

Release History

0.2.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
segno-0.2.3-py2.py3-none-any.whl (63.6 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Oct 17, 2016
segno-0.2.3.tar.gz (57.5 kB) Copy SHA256 Checksum SHA256 Source Oct 17, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting