spacy-layout
spacy-layout is a Python plugin that converts PDFs, Word documents, and similar files into structured, analyzable text using spaCy's NLP capabilities. It extracts document layout (sections, headings, tables), converts tables to pandas DataFrames, and creates spaCy Doc objects for downstream NLP tasks like entity recognition or RAG chunking.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | explosion/spacy-layout |
| Owner | explosion |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 908 |
| Forks | 64 |
| Open issues | 26 |
| Latest release | Unknown |
| Last updated | 2026-03-27 |
| Source | https://github.com/explosion/spacy-layout |
What spacy-layout is
spacy-layout wraps Docling's document conversion engine within spaCy's pipeline architecture, tokenizing extracted content and exposing layout metadata via custom extension attributes (Doc._.layout, Span._.layout). It preserves bounding box coordinates, page information, and tabular data structures, enabling both linguistic analysis and layout-aware document processing.
Get the spacy-layout source
Clone the repository and explore it locally.
git clone https://github.com/explosion/spacy-layout.gitcd spacy-layout# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Python 3.10+; verify environment constraints and dependency compatibility with existing spaCy versions.
- Depends on Docling for document conversion; evaluate Docling's performance and format support for your document corpus before adoption.
- Extension attributes (Doc._.layout, Span._.layout) must be re-initialized on deserialization from binary .spacy files; plan serialization workflows accordingly.
- Table extraction yields pandas DataFrames; ensure pandas is in your stack or account for additional dependency footprint.
- No official release versioning yet (latestRelease: n/a); monitor GitHub for breaking changes and pin dependency versions explicitly.
When to avoid it — and what to weigh
- Requires pixel-perfect OCR or handwriting recognition — spacy-layout relies on Docling's underlying extraction; scanned or image-based documents with no embedded text require separate OCR preprocessing.
- Low-latency, high-throughput inference needed — Document conversion is resource-intensive; not suitable for real-time single-document processing at scale without horizontal scaling or caching strategies.
- Complex proprietary document formats — If you must support custom binary or niche document formats beyond PDF/DOCX, verify Docling's format coverage or prepare custom preprocessing.
- Non-Python workflows — Python 3.10+ is mandatory; integration into non-Python backends requires API wrapping or separate microservice architecture.
License & commercial use
MIT License (OSI-approved permissive license). Permits commercial use, modification, and distribution with attribution; no warranty provided.
MIT License explicitly permits commercial use without royalty or licensing fees. No restrictions on proprietary applications. However, verify Docling's license (dependency) for your use case, as it may have different terms.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
Processes untrusted PDFs and documents; malformed files could trigger parsing errors or memory issues. Validate and sandbox input documents if processing user-supplied content. Dependency on Docling means security posture depends on that library's maintenance. No security audit or vulnerability disclosure process mentioned. Review both projects' security practices before handling sensitive documents.
Alternatives to consider
LlamaIndex with document loaders (pdf, docx)
Language-agnostic document parsing and chunking for RAG; integrates with multiple LLM backends but lacks spaCy-native layout annotation and lower-level linguistic control.
Unstructured.io (document parsing library)
Format-agnostic structured extraction with metadata; lighter weight than spacy-layout but no native spaCy integration and less NLP-specific feature exposure.
PyPDF2 + pdfplumber + spaCy (manual integration)
Fine-grained control and lighter dependencies; requires custom glue code for layout annotation and table extraction but avoids Docling dependency.
Build on spacy-layout with DEV.co software developers
spacy-layout brings production-ready document conversion to spaCy workflows. Contact Devco to integrate structured document intelligence into your RAG, knowledge extraction, or AI application stack.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
spacy-layout FAQ
Does spacy-layout require OCR for scanned PDFs?
Can I use spacy-layout with transformer models like en_core_web_trf?
What formats does spacy-layout support?
Is there a performance penalty for serialization and deserialization?
Software developers & web developers for hire
Adopting spacy-layout is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate ai frameworks software in production.
Ready to streamline document processing in your NLP pipeline?
spacy-layout brings production-ready document conversion to spaCy workflows. Contact Devco to integrate structured document intelligence into your RAG, knowledge extraction, or AI application stack.