Skip to content

Repository files navigation

uploadkit-office

CI Coverage Python

Office document validators, policies, and metadata for UploadKit.

What problem does this solve?

OOXML/ODF structure and security checks (macros, external links, embeds) that plug into UploadPolicy.validators without modifying UploadKit Core.

When to use it

Use for DOCX, XLSX, PPTX, ODT, and ODS uploads that must stay macro-free by default.

When not to use it

  • Do not edit or convert office documents here.
  • Do not put generic MIME/filename checks here (see uploadkit-security).

Installation

Requires Python 3.10+. No extra native dependencies (stdlib zipfile + XML).

pip install uploadkit-office

Quick Start

from uploadkit import Uploader
from uploadkit_office import DocxPolicy, OfficePolicy, OfficeKind

uploader = Uploader(DocxPolicy(max_size=10 * 1024 * 1024), storage=my_storage)

# Or allow multiple kinds:
policy = OfficePolicy(kinds=frozenset({OfficeKind.DOCX, OfficeKind.XLSX}))

Public API

Symbol Kind
OfficePolicy / DocxPolicy / XlsxPolicy / PptxPolicy Public
OfficeKind / OfficeMetadata / inspect_office Public
OfficeStructureValidator / OfficeSecurityValidator / OfficeSheetLimitValidator Public
default_office_validators / default_async_office_validators Public
Async validator equivalents Public

Coverage

The coverage badge is a measured total from coverage report --include='src/*', not an aspirational 100%. CI enforces --fail-under=80.

Most of the remaining gap is defensive and format-variant code in metadata.py (edge-case ZIP/ODF parsing, zip-bomb heuristics). Validators and policies are fully covered. Unlike Core / framework adapters, this package does not claim 100% yet — fixtures for those branches are welcome.

Changelog

See CHANGELOG.md.

Contributing

See CONTRIBUTING.md.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages