Skip to main content

Read and write the original Schichtplaner5 FoxPro .DBF database files, plus the SQLite/PostgreSQL ORM and sync layer used by OpenSchichtplaner5.

Project description

libopenschichtplaner5

CI License: MIT

The core library behind OpenSchichtplaner5 — a pip-installable package that reads and writes the original Schichtplaner5 FoxPro/dBASE .DBF database files, so an open replacement can run on the exact same data as the proprietary Windows tool, with no migration.

Import name: the distribution is libopenschichtplaner5, but the importable package keeps its historical name sp5lib (like pip install PyYAMLimport yaml). This keeps OpenSchichtplaner5's imports unchanged after the extraction.

What's inside

Module Purpose
sp5lib.dbf_reader Pure-Python DBF reader (UTF-16-LE detection, date parsing, field decode)
sp5lib.dbf_writer Safe DBF writer — exclusive flock, TOCTOU-safe record count, rollback, EOF marker preservation
sp5lib.database High-level SP5Database facade over the DBF tables (employees, shifts, schedule, absences, auth, 2FA …)
sp5lib.db_factory / sqlite_adapter / pg_database Optional SQLite / PostgreSQL backends
sp5lib.orm SQLAlchemy models (models.py SQLite, models_pg.py Postgres), repository, sync
sp5lib.auto_migrate Alembic-based automatic migrations
sp5lib.email_service SMTP notification emails (HTML-escaped templates)
sp5lib.color_utils FoxPro BGR ↔ hex/RGB color helpers

Installation

pip install "libopenschichtplaner5 @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
# with the optional PostgreSQL backend:
pip install "libopenschichtplaner5[postgres] @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"

Usage

from sp5lib.database import SP5Database

db = SP5Database("/path/to/SP5/Daten")        # directory of .DBF files
for emp in db.get_employees():
    print(emp["ID"], emp["NAME"], emp["FIRSTNAME"])

Low-level DBF access:

from sp5lib.dbf_reader import read_dbf
from sp5lib.dbf_writer import append_record, get_table_fields

rows   = read_dbf("/path/to/SP5/Daten/5EMPL.DBF")
fields = get_table_fields("/path/to/SP5/Daten/5EMPL.DBF")
append_record("/path/to/SP5/Daten/5NOTE.DBF", fields, {"ID": 1, "TEXT": "hello"})

Dependencies

Runtime: SQLAlchemy, alembic, bcrypt, pyotp, packaging. Optional: psycopg2-binary (via the postgres extra) for the PostgreSQL backend.

Development

python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev,postgres]"
pytest
ruff check .

License

MIT — see LICENSE. Extracted (with full git history) from OpenSchichtplaner5's backend/sp5lib/.

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

libopenschichtplaner5-1.5.0.tar.gz (95.2 kB view details)

Uploaded Source

Built Distribution

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

libopenschichtplaner5-1.5.0-py3-none-any.whl (96.0 kB view details)

Uploaded Python 3

File details

Details for the file libopenschichtplaner5-1.5.0.tar.gz.

File metadata

  • Download URL: libopenschichtplaner5-1.5.0.tar.gz
  • Upload date:
  • Size: 95.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libopenschichtplaner5-1.5.0.tar.gz
Algorithm Hash digest
SHA256 9753a6f8418fd8f65b5d0b3d6545bd2b333a29bcf15ed6eeb8a8942ca098fec1
MD5 6bdb505ea54a3c846a0e78f31b957aff
BLAKE2b-256 2cb5988943e49765cde6e4c8076ac06a6691290eb7313465e4542104444808ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for libopenschichtplaner5-1.5.0.tar.gz:

Publisher: release.yml on mschabhuettl/libopenschichtplaner5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libopenschichtplaner5-1.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for libopenschichtplaner5-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b9b88be5a4326faa6bd861a6b923386a6163c4e5ecd57580284973a7fe19dc4
MD5 d7177bc9bc73af5c1c593fa375aead38
BLAKE2b-256 3a36a957c3f916f6a4ec5dd2b09a3ba094a2dc154f3be4848e25980d25601c5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for libopenschichtplaner5-1.5.0-py3-none-any.whl:

Publisher: release.yml on mschabhuettl/libopenschichtplaner5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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