Skip to main content
XML2RFC

Release License PyPI - Version PyPI - Status PyPI - Format

Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies

Introduction

The IETF uses a specific format for the standards and other documents it publishes as RFCs, and for the draft documents which are produced when developing documents for publications. There exists a number of different tools to facilitate the formatting of drafts and RFCs according to the existing rules, and this tool, xml2rfc, is one of them. It takes as input an xml file that contains the text and meta-information about author names etc., and transforms it into suitably formatted output. The input xml file should follow the grammars in RFC7749 (for v2 documents) or RFC7991 (for v3 documents).

RFCXML vocabulary reference is available at authors.ietf.org.

xml2rfc provides a variety of output formats. See the command line help for a full list of formats. It also provides conversion from v2 to v3, and can run the preptool on its input.

Installation

xml2rfc is available as Python package and container image (see Docker-container-usage). You can install the python package with the following command:

pip install xml2rfc

If you're using pipx, you can install xml2rfc with the following command:

pipx install xml2rfc

xml2rfc also provides pdf extra package to install required packages required for PDF file generation. See next section about additional requirements for PDF generation.

To install xml2rfc with PDF generation support run:

pip install "xml2rfc[pdf]"

To install pdf extra with pipx run:

pipx install "xml2rfc[pdf]"

Installation of support libraries for the PDF-formatter

In order to generate PDFs, xml2rfc uses the WeasyPrint module, which depends on external libraries that must be installed as native packages on your platform, separately from the xml2rfc install.

  1. First, install the Pango, and other required libraries on your system. See installation instructions on the WeasyPrint Docs.

  2. Next, install WeasyPrint python modules using pip.

pip install "xml2rfc[pdf]"
  1. Finally, install the required fonts:
  • Download latest fonts from xml2rfc-fonts.
  • In the Assets section, download either the tar.gz or the zip archive.
  • Extract the contents of the downloaded xml2rfc-fonts archive.
  • Install the fonts found in the noto and roboto_mono directories to your operating system.

With these installed and available to xml2rfc, the --pdf switch will be enabled.

Docker container

A series of docker images are available to accommodate various use cases. The table below describes the features of each image type.

Docker image name Description
xml2rfc-slim xml2rfc without PDF support; small image.
xml2rfc-base xml2rfc with PDF generation and required fonts; large image.
xml2rfc-dev xml2rfc with multiple Python versions and development tools; large image for developers.

Example using the xml2rfc-slim image:

docker run --rm `# automatically remove container upon termination` \
  -v "$(pwd):/data" `# bind current working directory to /data` \
  ghcr.io/ietf-tools/xml2rfc-slim:latest \
  --html example.xml
# if input is example.xml, output will be example.html

Single line:

docker run --rm -v "$(pwd):/data" ghcr.io/ietf-tools/xml2rfc-slim:latest --html example.xml

Development images are further documented under #docker-dev-environment.

Image versioning

Docker image versions follow the regular release versioning. Use a versioned tag to ensure reproducibility in CI / CD:

docker run --rm -v "$(pwd):/data" ghcr.io/ietf-tools/xml2rfc-slim:v3.32.0 --html example.xml

Updating xml2rfc

To update xml2rfc, run the following command:

pip install --upgrade xml2rfc

If you are using pipx, you can update it with:

pipx upgrade xml2rfc

Usage

xml2rfc accepts a single XML document as input and outputs to one or more conversion formats.

Basic Usage

xml2rfc SOURCE [options] FORMATS...

Run xml2rfc --help for a full listing of command-line options.

Getting Started

This project is following the standard Git Feature Workflow development model. Learn about all the various steps of the development workflow, from creating a fork to submitting a pull request, in the Contributing guide.

Make sure to read the Styleguides section to ensure a cohesive code format across the project.

You can submit bug reports, enhancements and new feature requests in the discussions area. Accepted tickets will be converted to issues.

Git Cloning Tips

As outlined in the Contributing guide, you will first want to create a fork of the xml2rfc project in your personal GitHub account before cloning it.

For example (replace USERNAME with your GitHub username):

git clone https://github.com/USERNAME/xml2rfc.git

Docker Dev Environment

Run ./run.sh command to build and start a docker development environment. The initial build may take time because it downloads all required fonts as well.

./run.sh

Download files

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

Source Distribution

xml2rfc-3.34.1.tar.gz (424.8 kB view details)

Uploaded Source

Built Distribution

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

xml2rfc-3.34.1-py3-none-any.whl (376.7 kB view details)

Uploaded Python 3

File details

Details for the file xml2rfc-3.34.1.tar.gz.

File metadata

  • Download URL: xml2rfc-3.34.1.tar.gz
  • Upload date:
  • Size: 424.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xml2rfc-3.34.1.tar.gz
Algorithm Hash digest
SHA256 537fd45cd9b8e2c0b1fa45c6e0fd1bf2794fb7708a187c568265f3944d2a4de8
MD5 386fef4061352e23e6b9b59ae7e69646
BLAKE2b-256 2c540ceb0cab2e4811a31cc55fbc42c074867d1905af3351167d804ad71dcbe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for xml2rfc-3.34.1.tar.gz:

Publisher: pypi-publish.yml on ietf-tools/xml2rfc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xml2rfc-3.34.1-py3-none-any.whl.

File metadata

  • Download URL: xml2rfc-3.34.1-py3-none-any.whl
  • Upload date:
  • Size: 376.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xml2rfc-3.34.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acbf90cdeb703ff8e426e619da345b1946b800dade8ab89d618ab2988938ad5f
MD5 a0bff4db77e6105fe224f6604543dc20
BLAKE2b-256 b4928f961a105ece3b331a863cac48175feaadb7372ef5092b562ad9089305fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for xml2rfc-3.34.1-py3-none-any.whl:

Publisher: pypi-publish.yml on ietf-tools/xml2rfc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

3.34.1 This release

2 files

3.34.0

2 files

3.33.0

2 files

3.32.0

2 files

3.31.0

2 files

3.30.2

2 files

3.30.1

2 files

3.30.0

2 files

3.29.0

2 files

3.28.1

2 files

3.28.0

2 files

3.27.0

2 files

3.26.0

2 files

3.25.0

1 file

3.24.0

1 file

3.23.2

1 file

3.23.1

1 file

3.23.0

1 file

3.22.0

1 file

3.21.0

1 file

3.20.1

1 file

3.20.0

1 file

3.19.4

1 file

3.19.3

1 file

3.19.2

1 file

3.19.1

1 file

3.19.0

1 file

3.18.2

1 file

3.18.1

1 file

3.18.0

1 file

3.17.5

1 file

3.17.4

1 file

3.17.3

1 file

3.17.2

1 file

3.17.1

1 file

3.17.0

1 file

3.16.0

1 file

3.15.3

1 file

3.15.2

1 file

3.15.1

1 file

3.15.0

1 file

3.14.2

1 file

3.14.1

1 file

3.14.0

1 file

3.13.1

1 file

3.13.0

1 file

3.12.10

1 file

3.12.9

1 file

3.12.8

1 file

3.12.7

1 file

3.12.6

1 file

3.12.5

1 file

3.12.4

1 file

3.12.3

1 file

3.12.2

1 file

3.12.1

1 file

3.12.0

1 file

3.11.1

1 file

3.11.0

1 file

3.10.0

1 file

3.9.1

1 file

3.9.0

1 file

3.8.0

1 file

3.7.0

1 file

3.6.0

1 file

3.5.0

1 file

3.4.0

1 file

3.3.0

1 file

3.2.1

1 file

3.2.0

1 file

3.1.1

1 file

3.1.0

1 file

3.0.0

1 file

2.47.0

1 file

2.46.0

1 file

2.45.3

1 file

2.45.2

1 file

2.45.1

1 file

2.45.0

1 file

2.44.0

1 file

2.43.0

1 file

2.42.0

1 file

2.41.0

1 file

2.40.1

1 file

2.40.0

1 file

2.39.0

1 file

2.38.1

1 file

2.38.0

1 file

2.37.3

1 file

2.37.2

1 file

2.37.1

1 file

2.37.0

1 file

2.36.0

1 file

2.35.0

1 file

2.34.0

1 file

2.33.0

1 file

2.32.0

1 file

2.31.0

1 file

2.30.0

1 file

2.29.1

1 file

2.29.0

1 file

2.28.0

1 file

2.27.1

1 file

2.27.0

1 file

2.26.0

1 file

2.25.0

1 file

2.24.0

1 file

2.23.1

1 file

2.23.0

1 file

2.22.3

1 file

2.22.2

1 file

2.22.1

1 file

2.22.0

1 file

2.21.1

1 file

2.21.0

1 file

2.20.1

1 file

2.20.0

1 file

2.19.1

1 file

2.19.0

1 file

2.18.0

1 file

2.17.2

1 file

2.17.1

1 file

2.17.0

1 file

2.16.3

1 file

2.16.2

1 file

2.16.1

1 file

2.16.0

1 file

2.15.5

1 file

2.15.4

1 file

2.15.3

1 file

2.15.2

1 file

2.15.1

1 file

2.15.0

1 file

2.14.1

1 file

2.14.0

1 file

2.13.1

1 file

2.13.0

1 file

2.12.3

1 file

2.12.2

1 file

2.12.1

1 file

2.12.0

1 file

2.11.1

1 file

2.11.0

1 file

2.10.3

1 file

2.10.2

1 file

2.10.1

1 file

2.10.0

1 file

2.9.9

1 file

2.9.8

1 file

2.9.7

1 file

2.9.6

1 file

2.9.5

1 file

2.9.4

1 file

2.9.3

1 file

2.9.2

1 file

2.9.1

1 file

2.9.0

1 file

2.8.5

1 file

2.8.4

1 file

2.8.3

1 file

2.8.2

1 file

2.8.1

1 file

2.8.0

1 file

2.7.0

1 file

2.6.2

1 file

2.6.1

1 file

2.6.0

1 file

2.5.2

1 file

2.5.1

1 file

2.5.0

1 file

2.4.12

1 file

2.4.11

1 file

2.4.10

1 file

2.4.9

1 file

2.4.8

1 file

2.4.7

1 file

2.4.6

1 file

2.4.5

1 file

2.4.4

1 file

2.4.3

1 file

2.4.2

1 file

2.4.1

1 file

2.4.0

1 file

2.3.11.3

1 file

2.3.11.2

1 file

2.3.11.1

1 file

2.3.11

1 file

2.3.10

1 file

2.3.9

1 file

2.3.8

1 file

2.3.7

1 file

2.3.6

1 file

2.3.5

1 file

2.3.4

1 file

2.3.3

1 file

2.3.2

1 file

2.3.1

1 file

2.3.0

1 file

2.2.7

1 file

2.2.5

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