Read DBF Files with Python
Project description
📚 dbfread2
🚀 A modern Python library for reading DBF files with elegance and type safety
dbfread2 is a modern, type-safe Python library for reading DBF files (dBase, Visual FoxPro, FoxBase+) with zero external dependencies.
✨ Highlights
- 🐍 Modern Python 3.12+ implementation
- 🔍 Comprehensive type hints
- 🛠️ Simple yet powerful API
- 📁 Native
pathlib.Pathsupport - 🔄 Streaming and memory-loaded modes
- 📝 Support for all major DBF variants
- 📋 18 field types with extensible
FieldParser - 📎 Reads
FPTandDBTmemo files - 🔒 Type-safe operations
🚀 Quick Start
from dbfread2 import DBF
# Stream records (memory-efficient)
for record in DBF('people.dbf'):
print(record)
# {'NAME': 'Alice', 'BIRTHDATE': datetime.date(1987, 3, 1)}
# {'NAME': 'Bob', 'BIRTHDATE': datetime.date(1980, 11, 12)}
# Load all records into memory
table = DBF('people.dbf', load=True)
print(table.records[0]['NAME']) # Returns: 'Alice'
📦 Installation
pip install dbfread2
🔄 Migration from dbfread
Key Changes
-
Python Version
- ✅ Python 3.12+ required
- ❌ No support for older versions
-
Import Updates
# Before ❌ from dbfread import DBF # After ✅ from dbfread2 import DBF
-
Modern Parameter Names
# Before ❌ DBF('file.dbf', recfactory=dict, lowernames=True) # After ✅ DBF('file.dbf', record_factory=dict, lowercase_names=True)
-
Path Support
# ✨ New Feature from pathlib import Path DBF(Path('data/file.dbf'))
🛠️ Development
Setup
-
Install Tools
- mise-en-place for environment management
- uv for package management
-
Clone & Setup
git clone https://github.com/wasdee/dbfread2.git cd dbfread2 mise install uv pip install -e ".[docs]"
📚 Documentation
mise run docs:build # Build docs
mise run docs:serve # Serve locally
mise run docs:watch # Watch mode
mise run docs:check # Check for issues
✅ Code Quality
📄 License
MIT License
🙏 Credits
Fork of dbfread by Ole Martin Bjørndalen
📬 Contact
Nutchanon Ninyawee - me@nutchanon.org
⭐️ If this project helps you, consider giving it a star!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbfread2-0.1.0.tar.gz.
File metadata
- Download URL: dbfread2-0.1.0.tar.gz
- Upload date:
- Size: 46.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0c0c428085a9449bc091863563c3ff4742f15e248097ab2364e7f2f8a66e66c
|
|
| MD5 |
fc29637268c971b0b5763a15b2ed3c85
|
|
| BLAKE2b-256 |
a92dfece2942e2fe97936fd5ede5c20070ff507ee2c52da21ba86ba4eeafaba9
|
File details
Details for the file dbfread2-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dbfread2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a42675052ef3e3b4d0f52736942008e8c290471722331b1ab14886636c1cfb
|
|
| MD5 |
54691e88eb364e4f730ef9034dc19e5b
|
|
| BLAKE2b-256 |
9ca08bf7fdc48f0fb150a8dccfff31186b21cc0348cbed481bd8b9f9bcea006d
|