Skip to main content

gettextpo

Python bindings for the GNU gettext PO file library, built with Rust and PyO3.

Overview

gettextpo provides direct access to libgettextpo, the GNU gettext library for parsing and manipulating PO (Portable Object) translation files. This package enables you to read, write, and programmatically edit PO files with full access to message metadata, comments, and validation.

Installation

pip install gettextpo

Build from source

This package requires the gettext development libraries and Rust toolchain.

# Install dependencies (Debian/Ubuntu)
apt-get install libgettextpo-dev

# Install dependencies (macOS)
brew install gettext

# Build and install
pip install maturin
maturin develop

Quick Start

from gettextpo.lib import PoFile, PoHeader

# Read an existing PO file
po = PoFile.read("messages.po")

# Or load from a string
po = PoFile.load("""
msgid "Hello"
msgstr "Bonjour"
""")

# Access domains and headers
for domain in po.domains():
    header = po.domain_header(domain)
    po_header = PoHeader(header)
    print(f"Content-Type: {po_header['Content-Type']}")

# Iterate over messages
for domain in po.domains():
    for message in po.messages(domain):
        # Access message properties via the low-level API
        pass

Features

  • Read and write PO files
  • Access and modify message headers
  • Iterate over translation messages
  • Support for plural forms
  • Handle translator and extracted comments
  • Track file positions for messages
  • Manage obsolete and fuzzy message flags
  • Format string validation

API Reference

PoFile

  • PoFile.create() - Create a new empty PO file
  • PoFile.read(filename) - Read a PO file from disk
  • PoFile.load(contents) - Load a PO file from a string
  • po.domains() - List all domains in the file
  • po.domain_header(domain) - Get the header for a domain
  • po.messages(domain) - Iterate over messages in a domain

PoHeader

  • PoHeader(header) - Create a header wrapper
  • header[field] - Get a header field value
  • header[field] = value - Set a header field value
  • header.render() - Get the header as a string

Requirements

  • Python 3.12 or later
  • libgettextpo (gettext development library)

Release

Run the Release workflow from master:

gh workflow run release.yml --ref master -f version_bump=patch

The run bumps the version in Cargo.toml, Cargo.lock and pyproject.toml, pushes the version commit to master together with the annotated tag v<version>, builds the wheels and the sdist from that tag, publishes them to PyPI with trusted publishing (environment pypi), and creates the GitHub Release.

License

GPL-3.0-or-later

Metadata

Release files for gettextpo 0.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for gettextpo 0.1.1
File Actions
gettextpo-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details for gettextpo-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl
gettextpo-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for gettextpo-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl
gettextpo-0.1.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for gettextpo-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
gettextpo-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details for gettextpo-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl

Total release size: 1.9 MB

Release files / gettextpo-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl

Download URL gettextpo-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl
Size 265.8 kB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c773d975d2c0284f1b64d1ebeb8699162abb4ccb70320c6bcd22e70839a1de31
BLAKE2b-256 checksum
How to use checksums
db63f6e1b3bc96b5eecfc95a1665f73a11a7c3b71fe3cf919a11d3ce7d119226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / gettextpo-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL gettextpo-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a20c8da5f76a65a9b8b48c9c660d0e81fe541947085a7b00704c6852a521e2a8
BLAKE2b-256 checksum
How to use checksums
5cf8a5606fa594580623a07637f6bca1c659ec7ba49724bc8c4fa4e9773abd19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / gettextpo-0.1.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL gettextpo-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Size 264.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
178f76856b246c47d686e6a68469cd80c730321e76e1d10a4b6b3474b2959602
BLAKE2b-256 checksum
How to use checksums
9033721981b025e3c6b1c3a905e13a8f6f4c40830761d67775af39c669605a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / gettextpo-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl

Download URL gettextpo-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl
Size 266.5 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
83f5535b1c933bfd9644664daa50500572f4332889af520c9d60ba9e8acdcd6a
BLAKE2b-256 checksum
How to use checksums
1767f013b00f9f368234600126fc601ccc8cf339bc79c0b2007b85e200f52ad2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for gettextpo 0.1.1

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for gettextpo-0.1.1-cp313-cp313-macosx_10_12_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

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

0.1.1 This release

4 release files Full 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