Metadata-Version: 2.4
Name: Code-Base-Tools
Version: 1.1.3
Summary: Python wrapper for CodeBase DLL for DBF table access and management.
Author-email: "M-P Systems Services, Inc." <jsheuer@mpss-pdx.com>
Project-URL: Homepage, https://github.com/MPSystemsServices/Python-CodeBase-Tools
Project-URL: Issues, https://github.com/MPSystemsServices/Python-CodeBase-Tools/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Natural Language :: English
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Office/Business
Classifier: Topic :: Database
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE.TXT
Requires-Dist: easygui; sys_platform == "win32"
Dynamic: license-file

# Python CodeBaseTools
Python binding for the CodeBase-for-DBF data table engine, plus tools for spreadsheet access and other functions.  Provides advanced capabilities for managing data tables in DBF format to support Python projects from simple scripts to multi-user applications with dozens of related tables and sophisticated record locking for data integrity.

![Python Version](https://img.shields.io/badge/Python_Version-3.6+-blue)
![License](https://img.shields.io/badge/License-Lesser_GPL-blue)
![Module Version](https://img.shields.io/badge/Module_Version-1.1.3-blue)
# Software Description
CodeBaseTools is a Python binding that encapsulates the very low-level functioning of the CodeBase(tm) .DLL product (formerly commercial software sold by Sequiter, Inc., and now open source) with simple powerful functions, making DBF format data table access convenient to use for Python programmers using all recent versions of Python for Windows.  CodeBase(tm) was released to Open Source as of September, 2018 and updated extensively in 2026.  The resulting DBF table access is dramatically faster than previously available DBF table access modules for Python and is capable of sophisticated data access and handling features normally available only to advanced SQL database tools like SQL-Server.  See below for licensing details under the "Lesser GPL".
Python Code-Base Tools provide the following capabilities:
* Creates, Opens, Reads, Writes and Indexes DBF tables in a format compatible with Visual FoxPro type DBF tables.
* Supports record, table, and table header locking compatible with that of Visual FoxPro, allowing hundreds of users to access the same tables simultaneously either with Python-Codebase-Tools or Visual FoxPro or both.
* Optionally supports tables, fields, and index elements larger than the limits in Visual FoxPro (Maximum table size is 8GB for the standard mode required for VFP compatibility.  A "Large Table" mode (not VFP compatible) is software selectable in both 32-bit and 64-bit versions that supports tables in multiple terrabyte sizes.)
* Recognizes a wide variety of fields including:
  * Character (Assumes Code Page 1252 -Windows European Language characters)
  * Character-binary (Makes no assumptions regarding language representation, so suitable for Unicode data)
  * Memo (Large text up to 2GB)(Assumes Code Page 1252 -Windows European Language characters)
  * Memo-binary (Large text up to 2GB) (Makes no assumptions regarding language representation, so suitable for Unicode data)
  * Number (decimal values up to 17 digits)
  * Integer (4-byte signed integers)
  * Boolean (Logical, True/False)
  * Currency (Fixed 4-decimal point exact representation of money values)
  * Date (Year, Month, Day)
  * Datetime (Year, Month, Day, Hour, Minute, Second)
  * Float (like Number)
  * Double (like Number)
  * General (treated like Memo-binary, Windows OLE component content is not recognized)
* Allows creation of standard VFP-style CDX indexes (with multiple "tags" for different orderings), IDX indexes (with a single ordering), and the auto updating of indexes when records are changed, including updating all distinct index tags in a CDX index.
* Provides for temporary indexes which remain synchronized with the data table while in use, and are then deleted automatically when closed.
* Supports copying DBF table data to Excel spreadsheet format with the ExcelTools modules (and the non-open-source commercial product LibXL, a purchased license for which is required.  Capability supported in 32-bit versions only.)
* Supports VFP-style CURSORTOXML and XMLTOCURSOR functions for rapid conversion of DBF data to generic XML and back to DBF.
* Provides hundreds of powerful functions that emulate the capabilities of Visual FoxPro.  VFP, though now a discontinued Microsoft product, was renowned for being able to create applications 3-4 times faster than comparable .NET tools due to its unmatched data handling capabilities.
* Copies DBF tables to CSV (Comma Separated Value) and System Data (fixed field length) text files as well as importing those formats directly into a DBF table.
For all functionality see the User Guide referenced below.

This version of Python CodeBaseTools was updated as of July, 2026.  Supplementary files have been updated more recently.
# Installation and Usage
Windows users having versions of Python 3.6 and later (either 32-bit or 64-bit versions of Python 3.10 and up) may install this module easily using PIP:

`pip install Code-Base-Tools`

An older version of the module suitable for Python version 2.7, 32-bit compile, is available by downloading files directly from the GitHub repository: [<b>Python CodeBase Tools</b>](https://github.com/MPSystemsServices/Python-CodeBase-Tools).  That repository also contains source code for the Python C API based .PYD modules and instructions for recompiling them using Microsoft Visual Studio 2022.

Python versions 3.1 through 3.5 are not supported, as they are effectively obsolete.  Versions 3.6, 3.7, 3.8 and 3.9 are supported with version-specific PYD files that are included in the distribution directory.  For versions 3.10 and above, the PYD file which implements all the functionality was compiled from an upgraded version of the .C source that allows creation of a cross-version PYD file using the Python "Limited API" functions.  PYD files supporting 64-bit Python have been compiled using the cross-version library as well, so 32-bit and 64-bit versions 3.10, 3.11, 3.12, 3.13, 3.14 and beyond are supported.

The Excel read and write features are currently only available for 32-bit Python.

Note that you do NOT need to download any files from the CodeBase-for-DBF repository which contains the underlying open-source C4DLL.DLL and C4DLL64.DLL files, as the required compiled Windows DLL files are included in this repository.  Of course, you are free to customize the .C source and recompile the CodeBase-for-DBF DLLS should you need to do so.  To access that underlying open source CodeBase(tm) for DBF repository see [**CodeBase-for-DBF**](https://github.com/MPSystemsServices/CodeBase-for-DBF)
# Python CodeBaseTools Licensing
This package is copyright M-P Systems Services, Inc., and is released to Open Source under the GNU Lesser GPL V.3.0 license, a copy of which is found in this repository.  The CodeBase-for-DBF module, is covered by this same license.  The CodeBase package, including the core library c4dll.dll and c4dll64.dll is copyright Sequiter, Inc., and is licensed under the GNU Lesser GPL v.3.0.  There is an old demo version of libxl.dll included for testing purposes for the DBF to Excel module.  However, that is commercial software and no license information is included in the `LibXLLicenseInfo.TXT` file.  To use this module without the size limits and demo messages injected into the output, you'll need to acquire your own libxl license from https://libxl.com and paste the appropriate codes into the license info file.
# Integration with Visual FoxPro Applications
DBF tables can be opened simultaneously both by Visual FoxPro applications and Python applications using this package.  Record and table locking and buffering work correctly to support multi-user applications where both Python and VFP applications are accessing the tables.  For more information on how to integrate Python components with existing Visual FoxPro applications, see our white paper at https://mpss-pdx.com/white-paper.  For details on record locking see the User Guide referenced below.
# OS Compatibility
The Python .pyd files which wrap the CodeBase(tm) c4dll.dll and c4dll64.dll modules were compiled for Windows.  The 32-bit modules will run properly on either 32-bit or 64-bit Windows version 7 or later.  The 64-bit modules will run only on 64-bit Windows.  The COM functionality in ExcelComTools and DBFXLStools2 is specific to Microsoft Windows. As of October, 2018, the LibXL product, upon which the ExcelTools module is based (also required for the DBFXLStools2 module) is a Windows-specific component.  A 64-bit version of ExcelTools is not provided in this release, but may be added in the future.  The Python implementation you are running will determine which 32-bit or 64-bit version of this package you will be running.

As of summer, 2026, the open source CodeBase(tm) product is only available for Windows.  However, Sequiter released their source code to open source in both Windows and Linux versions.  A future version of this Python module may be made available in Linux versions, if demand warrants and volunteer time is available for compiling and testing those versions. 
# Getting Started and Usage
A Users' Manual is available in the GitHub repository in .PDF format with detailed explanation of how to manipulate data quickly and easily with this product.  See [UsersGuideToPythonCodeBaseTools.PDF](https://docs.google.com/gview?url=https://raw.githubusercontent.com/MPSystemsServices/Python-CodeBase-Tools/master/Documentation/UsersGuideToPythonCodeBaseTools.pdf&embedded=true)
# Other Optional components
The .PYD files (like CodeBasePYWrapper3X.pyd) provide native Python API access directly to the functions in c4dll.dll or c4dll64.dll without need for ctypes to access the raw .DLL C functions.  There is a significant speed and simplicity benefit from moving more program functionality directly into a compiled C program using the Python C API library, enabling direct access to the contained functions from the Python interpreter.  However, before we had developed the .PYD file(s) we developed "wrapper" DLLs that could be accessed directly by Python using ctypes.  We have not obsoleted these components, and they and their C source code are found in the underlying GitHub repository referenced above.
