Skip to main content

Port to Python 3. Dbfpy is a python-only module for reading and writing DBF-files.

Project description

dbfpy3

Python Version PyPI Version License Tests

Pure Python 3 library for reading and writing DBF (dBase/FoxPro) database files. No external dependencies required.

✨ Features

  • Pure Python - No C extensions or external dependencies
  • FoxPro Support - Full support for FoxPro DBF files and memo fields (.FPT)
  • Code Page Support - Proper character encoding for international data
  • Context Manager - Safe resource management with with statements
  • Python 3.5+ - Modern Python support

🚀 Quick Start

Installation

pip install dbfpy3

Basic Usage

from dbfpy3 import dbf

# Read existing DBF file
with dbf.Dbf('customers.dbf') as db:
    for record in db:
        print(record['NAME'], record['EMAIL'])

# Create new DBF file
db = dbf.Dbf('new_file.dbf', new=True)
db.add_field(
    ('C', 'NAME', 30),      # Character field, max 30 chars
    ('D', 'BIRTHDATE'),     # Date field
    ('N', 'SALARY', 10, 2), # Numeric field, 10 digits, 2 decimal places
    ('L', 'ACTIVE')         # Logical field (True/False)
)

# Add records
rec = db.new()
rec['NAME'] = 'John Doe'
rec['BIRTHDATE'] = datetime.date(1990, 1, 15)
rec['SALARY'] = 75000.50
rec['ACTIVE'] = True
db.write(rec)
db.close()

📖 Documentation

🧪 Development

# Clone repository
git clone https://github.com/frankyxhl/dbfpy3.git
cd dbfpy3

# Install development dependencies
pip install -r requirements_dev.txt

# Run tests
python -m unittest discover tests
make test

# Run specific test module
python -m unittest tests.test_fields

# Check code style
make lint

⚠️ Important Notes

  • Field Names: Limited to 10 characters per DBF specification
  • Unicode Support: DBF files use code pages for character encoding
  • Production Use: While functional, use with caution in production environments

📄 License

This project is licensed under the BSD License - see the LICENSE file for details.

🙏 Credits

  • Original Author: Jeff Kunce
  • Python 3 Port: Frank Xu
  • Contributors: Hans Fiby, Zdeněk Böhm, and many others

🔗 Links

======= History

0.1.0 (2020-12-26)

  • First release on PyPI.

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

dbfpy3-4.2.3.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

dbfpy3-4.2.3-py2.py3-none-any.whl (21.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dbfpy3-4.2.3.tar.gz.

File metadata

  • Download URL: dbfpy3-4.2.3.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dbfpy3-4.2.3.tar.gz
Algorithm Hash digest
SHA256 25c2033c9c909911542e8421a039ee7b049e7fa90ce73b23a2035c1cfd43eff4
MD5 a737911e54d63eb2dddb2c535da26774
BLAKE2b-256 bf0f6fa5f0898fb000a4331a333cf0bed385135d8f33324a71e9b21f266cc181

See more details on using hashes here.

File details

Details for the file dbfpy3-4.2.3-py2.py3-none-any.whl.

File metadata

  • Download URL: dbfpy3-4.2.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dbfpy3-4.2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b273649643542ba0f60d0e14fdc8d675580f3675e7d1663d861fc99d675cd78
MD5 c5c855bc7bb0f5d8073d3e690ca2cb82
BLAKE2b-256 2573c85bd126149d44a43dbf8ff48b42f1177817436ceadb76a4c9f8a925291f

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