Skip to main content

PubCode

PubCode is a library that encodes barcodes and allows easy access to the data required to render the barcode. It can optionally use PIL to render the barcode or to provide a data URL containing a single pixel high PNG barcode which can be resized by a browser to a more usefull size.

https://travis-ci.org/Venti-/pubcode.svg?branch=master

Supported barcodes

  • Code128

Usage

>>> from pubcode import Code128
>>> barcode = Code128('Hello!', charset='B')

You can access the data required to render the barcode easily and intuitively.

>>> barcode.bars
'2112142311131122142211142211141341112221221212412331112'
>>> barcode.modules  # doctest: +ELLIPSIS
[0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, ...]

You can generate PIL.Image objects from barcodes.

>>> barcode.image()  # doctest: +ELLIPSIS
<PIL.Image.Image image mode=1 size=121x1 at ...>
>>> barcode.image(height=10, module_width=2)  # doctest: +ELLIPSIS
<PIL.Image.Image image mode=1 size=242x10 at ...>

You can also generate data URLs.

>>> barcode.data_url()  # doctest: +ELLIPSIS
'data:image/png;base64,...'

You can also control the exact way in which the barcode is encoded, which allows you to control the size of the resulting barcode.

>>> barcode = Code128('12\x00x\x01', charset='CABA')
>>> barcode.symbols
['[Start Code C]', '12', '[Code A]', '\x00', '[Shift B]', 'x', '\x01', '\x15', '[Stop]']

Metadata

Release files for PubCode 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for PubCode 1.1.0
File Interpreter ABI Platform Actions
PubCode-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for PubCode-1.1.0-py2.py3-none-any.whl

Release files / PubCode-1.1.0-py2.py3-none-any.whl

Download URL PubCode-1.1.0-py2.py3-none-any.whl
Size 8.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a17560257097d5dc287e39c54c05bfb27e89287b11a9181bc6bbeabc0a0e72cd
BLAKE2b-256 checksum
How to use checksums
a7bec832140d7d224fa20dcc66d17e9f365ff91818c8b54bb117d77b0f73be68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for PubCode 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page