#python#pythontutions#barcode#successLearners#success
#learners#pandas#machineLearrning#AI#deepLearning#ml#dl
The Best Python Packages for Generating Barcodes
Barcodes are a cheap and ubiquitous way to add machine-readable information to an object. I think of barcodes as the real-world equivalent of browser cookies: For example, when you arrive at airport departures, the airline hands you a boarding pass with a barcode (the cookie). From that point onward you’re asked to show your barcode at every interaction: at security, the duty-free shop, and the boarding gate. And just like the information stored in browser cookies, the information in barcodes isn’t in plain sight but easily made visible.
While preparing a conference talk about barcodes, I spent three evenings researching Python packages for generating images of 1D and 2D barcodes. This review article is the result of that work.
This article was last updated on January 23th, 2019.
Summary: Recommendations
treepoem is the most feature-rich Python package for rendering barcodes as images. It supports all common barcode symbologies as well as many obscure ones, is actively maintained, and is available under the MIT license. It’s my recommendation for anyone who wants to work with many symbologies.
However, treepoem requires non-Python dependencies which might be difficult or impossible to install in some situations. If you cannot install treepoem’s dependencies, or just don’t want to, the next best general purpose option is python-barcode, the most actively maintained fork of the dormant pyBarcode package.
Supported Symbologies
Most users will be looking to generate barcodes of a single symbology only, and the summary at the top includes recommendations for single-symbology packages. If you require a symbology for which no such dedicated package exists or if you need to support many symbologies, you will be looking for a general purpose package that supports many symbologies.
The comparison table includes both types of packages. In deciding which packages to recommend, I generally favored those supporting more symbologies or, for “single symbology” packages, those supporting more variants of a symbology.
The comparison table includes columns for 13 symbologies. This might seem unfair because those 13 are an arbitrarily chosen subset of the fifty or so barcode symbologies that have some common use case today. My time and the available space on the conference slide deck were the reasons for this limitation. (A snide aside: If all Readme files were up-to-date with the package functionality, adding columns for additional symbologies would have been a lot easier!) Hopefully, my choice presents a useful balance by including the union set of common and frequently supported symbologies.
A further complication was that some symbologies are subsets of other symbologies and, in some cases, I disagree with the way symbology support is described in the package documentation or readme file. For example, many packages advertise support for ISSN. I do not include ISSN because it is simply an EAN-13 barcode with the first three digits equal to “977”. Similarly, the JAN (Japanese Article Number) symbology is sometimes listed separately but is actually identical to EAN.
Note that I omit the short versions of UPC and EAN, for example UPC-E and EAN-5, purely for space reasons. Most packages that support the long version also support the common short versions.
Project Activity and Popularity
Most barcode symbologies have been set in stone for decades. In theory, software for generating them could be truly complete, with zero remaining feature requests or bug fixes. However, even if bug-free software existed, some maintenance would be necessary because the Python language has evolved over the years, and so has the ecosystem of available tools for writing image file formats which many barcode generating tools utilize.
The usual tradeoff between project completeness and project activity applies: The more comprehensive the functionality and the higher the quality, the lower the project activity needs to be for a package to likely be a good choice for many users. I tried to find a reasonable balance, but my judgment is subjective. Sadly, the majority of packages I reviewed meet neither the threshold for completeness nor the threshold for activity.
Информация по комментариям в разработке