libopenschichtplaner5 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. libopenschichtplaner5-1.1.0/LICENSE +21 -0
  2. libopenschichtplaner5-1.1.0/PKG-INFO +113 -0
  3. libopenschichtplaner5-1.1.0/README.md +74 -0
  4. libopenschichtplaner5-1.1.0/libopenschichtplaner5.egg-info/PKG-INFO +113 -0
  5. libopenschichtplaner5-1.1.0/libopenschichtplaner5.egg-info/SOURCES.txt +28 -0
  6. libopenschichtplaner5-1.1.0/libopenschichtplaner5.egg-info/dependency_links.txt +1 -0
  7. libopenschichtplaner5-1.1.0/libopenschichtplaner5.egg-info/requires.txt +13 -0
  8. libopenschichtplaner5-1.1.0/libopenschichtplaner5.egg-info/top_level.txt +1 -0
  9. libopenschichtplaner5-1.1.0/pyproject.toml +71 -0
  10. libopenschichtplaner5-1.1.0/setup.cfg +4 -0
  11. libopenschichtplaner5-1.1.0/sp5lib/__init__.py +1 -0
  12. libopenschichtplaner5-1.1.0/sp5lib/_resource_paths.py +40 -0
  13. libopenschichtplaner5-1.1.0/sp5lib/auto_migrate.py +435 -0
  14. libopenschichtplaner5-1.1.0/sp5lib/color_utils.py +26 -0
  15. libopenschichtplaner5-1.1.0/sp5lib/database.py +6240 -0
  16. libopenschichtplaner5-1.1.0/sp5lib/db_config.py +39 -0
  17. libopenschichtplaner5-1.1.0/sp5lib/db_factory.py +55 -0
  18. libopenschichtplaner5-1.1.0/sp5lib/dbf_reader.py +212 -0
  19. libopenschichtplaner5-1.1.0/sp5lib/dbf_writer.py +459 -0
  20. libopenschichtplaner5-1.1.0/sp5lib/email_service.py +273 -0
  21. libopenschichtplaner5-1.1.0/sp5lib/orm/__init__.py +22 -0
  22. libopenschichtplaner5-1.1.0/sp5lib/orm/base.py +107 -0
  23. libopenschichtplaner5-1.1.0/sp5lib/orm/models.py +264 -0
  24. libopenschichtplaner5-1.1.0/sp5lib/orm/models_pg.py +321 -0
  25. libopenschichtplaner5-1.1.0/sp5lib/orm/repository.py +185 -0
  26. libopenschichtplaner5-1.1.0/sp5lib/orm/sync.py +160 -0
  27. libopenschichtplaner5-1.1.0/sp5lib/pg_database.py +1132 -0
  28. libopenschichtplaner5-1.1.0/sp5lib/py.typed +0 -0
  29. libopenschichtplaner5-1.1.0/sp5lib/sqlite_adapter.py +289 -0
  30. libopenschichtplaner5-1.1.0/tests/test_dbf.py +122 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matthias Schabhüttl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: libopenschichtplaner5
3
+ Version: 1.1.0
4
+ Summary: Read and write the original Schichtplaner5 FoxPro .DBF database files, plus the SQLite/PostgreSQL ORM and sync layer used by OpenSchichtplaner5.
5
+ Author-email: Matthias Schabhüttl <matthias@matthiasschabhuettl.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/mschabhuettl/libopenschichtplaner5
8
+ Project-URL: Source, https://github.com/mschabhuettl/libopenschichtplaner5
9
+ Project-URL: Changelog, https://github.com/mschabhuettl/libopenschichtplaner5/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/mschabhuettl/libopenschichtplaner5/issues
11
+ Project-URL: Main application, https://github.com/mschabhuettl/openschichtplaner5
12
+ Keywords: schichtplaner5,dbf,foxpro,shift-planning,dbase
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Office/Business :: Scheduling
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: SQLAlchemy>=2.0.0
28
+ Requires-Dist: alembic>=1.13.0
29
+ Requires-Dist: bcrypt>=4.0.0
30
+ Requires-Dist: pyotp>=2.9.0
31
+ Requires-Dist: packaging>=21.0
32
+ Provides-Extra: postgres
33
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ # libopenschichtplaner5
41
+
42
+ [![CI](https://github.com/mschabhuettl/libopenschichtplaner5/actions/workflows/ci.yml/badge.svg)](https://github.com/mschabhuettl/libopenschichtplaner5/actions/workflows/ci.yml)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
44
+
45
+ The core library behind [**OpenSchichtplaner5**](https://github.com/mschabhuettl/openschichtplaner5) —
46
+ a pip-installable package that reads **and writes** the original *Schichtplaner5*
47
+ FoxPro/dBASE `.DBF` database files, so an open replacement can run on the exact same
48
+ data as the proprietary Windows tool, with no migration.
49
+
50
+ > **Import name:** the distribution is `libopenschichtplaner5`, but the importable
51
+ > package keeps its historical name **`sp5lib`** (like `pip install PyYAML` → `import yaml`).
52
+ > This keeps OpenSchichtplaner5's imports unchanged after the extraction.
53
+
54
+ ## What's inside
55
+
56
+ | Module | Purpose |
57
+ |---|---|
58
+ | `sp5lib.dbf_reader` | Pure-Python DBF reader (UTF-16-LE detection, date parsing, field decode) |
59
+ | `sp5lib.dbf_writer` | Safe DBF writer — exclusive `flock`, TOCTOU-safe record count, rollback, EOF marker preservation |
60
+ | `sp5lib.database` | High-level `SP5Database` facade over the DBF tables (employees, shifts, schedule, absences, auth, 2FA …) |
61
+ | `sp5lib.db_factory` / `sqlite_adapter` / `pg_database` | Optional SQLite / PostgreSQL backends |
62
+ | `sp5lib.orm` | SQLAlchemy models (`models.py` SQLite, `models_pg.py` Postgres), `repository`, `sync` |
63
+ | `sp5lib.auto_migrate` | Alembic-based automatic migrations |
64
+ | `sp5lib.email_service` | SMTP notification emails (HTML-escaped templates) |
65
+ | `sp5lib.color_utils` | FoxPro BGR ↔ hex/RGB color helpers |
66
+
67
+ ## Installation
68
+
69
+ ```bash
70
+ pip install "libopenschichtplaner5 @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
71
+ # with the optional PostgreSQL backend:
72
+ pip install "libopenschichtplaner5[postgres] @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
73
+ ```
74
+
75
+ ## Usage
76
+
77
+ ```python
78
+ from sp5lib.database import SP5Database
79
+
80
+ db = SP5Database("/path/to/SP5/Daten") # directory of .DBF files
81
+ for emp in db.get_employees():
82
+ print(emp["ID"], emp["NAME"], emp["FIRSTNAME"])
83
+ ```
84
+
85
+ Low-level DBF access:
86
+
87
+ ```python
88
+ from sp5lib.dbf_reader import read_dbf
89
+ from sp5lib.dbf_writer import append_record, get_table_fields
90
+
91
+ rows = read_dbf("/path/to/SP5/Daten/5EMPL.DBF")
92
+ fields = get_table_fields("/path/to/SP5/Daten/5EMPL.DBF")
93
+ append_record("/path/to/SP5/Daten/5NOTE.DBF", fields, {"ID": 1, "TEXT": "hello"})
94
+ ```
95
+
96
+ ## Dependencies
97
+
98
+ Runtime: `SQLAlchemy`, `alembic`, `bcrypt`, `pyotp`, `packaging`.
99
+ Optional: `psycopg2-binary` (via the `postgres` extra) for the PostgreSQL backend.
100
+
101
+ ## Development
102
+
103
+ ```bash
104
+ python -m venv .venv && . .venv/bin/activate
105
+ pip install -e ".[dev,postgres]"
106
+ pytest
107
+ ruff check .
108
+ ```
109
+
110
+ ## License
111
+
112
+ MIT — see [LICENSE](LICENSE). Extracted (with full git history) from
113
+ [OpenSchichtplaner5](https://github.com/mschabhuettl/openschichtplaner5)'s `backend/sp5lib/`.
@@ -0,0 +1,74 @@
1
+ # libopenschichtplaner5
2
+
3
+ [![CI](https://github.com/mschabhuettl/libopenschichtplaner5/actions/workflows/ci.yml/badge.svg)](https://github.com/mschabhuettl/libopenschichtplaner5/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
+
6
+ The core library behind [**OpenSchichtplaner5**](https://github.com/mschabhuettl/openschichtplaner5) —
7
+ a pip-installable package that reads **and writes** the original *Schichtplaner5*
8
+ FoxPro/dBASE `.DBF` database files, so an open replacement can run on the exact same
9
+ data as the proprietary Windows tool, with no migration.
10
+
11
+ > **Import name:** the distribution is `libopenschichtplaner5`, but the importable
12
+ > package keeps its historical name **`sp5lib`** (like `pip install PyYAML` → `import yaml`).
13
+ > This keeps OpenSchichtplaner5's imports unchanged after the extraction.
14
+
15
+ ## What's inside
16
+
17
+ | Module | Purpose |
18
+ |---|---|
19
+ | `sp5lib.dbf_reader` | Pure-Python DBF reader (UTF-16-LE detection, date parsing, field decode) |
20
+ | `sp5lib.dbf_writer` | Safe DBF writer — exclusive `flock`, TOCTOU-safe record count, rollback, EOF marker preservation |
21
+ | `sp5lib.database` | High-level `SP5Database` facade over the DBF tables (employees, shifts, schedule, absences, auth, 2FA …) |
22
+ | `sp5lib.db_factory` / `sqlite_adapter` / `pg_database` | Optional SQLite / PostgreSQL backends |
23
+ | `sp5lib.orm` | SQLAlchemy models (`models.py` SQLite, `models_pg.py` Postgres), `repository`, `sync` |
24
+ | `sp5lib.auto_migrate` | Alembic-based automatic migrations |
25
+ | `sp5lib.email_service` | SMTP notification emails (HTML-escaped templates) |
26
+ | `sp5lib.color_utils` | FoxPro BGR ↔ hex/RGB color helpers |
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install "libopenschichtplaner5 @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
32
+ # with the optional PostgreSQL backend:
33
+ pip install "libopenschichtplaner5[postgres] @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from sp5lib.database import SP5Database
40
+
41
+ db = SP5Database("/path/to/SP5/Daten") # directory of .DBF files
42
+ for emp in db.get_employees():
43
+ print(emp["ID"], emp["NAME"], emp["FIRSTNAME"])
44
+ ```
45
+
46
+ Low-level DBF access:
47
+
48
+ ```python
49
+ from sp5lib.dbf_reader import read_dbf
50
+ from sp5lib.dbf_writer import append_record, get_table_fields
51
+
52
+ rows = read_dbf("/path/to/SP5/Daten/5EMPL.DBF")
53
+ fields = get_table_fields("/path/to/SP5/Daten/5EMPL.DBF")
54
+ append_record("/path/to/SP5/Daten/5NOTE.DBF", fields, {"ID": 1, "TEXT": "hello"})
55
+ ```
56
+
57
+ ## Dependencies
58
+
59
+ Runtime: `SQLAlchemy`, `alembic`, `bcrypt`, `pyotp`, `packaging`.
60
+ Optional: `psycopg2-binary` (via the `postgres` extra) for the PostgreSQL backend.
61
+
62
+ ## Development
63
+
64
+ ```bash
65
+ python -m venv .venv && . .venv/bin/activate
66
+ pip install -e ".[dev,postgres]"
67
+ pytest
68
+ ruff check .
69
+ ```
70
+
71
+ ## License
72
+
73
+ MIT — see [LICENSE](LICENSE). Extracted (with full git history) from
74
+ [OpenSchichtplaner5](https://github.com/mschabhuettl/openschichtplaner5)'s `backend/sp5lib/`.
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: libopenschichtplaner5
3
+ Version: 1.1.0
4
+ Summary: Read and write the original Schichtplaner5 FoxPro .DBF database files, plus the SQLite/PostgreSQL ORM and sync layer used by OpenSchichtplaner5.
5
+ Author-email: Matthias Schabhüttl <matthias@matthiasschabhuettl.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/mschabhuettl/libopenschichtplaner5
8
+ Project-URL: Source, https://github.com/mschabhuettl/libopenschichtplaner5
9
+ Project-URL: Changelog, https://github.com/mschabhuettl/libopenschichtplaner5/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/mschabhuettl/libopenschichtplaner5/issues
11
+ Project-URL: Main application, https://github.com/mschabhuettl/openschichtplaner5
12
+ Keywords: schichtplaner5,dbf,foxpro,shift-planning,dbase
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Office/Business :: Scheduling
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: SQLAlchemy>=2.0.0
28
+ Requires-Dist: alembic>=1.13.0
29
+ Requires-Dist: bcrypt>=4.0.0
30
+ Requires-Dist: pyotp>=2.9.0
31
+ Requires-Dist: packaging>=21.0
32
+ Provides-Extra: postgres
33
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ # libopenschichtplaner5
41
+
42
+ [![CI](https://github.com/mschabhuettl/libopenschichtplaner5/actions/workflows/ci.yml/badge.svg)](https://github.com/mschabhuettl/libopenschichtplaner5/actions/workflows/ci.yml)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
44
+
45
+ The core library behind [**OpenSchichtplaner5**](https://github.com/mschabhuettl/openschichtplaner5) —
46
+ a pip-installable package that reads **and writes** the original *Schichtplaner5*
47
+ FoxPro/dBASE `.DBF` database files, so an open replacement can run on the exact same
48
+ data as the proprietary Windows tool, with no migration.
49
+
50
+ > **Import name:** the distribution is `libopenschichtplaner5`, but the importable
51
+ > package keeps its historical name **`sp5lib`** (like `pip install PyYAML` → `import yaml`).
52
+ > This keeps OpenSchichtplaner5's imports unchanged after the extraction.
53
+
54
+ ## What's inside
55
+
56
+ | Module | Purpose |
57
+ |---|---|
58
+ | `sp5lib.dbf_reader` | Pure-Python DBF reader (UTF-16-LE detection, date parsing, field decode) |
59
+ | `sp5lib.dbf_writer` | Safe DBF writer — exclusive `flock`, TOCTOU-safe record count, rollback, EOF marker preservation |
60
+ | `sp5lib.database` | High-level `SP5Database` facade over the DBF tables (employees, shifts, schedule, absences, auth, 2FA …) |
61
+ | `sp5lib.db_factory` / `sqlite_adapter` / `pg_database` | Optional SQLite / PostgreSQL backends |
62
+ | `sp5lib.orm` | SQLAlchemy models (`models.py` SQLite, `models_pg.py` Postgres), `repository`, `sync` |
63
+ | `sp5lib.auto_migrate` | Alembic-based automatic migrations |
64
+ | `sp5lib.email_service` | SMTP notification emails (HTML-escaped templates) |
65
+ | `sp5lib.color_utils` | FoxPro BGR ↔ hex/RGB color helpers |
66
+
67
+ ## Installation
68
+
69
+ ```bash
70
+ pip install "libopenschichtplaner5 @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
71
+ # with the optional PostgreSQL backend:
72
+ pip install "libopenschichtplaner5[postgres] @ git+https://github.com/mschabhuettl/libopenschichtplaner5.git"
73
+ ```
74
+
75
+ ## Usage
76
+
77
+ ```python
78
+ from sp5lib.database import SP5Database
79
+
80
+ db = SP5Database("/path/to/SP5/Daten") # directory of .DBF files
81
+ for emp in db.get_employees():
82
+ print(emp["ID"], emp["NAME"], emp["FIRSTNAME"])
83
+ ```
84
+
85
+ Low-level DBF access:
86
+
87
+ ```python
88
+ from sp5lib.dbf_reader import read_dbf
89
+ from sp5lib.dbf_writer import append_record, get_table_fields
90
+
91
+ rows = read_dbf("/path/to/SP5/Daten/5EMPL.DBF")
92
+ fields = get_table_fields("/path/to/SP5/Daten/5EMPL.DBF")
93
+ append_record("/path/to/SP5/Daten/5NOTE.DBF", fields, {"ID": 1, "TEXT": "hello"})
94
+ ```
95
+
96
+ ## Dependencies
97
+
98
+ Runtime: `SQLAlchemy`, `alembic`, `bcrypt`, `pyotp`, `packaging`.
99
+ Optional: `psycopg2-binary` (via the `postgres` extra) for the PostgreSQL backend.
100
+
101
+ ## Development
102
+
103
+ ```bash
104
+ python -m venv .venv && . .venv/bin/activate
105
+ pip install -e ".[dev,postgres]"
106
+ pytest
107
+ ruff check .
108
+ ```
109
+
110
+ ## License
111
+
112
+ MIT — see [LICENSE](LICENSE). Extracted (with full git history) from
113
+ [OpenSchichtplaner5](https://github.com/mschabhuettl/openschichtplaner5)'s `backend/sp5lib/`.
@@ -0,0 +1,28 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ libopenschichtplaner5.egg-info/PKG-INFO
5
+ libopenschichtplaner5.egg-info/SOURCES.txt
6
+ libopenschichtplaner5.egg-info/dependency_links.txt
7
+ libopenschichtplaner5.egg-info/requires.txt
8
+ libopenschichtplaner5.egg-info/top_level.txt
9
+ sp5lib/__init__.py
10
+ sp5lib/_resource_paths.py
11
+ sp5lib/auto_migrate.py
12
+ sp5lib/color_utils.py
13
+ sp5lib/database.py
14
+ sp5lib/db_config.py
15
+ sp5lib/db_factory.py
16
+ sp5lib/dbf_reader.py
17
+ sp5lib/dbf_writer.py
18
+ sp5lib/email_service.py
19
+ sp5lib/pg_database.py
20
+ sp5lib/py.typed
21
+ sp5lib/sqlite_adapter.py
22
+ sp5lib/orm/__init__.py
23
+ sp5lib/orm/base.py
24
+ sp5lib/orm/models.py
25
+ sp5lib/orm/models_pg.py
26
+ sp5lib/orm/repository.py
27
+ sp5lib/orm/sync.py
28
+ tests/test_dbf.py
@@ -0,0 +1,13 @@
1
+ SQLAlchemy>=2.0.0
2
+ alembic>=1.13.0
3
+ bcrypt>=4.0.0
4
+ pyotp>=2.9.0
5
+ packaging>=21.0
6
+
7
+ [dev]
8
+ pytest>=7.4.0
9
+ pytest-cov>=4.1.0
10
+ ruff>=0.1.0
11
+
12
+ [postgres]
13
+ psycopg2-binary>=2.9.0
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "libopenschichtplaner5"
7
+ version = "1.1.0"
8
+ description = "Read and write the original Schichtplaner5 FoxPro .DBF database files, plus the SQLite/PostgreSQL ORM and sync layer used by OpenSchichtplaner5."
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Matthias Schabhüttl", email = "matthias@matthiasschabhuettl.com" }]
13
+ requires-python = ">=3.10"
14
+ keywords = ["schichtplaner5", "dbf", "foxpro", "shift-planning", "dbase"]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Database",
25
+ "Topic :: Office/Business :: Scheduling",
26
+ "Typing :: Typed",
27
+ ]
28
+ dependencies = [
29
+ "SQLAlchemy>=2.0.0",
30
+ "alembic>=1.13.0",
31
+ "bcrypt>=4.0.0",
32
+ "pyotp>=2.9.0",
33
+ "packaging>=21.0",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ postgres = ["psycopg2-binary>=2.9.0"]
38
+ dev = [
39
+ "pytest>=7.4.0",
40
+ "pytest-cov>=4.1.0",
41
+ "ruff>=0.1.0",
42
+ ]
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/mschabhuettl/libopenschichtplaner5"
46
+ Source = "https://github.com/mschabhuettl/libopenschichtplaner5"
47
+ Changelog = "https://github.com/mschabhuettl/libopenschichtplaner5/blob/main/CHANGELOG.md"
48
+ Issues = "https://github.com/mschabhuettl/libopenschichtplaner5/issues"
49
+ "Main application" = "https://github.com/mschabhuettl/openschichtplaner5"
50
+
51
+ [tool.setuptools]
52
+ packages = ["sp5lib", "sp5lib.orm"]
53
+
54
+ [tool.setuptools.package-data]
55
+ sp5lib = ["py.typed"]
56
+
57
+ [tool.ruff]
58
+ target-version = "py310"
59
+ line-length = 100
60
+
61
+ [tool.ruff.lint]
62
+ select = ["E", "W", "F", "I", "B", "UP"]
63
+ ignore = [
64
+ "E501", # line too long (handled by formatter)
65
+ "E712", # == False / == True — required for SQLAlchemy WHERE clauses
66
+ "B008", # function calls in default arguments
67
+ "B904", # raise-without-from-inside-except — inherited, fix incrementally
68
+ ]
69
+
70
+ [tool.pytest.ini_options]
71
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ # OpenSchichtplaner5 - Python library for reading Schichtplaner5 databases
@@ -0,0 +1,40 @@
1
+ """Resolution of host-application resource directories.
2
+
3
+ Historically these modules lived inside the OpenSchichtplaner5 ``backend/`` tree and
4
+ located sibling resources (``backend/data``, ``backend/api/data``, the Alembic
5
+ directory) via paths relative to ``__file__``. Once this library is installed as a
6
+ standalone package (``libopenschichtplaner5``) that assumption no longer holds — the
7
+ package lives in ``site-packages`` and the host app's data lives elsewhere.
8
+
9
+ The host application therefore tells the library where its backend root is via the
10
+ ``SP5_BACKEND_DIR`` environment variable. When unset, we fall back to the legacy
11
+ ``<this_package_parent>`` location so an in-tree checkout keeps working unchanged.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import os
17
+
18
+
19
+ def backend_dir() -> str:
20
+ """Return the host application's backend root directory.
21
+
22
+ Honors ``SP5_BACKEND_DIR``; otherwise falls back to the directory that contains
23
+ this package (the legacy in-tree layout ``<backend>/sp5lib/``).
24
+ """
25
+ env = os.environ.get("SP5_BACKEND_DIR")
26
+ if env:
27
+ return os.path.abspath(env)
28
+ return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
29
+
30
+
31
+ def data_dir() -> str:
32
+ """``<backend>/data`` — JSON-backed settings (changelog, swaps, comments …)."""
33
+ path = os.path.join(backend_dir(), "data")
34
+ os.makedirs(path, exist_ok=True)
35
+ return path
36
+
37
+
38
+ def api_data_dir() -> str:
39
+ """``<backend>/api/data`` — availability / skills JSON written by the API layer."""
40
+ return os.path.join(backend_dir(), "api", "data")