πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Sign inDemoInstall
Socket

dbfread2

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbfread2

Read DBF Files with Python

0.1.0
PyPI
Maintainers
1

πŸ“š 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

  • 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

  • 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!

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts