Skip to main content

A utility to format raw text protocols into styled PDFs

Project description

Use this template

Repo Banner

# 🧾 Protocol Formatter

Format raw text protocols into clean, publish-ready Word and pdf documents
Say goodbye to messy indentation, unclear bulleting, and formatting inconsistency in step-by-step protocols.


PyPI version License: MIT Python version Status


✨ Features

  • Automatically detects stepwise sections in .txt protocols
  • Adds clean spacing between blocks
  • Handles blank lines, indents, and bullet lists
  • Formats output to a well-structured .docx document
  • Output file uses the same name as input (with .docx extension)
  • Fully local and fast

📦 Installation

pip install protocol_formatter

Note for macOS/Linux users:
This package relies on system-level libraries like Cairo, Pango, and GDK-Pixbuf for converting .docx to .pdf.
Make sure to install them using:

brew install cairo pango gdk-pixbuf libffi  # macOS
sudo apt install libcairo2 libpango-1.0-0 libgdk-pixbuf2.0-0 libffi-dev  # Debian/Ubuntu

🧪 How to Use

protocol_formatter path/to/input_protocol.txt
  • You’ll be prompted to provide a path if not passed as argument.
  • Output will be saved as a .docx file in the same folder.

📂 Input Format

Supports .txt files containing stepwise procedures like:

- Prepare solutions
* Mix reagents...
* Adjust pH...
** nested content

- Sample Treatment
* Add buffer
* Incubate at 37°C

🖨 Sample Output

A fully formatted DOCX output example:
Sample Output Preview


🛠 Developer Notes

  • Entry point defined in __init__.py
  • Uses python-docx for Word file creation
  • Compatible with Python 3.7+

📜 License

Licensed under the MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protocol_formatter-0.1.3.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

protocol_formatter-0.1.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file protocol_formatter-0.1.3.tar.gz.

File metadata

  • Download URL: protocol_formatter-0.1.3.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for protocol_formatter-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ef0d4158d60a0951f907bcdd24d048d7e630826cbf1c8cb5ed2d81c8bfa63adb
MD5 5997e3f489cc801560ddfb162d715d3a
BLAKE2b-256 ab36f07b50655cf576abd14c1a82985c3e284859b631d5dbd3ab3a883c723884

See more details on using hashes here.

File details

Details for the file protocol_formatter-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for protocol_formatter-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e03c9137ad3936a88d3651dfd046d8c4ff9d2356064002ca3ef933a3a361714d
MD5 46a0a6f7a887630d8808dcb0c68dbed4
BLAKE2b-256 9c4774c6b07d94a2424c58822080b6b9ab256c634b6ad59f60a4019de3da2ffb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page