Skip to main content

Read DBF Files with Python

Project description

📚 dbfread2

🚀 A modern Python library for reading DBF files with elegance and type safety

PyPI version Python 3.12+ License: MIT

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.Path support
  • 🔄 Streaming and memory-loaded modes
  • 📝 Support for all major DBF variants
  • 📋 18 field types with extensible FieldParser
  • 📎 Reads FPT and DBT memo 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

  1. Python Version

    • ✅ Python 3.12+ required
    • ❌ No support for older versions
  2. Import Updates

    # Before ❌
    from dbfread import DBF
    # After ✅
    from dbfread2 import DBF
    
  3. Modern Parameter Names

    # Before ❌
    DBF('file.dbf', recfactory=dict, lowernames=True)
    # After ✅
    DBF('file.dbf', record_factory=dict, lowercase_names=True)
    
  4. Path Support

    # ✨ New Feature
    from pathlib import Path
    DBF(Path('data/file.dbf'))
    

🛠️ Development

Setup

  1. Install Tools

  2. 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

  • 🧹 ruff - Linting & formatting
  • 🔍 mypy - Static type checking

📄 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbfread2-0.1.0.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

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

dbfread2-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

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

Hashes for dbfread2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0c0c428085a9449bc091863563c3ff4742f15e248097ab2364e7f2f8a66e66c
MD5 fc29637268c971b0b5763a15b2ed3c85
BLAKE2b-256 a92dfece2942e2fe97936fd5ede5c20070ff507ee2c52da21ba86ba4eeafaba9

See more details on using hashes here.

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

Hashes for dbfread2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5a42675052ef3e3b4d0f52736942008e8c290471722331b1ab14886636c1cfb
MD5 54691e88eb364e4f730ef9034dc19e5b
BLAKE2b-256 9ca08bf7fdc48f0fb150a8dccfff31186b21cc0348cbed481bd8b9f9bcea006d

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