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 Mimos - Adapt Segno’s API to other QR Code libs

Segno Mimos aims to emulate the API of other Python QR Code libs. While this works more or less API-wise, the resulting QR Codes may look different.

Currently, PyQRCode and qrcode are supported.

Segno Mimos does not require any of 3rd party libs (like Pillow or PyPNG), it just requires Segno to be installed.

Since both libs do not support Micro QR Codes, this lib creates QR Codes, only.

Replace PyQRCode with Segno

If a 3rd party lib uses PyQRCode and and changing the code of the lib isn’t possible, use:

>>> import segno_mimos
>>> segno_mimos.install_as_pyqrcode()

To replace PyQRCode with Segno in your code, change

>>> import pyqrcode

with:

>>> from segno_mimos import pyqrcode

After that import you should be able to use your existing code without any changes:

>>> from segno_mimos import pyqrcode
>>> # Example from PyQRCode README:
>>> url = pyqrcode.create('http://uca.edu')
>>> url.svg('uca-url.svg', scale=8)
>>> url.eps('uca-url.eps', scale=2)
>>> print(url.terminal(quiet_zone=1))

Please note, that qr = pyqrcode.QrCode('Dark side of the Moon') DOES NOT work, use the factory function pyqrcode.create().

Not all features of PyQRCode are supported:

>>> from segno_mimos import pyqrcode
>>> qr = pyqrcode.create('Michelle')
>>> qr.xbm(scale=10)
Traceback (most recent call last):
    ...
NotImplementedError: This method is not supported

The underlying segno.QRCode instance can be accessed as follows:

>>> from segno_mimos import pyqrcode
>>> # qr behaves like pyqrcode.QRCode
>>> qr = pyqrcode.create('Up Jumped the Devil')
>>> # Get the underlying Segno QRCode instance
>>> segno_qr = qr.segno_qrcode

Replace qrcode with Segno

If a 3rd-party lib uses qrcode, use the following code snippet before importing the 3rd-party lib:

>>> import segno_mimos
>>> segno_mimos.install_as_qrcode()

The 3rd-party lib should use Segno automatically.

Since qrcode has a more complex API (i.e. factories) replacing it with Segno can be more difficult; in the simpliest case replace

>>> import qrcode

in your code with:

>>> from segno_mimos import qrcode
>>> # From now on, you can use qrcode as usual
>>> img = qrcode.make('Some data here')
>>> img.save('qrcode.png')
>>> # Segno Mimos provides the "constants" module as well, so this works, too
>>> qr = qrcode.QRCode(version=1,
...     error_correction=qrcode.constants.ERROR_CORRECT_L,
...     box_size=10,
...     border=4)
>>> img = qr.make_image()
>>> # Utilizing the "kind" parameter of qrcode works for PDF, PNG, and EPS files
>>> img.save('qrcode.png', kind='png')  # Unnecessary, since PNG is the default
>>> img.save('qrcode.pdf', kind='pdf')
>>> img.save('qrcode.eps', kind='eps')

If your code uses any of the standard image factories, use the following imports:

>>> from segno_mimos import qrcode
>>> import segno_mimos.qrcode.image.svg
>>> import segno_mimos.qrcode.image.pure
>>> qr = qrcode.QRCode(version=1,
...     error_correction=qrcode.constants.ERROR_CORRECT_L,
...     box_size=10,
...     border=4)
>>> # Use the image factory as usual, no code changes necessary
>>> svg_img = qr.make_image(image_factory=qrcode.image.svg.SvgFragmentImage)
>>> pure_img = qr.make_image(image_factory=qrcode.image.pure.PymagingImage)

The “pure” image factory is actually the same as the default image factory, it just exists to minimize code changes. Further, all SVG image factories are serializing the QR Code as path, never as a combination of rects (like qrcode.image.svg.SvgImage does). The SVG factories do not require any 3rd party libs (aside from segno) like lxml etc.

Changes

0.1.9 – 2016-09-19

  • Added install_as_qrcode and install_as_pyqrcode which may be useful if qrcode or PyQRCode is used and should be replaced by Segno without code changes.
  • Fixed Python packaging.

0.1.8 – 2016-09-04

  • Disable automatic error incrementation (Segno >= 0.1.7) (neither PyQRCode nor qrcode support it)

0.1.7 – 2016-08-24

  • Adapt Segno’s 0.1.6 API changes

0.1.6 – 2016-08-17

  • Internal code changes
  • qrcode: Image could not be saved in another output format using the “format” or “kind” parameter. Fixed.

0.1.5 – 2016-08-16

  • Updated docs
  • Removed return statement from PyQRCode.png()
  • Internal code changes
  • Renamed (internal) module segno_mimos.qrcode.img into _img to avoid confusion with segno_mimos.qrcode.image

0.1.4 – 2016-08-14

  • Initial release
  • Support for PyQRCode 1.2.1 and qrcode 5.3
Release History

Release History

0.1.9

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.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.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

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_mimos-0.1.9-py2.py3-none-any.whl (15.8 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Sep 19, 2016
segno-mimos-0.1.9.tar.gz (12.4 kB) Copy SHA256 Checksum SHA256 Source Sep 19, 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