{"id":16610021,"url":"https://github.com/Edinburgh-Genome-Foundry/blabel","last_synced_at":"2025-10-29T17:30:47.850Z","repository":{"id":37444707,"uuid":"156431850","full_name":"Edinburgh-Genome-Foundry/blabel","owner":"Edinburgh-Genome-Foundry","description":":label: Python label/sticker PDF generation. HTML templates, built-in barcodes, qr codes, and other goodies","archived":false,"fork":false,"pushed_at":"2022-07-22T14:56:44.000Z","size":7974,"stargazers_count":175,"open_issues_count":4,"forks_count":37,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-09-19T23:42:15.190Z","etag":null,"topics":["barcode","datamatrix","lab-automation","label","pdf","python","qrcode"],"latest_commit_sha":null,"homepage":"https://edinburgh-genome-foundry.github.io/blabel","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edinburgh-Genome-Foundry.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-06T18:51:19.000Z","updated_at":"2024-09-12T09:10:16.000Z","dependencies_parsed_at":"2022-07-15T21:30:45.683Z","dependency_job_id":null,"html_url":"https://github.com/Edinburgh-Genome-Foundry/blabel","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fblabel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fblabel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fblabel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fblabel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edinburgh-Genome-Foundry","download_url":"https://codeload.github.com/Edinburgh-Genome-Foundry/blabel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219857399,"owners_count":16556064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","datamatrix","lab-automation","label","pdf","python","qrcode"],"created_at":"2024-10-12T01:29:25.097Z","updated_at":"2025-10-29T17:30:47.843Z","avatar_url":"https://github.com/Edinburgh-Genome-Foundry.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":".. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg alt=\"Blabel Logo\" title=\"Blabel\" src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/blabel/master/docs/_static/images/title.png\" width=\"400\"\u003e\n    \u003cbr /\u003e\u003cbr /\u003e\n    \u003c/p\u003e\n\n----\n\n.. image:: https://github.com/Edinburgh-Genome-Foundry/blabel/actions/workflows/build.yml/badge.svg\n    :target: https://github.com/Edinburgh-Genome-Foundry/blabel/actions/workflows/build.yml\n    :alt: GitHub CI build status\n\n.. image:: https://coveralls.io/repos/github/Edinburgh-Genome-Foundry/blabel/badge.svg?branch=master\n    :target: https://coveralls.io/github/Edinburgh-Genome-Foundry/blabel?branch=master\n\n\nBlabel is a Python package to generate labels (typically for printing stickers)\nwith barcodes and other niceties.\n\n**Some features:**\n\n- Generates PDF files where each page is a label (that's the way most label printers want it).\n- Label layout is defined by HTML (Jinja) templates and CSS. Supports any page dimensions and margins.\n- Builtin support for various barcodes, QR-codes, datamatrix, and more (wraps other libraries).\n- Labels data can be provided as list of dicts (easy to generate from spreadsheets).\n- Possibility to print several items per sticker.\n\n.. raw:: html\n    \n    \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/blabel/master/docs/_static/images/demo_screenshot.png\" width=\"715\"\u003e\n    \u003cbr /\u003e\u003cbr /\u003e\n    \u003c/p\u003e\n\n\nExample\n-------\n\nTo generate labels with Blabel you first need a HTML/Jinja template, and\noptionally a style sheet, to define how your labels will look like.\n\n.. raw:: html\n\n    \u003cbr/\u003e\u003cbr/\u003e\n\n**HTML item template** (``item_template.html``)\n\nNotice the use of ``label_tools`` (Blabel's builtin features). The variables\n``sample_name`` and ``sample_id`` will be defined at label creation time.\n\n.. code:: html\n\n    \u003cimg src=\"{{label_tools.qr_code(sample_id)}}\"/\u003e\n    \u003cspan class='label'\u003e\n        {{ sample_name }} \u003cbr/\u003e\n        Made with blabel \u003cbr/\u003e\n        {{ label_tools.now() }}\n    \u003c/span\u003e\n\n.. raw:: html\n\n    \u003cbr/\u003e\u003cbr/\u003e\n\n**CSS stylesheet** (``style.css``)\n\nNotice the CSS ``@page`` attributes which allows you to adjust the page format\nto the dimensions of your sticker.\nAlso notice the ``pixelated`` image rendering. If your printer is black/white\nonly with no greyscale support, this option will ensure crisp-looking barcodes,\nqr codes, etc.\n\n.. code:: css\n\n    @page {\n        width: 27mm;\n        height: 7mm;\n        padding: 0.5mm;\n    }\n    img {\n        height: 6.4mm;\n        display: inline-block;\n        vertical-align: middle;\n        image-rendering: pixelated;\n    }\n    .label {\n        font-family: Verdana;\n        font-weight: bold;\n        vertical-align: middle;\n        display: inline-block;\n        font-size: 7px;\n    }\n\n.. raw:: html\n\n    \u003cbr/\u003e\u003cbr/\u003e\n\n**Python code**\n\nIn your Python script, create a ``LabelWriter`` linked to the two files above,\nand feed it a list of of dicts (\"records\"), one for each label to print:\n\n\n.. code:: python\n\n    from blabel import LabelWriter\n\n    label_writer = LabelWriter(\"item_template.html\",\n                               default_stylesheets=(\"style.css\",))\n    records= [\n        dict(sample_id=\"s01\", sample_name=\"Sample 1\"),\n        dict(sample_id=\"s02\", sample_name=\"Sample 2\")\n    ]\n\n    label_writer.write_labels(records, target='qrcode_and_label.pdf')\n\n.. raw:: html\n\n    \u003cbr/\u003e\u003cbr/\u003e\n\n**Result:**\n\n.. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg alt=\"Blabel Logo\" title=\"Labels\" src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/blabel/master/examples/qrcode_and_date/screenshot.png\" width=\"300\"\u003e\n    \u003cbr /\u003e\u003cbr /\u003e\n    \u003c/p\u003e\n\n\nOther examples\n--------------\n\n- `Example with a barcode and a dynamically generated picture \u003chttps://github.com/Edinburgh-Genome-Foundry/blabel/tree/master/examples/barcode_and_dynamic_picture\u003e`_\n- `Ugly example with a logo and a datamatrix \u003chttps://github.com/Edinburgh-Genome-Foundry/blabel/blob/master/examples/logo_and_datamatrix\u003e`_\n- `Example with date and QR code (sources of the example above) \u003chttps://github.com/Edinburgh-Genome-Foundry/blabel/blob/master/examples/qrcode_and_date\u003e`_\n- `Example where the label data is read from spreadsheets \u003chttps://github.com/Edinburgh-Genome-Foundry/blabel/blob/master/examples/labels_from_spreadsheet\u003e`_\n- `Example where several items are printed on each page/sticker \u003chttps://github.com/Edinburgh-Genome-Foundry/blabel/tree/master/examples/several_items_per_page\u003e`_\n\n\nInstallation\n------------\n\nYou can install Blabel via PIP:\n\n.. code::\n\n    pip install blabel\n\n\n**Note:** the package depends on the WeasyPrint Python package. If there are any issues,\nsee installation instructions in the `WeasyPrint documentation \u003chttps://doc.courtbouillon.org/weasyprint/stable/first_steps.html\u003e`_.\n\nIf you have an older GNU/Linux distribution (e.g. Ubuntu 18.04), then install an older WeasyPrint (\u003c=52),\nas they don't have the latest Pango that is required by the latest WeasyPrint: ``pip install weasyprint==52``\n\n\n**Note: on macOS**, you may need to first install pango with ``brew install pango``.\n\n**Note: on some Debian systems** you may need to first install libffi-dev (``apt install libffi-dev``).\nThe package name may be libffi-devel on some systems.\n\n\nLicense = MIT\n-------------\n\nBlabel is an open-source software originally written at the `Edinburgh Genome Foundry\n\u003chttps://edinburgh-genome-foundry.github.io/home.html\u003e`_ by `Zulko \u003chttps://github.com/Zulko\u003e`_\nand `released on Github \u003chttps://github.com/Edinburgh-Genome-Foundry/blabel\u003e`_ under the MIT licence\n(Copyright 2018 Edinburgh Genome Foundry, University of Edinburgh). Everyone is welcome to contribute!\n\n\nMore biology software\n---------------------\n\n.. image:: https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Edinburgh-Genome-Foundry.github.io/master/static/imgs/logos/egf-codon-horizontal.png\n  :target: https://edinburgh-genome-foundry.github.io/\n\nBlabel was originally written to print labels for biological samples and is part of the `EGF Codons \u003chttps://edinburgh-genome-foundry.github.io/\u003e`_\nsynthetic biology software suite for DNA design, manufacturing and validation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEdinburgh-Genome-Foundry%2Fblabel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEdinburgh-Genome-Foundry%2Fblabel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEdinburgh-Genome-Foundry%2Fblabel/lists"}