dflowfm-io 0.1.0.dev1__py3-none-win_amd64.whl
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.
- dflowfm_io/__init__.py +11 -0
- dflowfm_io/_lib/dflowfm_io_api.dll +0 -0
- dflowfm_io/_lib/library_path.py +4 -0
- dflowfm_io/base/__init__.py +27 -0
- dflowfm_io/base/bindings.py +88 -0
- dflowfm_io/base/errors.py +16 -0
- dflowfm_io/base/handle.py +11 -0
- dflowfm_io/base/library.py +53 -0
- dflowfm_io/issues.py +28 -0
- dflowfm_io/mdu/__init__.py +11 -0
- dflowfm_io/mdu/document.py +92 -0
- dflowfm_io/mdu/model.py +123 -0
- dflowfm_io/mdu/schema.py +7525 -0
- dflowfm_io-0.1.0.dev1.dist-info/METADATA +129 -0
- dflowfm_io-0.1.0.dev1.dist-info/RECORD +17 -0
- dflowfm_io-0.1.0.dev1.dist-info/WHEEL +5 -0
- dflowfm_io-0.1.0.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dflowfm_io
|
|
3
|
+
Version: 0.1.0.dev1
|
|
4
|
+
Summary: Python bindings for the shared D-FlowFM IO library (dflowfm_io_api).
|
|
5
|
+
Author: Deltares
|
|
6
|
+
License-Expression: LGPL-2.1-or-later
|
|
7
|
+
Project-URL: Repository, https://github.com/Deltares/Delft3D
|
|
8
|
+
Keywords: Delft3D,D-Flow FM,D-HYDRO,MDU,hydrodynamics
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# dflowfm_io
|
|
13
|
+
|
|
14
|
+
Python bindings for the shared D-Flow FM IO library (`dflowfm_io_api`). The native library is bundled
|
|
15
|
+
inside the wheel (`dflowfm_io/_lib/`) and loaded automatically, so consumers only need to
|
|
16
|
+
`pip install` the platform wheel.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Install the package from PyPI with:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python -m pip install dflowfm_io
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Prerequisites
|
|
27
|
+
|
|
28
|
+
- Python 3.11 or later.
|
|
29
|
+
- On Windows, the
|
|
30
|
+
[Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist)
|
|
31
|
+
may be required.
|
|
32
|
+
|
|
33
|
+
### Supported platforms
|
|
34
|
+
|
|
35
|
+
- 64-bit Windows.
|
|
36
|
+
- 64-bit x86 Linux with glibc 2.28 or later.
|
|
37
|
+
- macOS 15 or later on Intel or Apple Silicon.
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from dflowfm_io import MduDocument
|
|
43
|
+
|
|
44
|
+
document = MduDocument()
|
|
45
|
+
document.load_from_file("model.mdu")
|
|
46
|
+
print(document.model.get_string("general.program"))
|
|
47
|
+
|
|
48
|
+
for issue in document.report.get_issues():
|
|
49
|
+
print(issue)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Generated code
|
|
53
|
+
|
|
54
|
+
The typed Layer-2 `MduSchema` is **generated** from `json/mdu.json` — do **not** hand-edit it:
|
|
55
|
+
|
|
56
|
+
| Generator (`scripts/`) | Source of truth | Generates |
|
|
57
|
+
|-------------------------|--------------------------|-------------------------------|
|
|
58
|
+
| `generate_schema.py` | `../../../json/mdu.json` | `src/dflowfm_io/mdu/schema.py` — the typed Layer-2 `MduSchema` (one class per INI section, one typed property per keyword) plus a `KNOWN_PROPERTIES` registry of every dotted key |
|
|
59
|
+
|
|
60
|
+
Everything else is hand-written, including `base/bindings.py` (the ctypes ABI mirror: `argtypes`/
|
|
61
|
+
`restype`, the `mdu_severity_t` constants, and the `mdu_issue_t` struct), `mdu/model.py` (the typed
|
|
62
|
+
Layer-1 `MduModel` accessors) — both are small and rarely change, kept in sync with the C header by
|
|
63
|
+
hand — the `MduDocument` lifecycle, and the `Issue`/`Severity` value types.
|
|
64
|
+
|
|
65
|
+
**`schema.py` is not committed.** It is git-ignored and produced by the build — a build is needed to
|
|
66
|
+
use the package anyway, since it also stages the native library into `_lib/`. The CMake
|
|
67
|
+
`dflowfm_io_bindings` target regenerates it from `mdu.json`, so it can never drift from the schema; a
|
|
68
|
+
golden test asserts the on-disk file equals a fresh regeneration.
|
|
69
|
+
|
|
70
|
+
### Regenerating manually
|
|
71
|
+
|
|
72
|
+
The generator needs only Python 3 (standard library — no third-party dependencies). From this
|
|
73
|
+
directory (`wrappers/python`):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python scripts/generate_schema.py # -> mdu/schema.py
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
It prints what it wrote (e.g. `Wrote 22 sections, 703 typed properties ...`) and fails closed: an
|
|
80
|
+
unknown `mdu.json` value type or a name collision raises instead of silently dropping output.
|
|
81
|
+
|
|
82
|
+
### Regenerating through CMake
|
|
83
|
+
|
|
84
|
+
The `dflowfm_io_bindings` CMake target regenerates `schema.py`; it depends on `mdu.json` and the
|
|
85
|
+
generator, and the `dflowfm_io_wheel` target depends on it. So editing `mdu.json` and rebuilding is
|
|
86
|
+
enough — `schema.py` is regenerated automatically:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
cmake --build <build-dir> --target dflowfm_io_bindings --config Release
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
When `mdu.json` changes, edit it (never `schema.py`), then regenerate (either command above).
|
|
93
|
+
|
|
94
|
+
## Building the wheel
|
|
95
|
+
|
|
96
|
+
The wheel is built through CMake (the `dflowfm_io_wheel` target), which first compiles the native
|
|
97
|
+
library, stages it into `src/dflowfm_io/_lib/` (via the `dflowfm_io_stage_lib` target), and
|
|
98
|
+
regenerates the Python code, then runs `pip wheel`.
|
|
99
|
+
|
|
100
|
+
Configure the standalone `dflowfm_io` project once (see the top-level `dflowfm_io` README for the
|
|
101
|
+
configure step), then build the wheel target:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cmake --build <build-dir> --target dflowfm_io_wheel --config Release
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The wheel is written to `<build-dir>/dflowfm_io_api/wrappers/python/wheel/`, e.g.
|
|
108
|
+
`dflowfm_io-0.1.0-py3-none-win_amd64.whl`.
|
|
109
|
+
|
|
110
|
+
Notes:
|
|
111
|
+
|
|
112
|
+
- `--config Release` matters with the Visual Studio (multi-config) generator; a Debug wheel bundles a
|
|
113
|
+
debug-CRT library that will not load on machines without the debug runtime.
|
|
114
|
+
- The wheel is **not** part of the default build. Build the `dflowfm_io_wheel` target explicitly, or
|
|
115
|
+
opt it into the default build by configuring with `-D DFLOWFM_IO_BUILD_WRAPPER_PACKAGES=ON` (the
|
|
116
|
+
option is declared in `dflowfm_io/cmake/options.cmake`).
|
|
117
|
+
- The wheel target builds and stages the native library first, so `_lib/` is always populated before
|
|
118
|
+
`pip wheel` packages it.
|
|
119
|
+
|
|
120
|
+
## Running Python tests
|
|
121
|
+
|
|
122
|
+
After building through CMake, run from this directory in your virtual environment:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
python -m pip install -e . pytest # Once per environment
|
|
126
|
+
python -m pytest tests
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Python edits need no reinstall; native or schema changes require a CMake rebuild.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
dflowfm_io/__init__.py,sha256=Y4iEd4OAUay5vOPHvurhrMaI71E1BmeFpAiYpEkMmPM,529
|
|
2
|
+
dflowfm_io/issues.py,sha256=LU_BlKKBh-wNGsHRdDSKmIJAllmq5fNLmivaK5ffNMA,800
|
|
3
|
+
dflowfm_io/_lib/dflowfm_io_api.dll,sha256=Nn5G0f4J3ZXlYWxT80eLOJUv7AWPT_vnHyoCbURomEE,845824
|
|
4
|
+
dflowfm_io/_lib/library_path.py,sha256=2dIbbttnlkATc66KZynGBxK5_RqAbZaiCoKeH_IMhvo,144
|
|
5
|
+
dflowfm_io/base/__init__.py,sha256=mSDzr401H9tXJ_1CMZjxKgS8boIftFPuUzPBHF0jLT4,780
|
|
6
|
+
dflowfm_io/base/bindings.py,sha256=UQX7rW6m1Ql8jx0slMD-Wfpac5YZ-zSOf5tQ0WxvGeI,5142
|
|
7
|
+
dflowfm_io/base/errors.py,sha256=X7wsruf-kSEA2zltvECm7KPS2dJO6x7tZ2PqdTFPBa4,727
|
|
8
|
+
dflowfm_io/base/handle.py,sha256=tg-fnOYome0E-hK5GAzlb05Z0oHFqGhG0PSFknBkFoI,298
|
|
9
|
+
dflowfm_io/base/library.py,sha256=h3LVoMJu6JaeIdiSEV_PO_ZqLK-GmnOigSr4EwbsJO8,2043
|
|
10
|
+
dflowfm_io/mdu/__init__.py,sha256=6adnsK5d7JITmRD8fgJRQyGze76751xZAq4hcE8fikg,487
|
|
11
|
+
dflowfm_io/mdu/document.py,sha256=jqWkUbYnL4WMOUfOONOwn_XX0giDj6zd5ATuusmS1eA,3731
|
|
12
|
+
dflowfm_io/mdu/model.py,sha256=hyRkClZU6RKZtHZYkdJCHWqGkZPF1ya9ALQCp9BNf-Y,6210
|
|
13
|
+
dflowfm_io/mdu/schema.py,sha256=u_qQ-zhDP1yCOq-jWBjaOki9VZtT3j61LQsl03S11Q0,273261
|
|
14
|
+
dflowfm_io-0.1.0.dev1.dist-info/METADATA,sha256=CYv9oPMtYYfztGT0B7QVO2VDvPUSbqQcMfmF4SM--uA,5039
|
|
15
|
+
dflowfm_io-0.1.0.dev1.dist-info/WHEEL,sha256=79BCzrXBJOa2YV6ugKrK59dqWifMGjAkgVd_6AQrqbU,98
|
|
16
|
+
dflowfm_io-0.1.0.dev1.dist-info/top_level.txt,sha256=5ysX7p8HOPENeCXRwcR81zTTv3QuHSr8d5v5hrervtI,11
|
|
17
|
+
dflowfm_io-0.1.0.dev1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dflowfm_io
|