Skip to main content

A Python library for working with Encoded Archival Description (EAD) XML files

Project description

EADPy

PyPI - Version License: MIT

A Python library for working with Encoded Archival Description (EAD) XML documents.

Features

  • Parse and manipulate EAD XML documents
  • Convert EAD to various formats (JSON, CSV)
  • Validate EAD documents against schemas
  • Tools for batch processing of EAD files

Installation

Install EADPy using pip:

pip install eadpy

Install using uv:

uv tool install eadpy

Usage

Parse an EAD file

from eadpy import Ead

# Load an EAD file and parse it
ead = Ead("path/to/finding_aid.xml")

Export to JSON chunks

# Create chunks for embedding or display
ead.create_and_save_chunks("path/to/output.json")

Export to CSV

# Create a flattened CSV representation of the hierarchy
ead.create_and_save_csv("path/to/output.csv")

Command-line Interface

EADPy supports processing multiple EAD XML files at once using the command-line interface.

Processing a single file

# Export to JSON (default)
eadpy file path/to/finding_aid.xml -o output.json

# Export to CSV
eadpy file path/to/finding_aid.xml -o output.csv -f csv

# Use verbose mode for detailed output
eadpy file path/to/finding_aid.xml -v

Batch processing a directory of files

# Process all XML files in a directory and export to JSON
eadpy dir path/to/ead_directory

# Export to CSV
eadpy dir path/to/ead_directory -f csv

# Specify an output directory
eadpy dir path/to/ead_directory -o path/to/output_directory

# Process subdirectories recursively
eadpy dir path/to/ead_directory -r

# Use verbose mode for detailed output
eadpy dir path/to/ead_directory -v

Command-line options

Global options

  • --version: Show the version number and exit
  • --help: Show help message and exit

File command options

  • input: Path to the EAD XML file (required)
  • -o, --output: Path to the output file
  • -f, --format: Output format ('json' or 'csv')
  • -v, --verbose: Print detailed information

Directory command options

  • input_dir: Path to the directory containing EAD XML files (required)
  • -o, --output-dir: Directory for output files
  • -f, --format: Output format ('json' or 'csv', default: 'json')
  • -r, --recursive: Process subdirectories recursively
  • -v, --verbose: Print detailed information

Development

Setting up the development environment

EADPy uses uv for dependency management and virtual environment setup.

  1. Clone the repository:
git clone https://github.com/nulib-labs/eadpy
cd eadpy
  1. Create and activate a virtual environment:
uv venv --python 3.13
source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate  # On Windows
  1. Install development dependencies:
uv pip install -e ".[dev]"

Running tests

pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgements

Special thanks to the ArcLight project, which inspired the EAD processing approach taken here. Thank you to the developers and contributors of ArcLight for their work in the archival community!

License

This project is licensed under the MIT License - see the LICENSE file 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

eadpy-0.1.2.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

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

eadpy-0.1.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file eadpy-0.1.2.tar.gz.

File metadata

  • Download URL: eadpy-0.1.2.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for eadpy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 101916fe4d475fa682e038bcd9cbff0c0603091de27ce65b1147b763494287c8
MD5 42a54b1b4743c274d9423579e38aa8b4
BLAKE2b-256 18c61cbba887e13fbb1baef9129064c621f67d7780b9ba987caf50dbc023ddb2

See more details on using hashes here.

File details

Details for the file eadpy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: eadpy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for eadpy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91284da0c48cb0e9cd53881e3a5e64fa8fd340c90c84dfce02066fde1a8b6ddb
MD5 d6cc130566c911da7e1d555078944f8f
BLAKE2b-256 a6525bc4a573fc2c9e30a491f918c66cd0f8325fd2747d27237b75099fb9f1d5

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