Java Manifest File Parser

1.1.0 · maintenance · verified Thu Apr 16

The `java-manifest` library provides functionality to encode and decode Java's `META-INF/MANIFEST.MF` files using Python. It represents a manifest as a list of dictionaries, where each dictionary corresponds to a section within the manifest. The library is currently at version 1.1.0, with its last release in July 2020, indicating a low release cadence.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates loading a Java manifest string into a Python list of dictionaries, modifying it, and then dumping it back to a manifest-formatted string.

import java_manifest

manifest_str = """Manifest-Version: 1.0
Created-By: My Build Tool
Application-Name: ExampleApp

Name: com/example/app/MainClass.class
MD5-Digest: AB12CD34EF56GH78IJ90KL12MN34OP56
"""

# Load manifest from a string
manifest_data = java_manifest.loads(manifest_str)
print("Loaded Manifest Data:")
for section in manifest_data:
    print(section)

# Add a new attribute to the first section
if manifest_data:
    manifest_data[0]["New-Attribute"] = "SomeValue"

# Dump manifest back to a string
updated_manifest_str = java_manifest.dumps(manifest_data)
print("\nUpdated Manifest String:")
print(updated_manifest_str)

view raw JSON →