rustodbc-mi 0.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 (38) hide show
  1. rustodbc_mi-0.1.0/.env.example +26 -0
  2. rustodbc_mi-0.1.0/.github/workflows/ci.yml +99 -0
  3. rustodbc_mi-0.1.0/.github/workflows/publish.yml +82 -0
  4. rustodbc_mi-0.1.0/.github/workflows/release.yml +194 -0
  5. rustodbc_mi-0.1.0/.gitignore +14 -0
  6. rustodbc_mi-0.1.0/Cargo.lock +1302 -0
  7. rustodbc_mi-0.1.0/Cargo.toml +75 -0
  8. rustodbc_mi-0.1.0/PKG-INFO +289 -0
  9. rustodbc_mi-0.1.0/README.md +279 -0
  10. rustodbc_mi-0.1.0/pyproject.toml +25 -0
  11. rustodbc_mi-0.1.0/python/rustodbc/__init__.py +75 -0
  12. rustodbc_mi-0.1.0/python/rustodbc/__init__.pyi +149 -0
  13. rustodbc_mi-0.1.0/python/rustodbc/blocking.py +12 -0
  14. rustodbc_mi-0.1.0/python/rustodbc/py.typed +0 -0
  15. rustodbc_mi-0.1.0/rust-toolchain.toml +4 -0
  16. rustodbc_mi-0.1.0/src/arrow.rs +10 -0
  17. rustodbc_mi-0.1.0/src/blocking.rs +13 -0
  18. rustodbc_mi-0.1.0/src/bulk.rs +179 -0
  19. rustodbc_mi-0.1.0/src/config.rs +409 -0
  20. rustodbc_mi-0.1.0/src/core/ffi/conn.rs +159 -0
  21. rustodbc_mi-0.1.0/src/core/ffi/diag.rs +85 -0
  22. rustodbc_mi-0.1.0/src/core/ffi/env.rs +126 -0
  23. rustodbc_mi-0.1.0/src/core/ffi/mod.rs +18 -0
  24. rustodbc_mi-0.1.0/src/core/ffi/stmt.rs +379 -0
  25. rustodbc_mi-0.1.0/src/core/ffi/wchar.rs +34 -0
  26. rustodbc_mi-0.1.0/src/core/mod.rs +491 -0
  27. rustodbc_mi-0.1.0/src/engine.rs +431 -0
  28. rustodbc_mi-0.1.0/src/errors.rs +196 -0
  29. rustodbc_mi-0.1.0/src/lib.rs +70 -0
  30. rustodbc_mi-0.1.0/src/params.rs +197 -0
  31. rustodbc_mi-0.1.0/src/pool.rs +15 -0
  32. rustodbc_mi-0.1.0/src/proc.rs +75 -0
  33. rustodbc_mi-0.1.0/src/rows.rs +232 -0
  34. rustodbc_mi-0.1.0/src/stream.rs +146 -0
  35. rustodbc_mi-0.1.0/src/tablesync/catalog.rs +40 -0
  36. rustodbc_mi-0.1.0/src/tablesync/ddl.rs +13 -0
  37. rustodbc_mi-0.1.0/src/tablesync/merge.rs +134 -0
  38. rustodbc_mi-0.1.0/src/tablesync/mod.rs +184 -0
@@ -0,0 +1,26 @@
1
+ # rustodbc no carga .env por si sola al importar (ver AGENTS.md ss5).
2
+ # Este archivo documenta las variables que Credentials.from_env()/EngineOptions.from_env()
3
+ # leen; cargarlas es responsabilidad de la aplicacion consumidora (o llamar
4
+ # explicitamente a rustodbc.load_dotenv()).
5
+
6
+ # --- credenciales por cliente+entorno, convencion <VAR>_<CLIENTE>_<ENTORNO> ---
7
+ DB_SYSTEM_ACME_DEV=
8
+ DB_USER_ACME_DEV=
9
+ DB_PASSWORD_ACME_DEV=
10
+
11
+ # --- opcionales ---
12
+ APP_ENV=dev
13
+ # Si no se fija, se autodetecta con SQLDrivers (ver config.rs::PREFERRED_DRIVERS)
14
+ DB_DRIVER=
15
+
16
+ # --- tunables I/O-bound, deliberadamente NO cpu-aware ---
17
+ BATCH_SIZE=1000
18
+ MAX_WORKERS=4
19
+ MIN_ROWS_PER_WORKER=500
20
+ MERGE_CHUNK_SIZE=7000
21
+ MERGE_MAX_WORKERS=3
22
+
23
+ # --- especificas de rustodbc ---
24
+ RUSTODBC_POOL_SIZE=4
25
+ RUSTODBC_BLOCKING_THREADS=8
26
+ RUSTODBC_FETCH_ARRAY_SIZE=
@@ -0,0 +1,99 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ lint:
13
+ name: fmt + clippy (${{ matrix.os }})
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: [windows-2022, ubuntu-22.04]
19
+ steps:
20
+ - uses: actions/checkout@v5
21
+
22
+ - name: Install unixODBC dev headers (Linux only)
23
+ if: runner.os == 'Linux'
24
+ run: sudo apt-get update && sudo apt-get install --yes unixodbc-dev
25
+
26
+ - name: Install Rust toolchain
27
+ uses: dtolnay/rust-toolchain@stable
28
+ with:
29
+ components: rustfmt, clippy
30
+
31
+ - uses: Swatinem/rust-cache@v2
32
+
33
+ # Un solo paso para que el fmt NO tape los errores de clippy: se corre
34
+ # fmt (ignorando su salida), despues clippy (reporta errores de
35
+ # compilacion y lints), y al final fmt de nuevo como gatekeeper.
36
+ - name: cargo fmt + clippy
37
+ shell: bash
38
+ run: |
39
+ cargo fmt --check || true
40
+ cargo clippy --all-targets --all-features -- -D warnings
41
+ cargo fmt --check
42
+
43
+ # Invariante de AGENTS.md ss4: el GIL nunca se sostiene en el hilo
44
+ # bloqueante. Todo `Python::` en src/core/ (el FFI unsafe) es una
45
+ # violacion de esa regla. Se ignoran lineas de comentario/doc (//,
46
+ # ///, //!) -- los comentarios mencionan la regla, el codigo no debe
47
+ # usarla.
48
+ - name: Lint mecanico -- src/core/ nunca debe tocar el GIL
49
+ if: runner.os == 'Linux'
50
+ shell: bash
51
+ run: |
52
+ if grep -rn "Python::" src/core/ --include="*.rs" 2>/dev/null | grep -vE "^\s*[^:]+:[0-9]+:\s*(//|///|//!)" | grep -q "Python::"; then
53
+ echo "::error::src/core/ no debe referenciar Python:: (GIL) -- ver AGENTS.md ss4"
54
+ exit 1
55
+ fi
56
+
57
+ build:
58
+ name: build + smoke import (${{ matrix.os }})
59
+ runs-on: ${{ matrix.os }}
60
+ strategy:
61
+ fail-fast: false
62
+ matrix:
63
+ os: [windows-2022, ubuntu-22.04]
64
+ steps:
65
+ - uses: actions/checkout@v5
66
+
67
+ - name: Install unixODBC dev headers (Linux only)
68
+ if: runner.os == 'Linux'
69
+ run: sudo apt-get update && sudo apt-get install --yes unixodbc-dev
70
+
71
+ - name: Install Rust toolchain
72
+ uses: dtolnay/rust-toolchain@stable
73
+
74
+ - uses: Swatinem/rust-cache@v2
75
+
76
+ - uses: actions/setup-python@v6
77
+ with:
78
+ python-version: "3.12"
79
+
80
+ - name: cargo check --all-targets --all-features
81
+ run: cargo check --all-targets --all-features
82
+
83
+ - name: pip install maturin
84
+ run: python -m pip install --upgrade pip "maturin>=1.7,<2.0"
85
+
86
+ # `maturin develop` requiere un virtualenv activo -- en CI no hay.
87
+ # Se usa `maturin build` + `pip install <wheel>` (estandar para CI).
88
+ - name: maturin build --release
89
+ run: maturin build --release
90
+
91
+ - name: Instalar wheel y smoke import
92
+ shell: bash
93
+ run: |
94
+ pip install --force-reinstall target/wheels/rustodbc_mi-*.whl
95
+ python -c "import rustodbc; print(rustodbc.__version__)"
96
+
97
+ # No hay job de integracion contra un IBM i real: requiere un
98
+ # sistema DB2 for i accesible, que no existe en runners de GitHub.
99
+ # Ver AGENTS.md ss9 "No hay integracion de CI".
@@ -0,0 +1,82 @@
1
+ # Publica a PyPI los assets de un GitHub Release (sdist + wheels) via
2
+ # Trusted Publishing (OIDC) -- sin token de larga vida que rotar.
3
+ #
4
+ # Requiere configurar, UNA vez, el "trusted publisher" en pypi.org:
5
+ # Proyecto "rustodbc-mi" -> Publisher: GitHub -> este repo ->
6
+ # workflow "publish.yml" -> environment "pypi".
7
+ #
8
+ # El release se arma con release.yml (workflow_dispatch manual) y sube el
9
+ # sdist + wheels como assets; este workflow los baja y los publica a PyPI.
10
+
11
+ name: Publish
12
+
13
+ on:
14
+ workflow_dispatch:
15
+ inputs:
16
+ version:
17
+ description: 'Version to publish (e.g. 0.2.0). Leave empty for latest.'
18
+ required: false
19
+ type: string
20
+
21
+ jobs:
22
+ publish-to-pypi:
23
+ name: Publish to PyPI
24
+ runs-on: ubuntu-latest
25
+ environment:
26
+ name: pypi
27
+ url: https://pypi.org/project/rustodbc-mi
28
+ permissions:
29
+ id-token: write
30
+ contents: read # Required for gh release download
31
+
32
+ steps:
33
+ - uses: actions/checkout@v5
34
+
35
+ - name: Determine Release Tag
36
+ id: get_tag
37
+ env:
38
+ GH_TOKEN: ${{ github.token }}
39
+ run: |
40
+ if [ -z "${{ inputs.version }}" ]; then
41
+ echo "No version provided, fetching latest release..."
42
+ LATEST_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
43
+ echo "Latest tag: $LATEST_TAG"
44
+ echo "tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
45
+ else
46
+ echo "Using provided version: v${{ inputs.version }}"
47
+ # Ensure v prefix if missing, though user prompt implies raw version
48
+ if [[ "${{ inputs.version }}" == v* ]]; then
49
+ echo "tag=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
50
+ else
51
+ echo "tag=v${{ inputs.version }}" >> "$GITHUB_OUTPUT"
52
+ fi
53
+ fi
54
+
55
+ - name: Validate release exists
56
+ id: check_release
57
+ env:
58
+ GH_TOKEN: ${{ github.token }}
59
+ run: |
60
+ TAG="${{ steps.get_tag.outputs.tag }}"
61
+ if [ -z "$TAG" ] || [ "$TAG" = "null" ]; then
62
+ echo "::error::No se encontro ningun GitHub Release en este repo. Primero hay que correr release.yml (workflow_dispatch con la version) para crear el release con el sdist + wheels; despues volver a correr este publish.yml."
63
+ exit 1
64
+ fi
65
+ if ! gh release view "$TAG" --json tagName > /dev/null 2>&1; then
66
+ echo "::error::El release $TAG no existe. Correr release.yml primero para crear el release y subir los assets (sdist + wheels), y recien despues publicar con este workflow."
67
+ exit 1
68
+ fi
69
+ echo "Release $TAG encontrado."
70
+
71
+ - name: Download Release Assets
72
+ env:
73
+ GH_TOKEN: ${{ github.token }}
74
+ run: |
75
+ echo "Downloading assets for tag: ${{ steps.get_tag.outputs.tag }}"
76
+ gh release download ${{ steps.get_tag.outputs.tag }} --dir dist --pattern "*"
77
+
78
+ - name: List files
79
+ run: ls -R dist/
80
+
81
+ - name: Publish to PyPI
82
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,194 @@
1
+ # Arma los artifacts de un release (sdist + wheels) y publica un GitHub
2
+ # Release con todos ellos adjuntos. La publicacion a PyPI es un workflow
3
+ # separado (publish.yml) para poder re-publicar sin tener que re-buildear.
4
+ #
5
+ # Wheels: rustodbc usa maturin + abi3-py312 (un solo wheel por plataforma
6
+ # sirve 3.12/3.13/3.14+), asi que la build se hace con PyO3/maturin-action,
7
+ # no con cibuildwheel (que arma un wheel POR version de CPython -- no aplica
8
+ # aca). Ver AGENTS.md ss2 "Wheels".
9
+ #
10
+ # Plataformas: Windows x64 (odbc32.lib del Windows SDK, nada que vendorear) y
11
+ # Linux x86_64 manylinux + musllinux (unixODBC-devel en build, excluyendo
12
+ # libodbc.so.* del wheel -- en runtime lo da la imagen con ibm-iaccess). No
13
+ # hay macOS ni aarch64 todavia: no hay evidencia de que el driver *IBM i
14
+ # Access ODBC* exista para esas plataformas. Ver AGENTS.md ss2/ss9.
15
+
16
+ name: Release
17
+
18
+ on:
19
+ workflow_dispatch:
20
+ inputs:
21
+ version:
22
+ description: 'Version a liberar (ej. 0.2.0), sin la "v" inicial'
23
+ required: true
24
+ type: string
25
+
26
+ permissions:
27
+ contents: write
28
+
29
+ jobs:
30
+ bump_version:
31
+ name: Bump version + tag
32
+ runs-on: ubuntu-latest
33
+ outputs:
34
+ tag: v${{ inputs.version }}
35
+ steps:
36
+ - uses: actions/checkout@v5
37
+
38
+ - name: Actualizar version en Cargo.toml y pyproject.toml
39
+ run: |
40
+ sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' Cargo.toml
41
+ sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' pyproject.toml
42
+ git config user.name "github-actions[bot]"
43
+ git config user.email "github-actions[bot]@users.noreply.github.com"
44
+ git add Cargo.toml pyproject.toml
45
+ # Si la version ya era la pedida (release repetido), no hay nada que
46
+ # commitear -- el commit no debe fallar por eso.
47
+ if git diff --cached --quiet; then
48
+ echo "No hay cambios que commitear (la version ya es ${{ inputs.version }})."
49
+ else
50
+ git commit -m "Bump version to ${{ inputs.version }}"
51
+ git push
52
+ fi
53
+ git tag -f v${{ inputs.version }}
54
+ # -f: si un run anterior fallo a mitad (tag local creado sin push), el
55
+ # re-run recrea el tag apuntando al HEAD correcto.
56
+ git push -f origin v${{ inputs.version }}
57
+
58
+ build_sdist:
59
+ name: Build sdist
60
+ needs: bump_version
61
+ runs-on: ubuntu-latest
62
+ steps:
63
+ - uses: actions/checkout@v5
64
+ with:
65
+ ref: ${{ needs.bump_version.outputs.tag }}
66
+
67
+ - name: Install unixODBC dev headers
68
+ run: sudo apt-get update && sudo apt-get install --yes unixodbc-dev
69
+
70
+ - name: maturin sdist
71
+ uses: PyO3/maturin-action@v1
72
+ with:
73
+ command: sdist
74
+ args: --out dist
75
+
76
+ - uses: actions/upload-artifact@v4
77
+ with:
78
+ name: sdist__${{ github.sha }}
79
+ path: dist/*.tar.gz
80
+
81
+ build_windows_wheels:
82
+ name: Build wheels (Windows x64)
83
+ needs: bump_version
84
+ runs-on: windows-2022
85
+ steps:
86
+ - uses: actions/checkout@v5
87
+ with:
88
+ ref: ${{ needs.bump_version.outputs.tag }}
89
+
90
+ - uses: actions/setup-python@v6
91
+ with:
92
+ python-version: "3.12"
93
+
94
+ - name: Build wheel
95
+ uses: PyO3/maturin-action@v1
96
+ with:
97
+ target: x86_64-pc-windows-msvc
98
+ args: --release --out dist --features tablesync
99
+
100
+ - uses: actions/upload-artifact@v4
101
+ with:
102
+ name: wheels_windows__${{ github.sha }}
103
+ path: dist/*.whl
104
+
105
+ build_linux_manylinux:
106
+ name: Build wheels (manylinux x86_64)
107
+ needs: bump_version
108
+ runs-on: ubuntu-22.04
109
+ steps:
110
+ - uses: actions/checkout@v5
111
+ with:
112
+ ref: ${{ needs.bump_version.outputs.tag }}
113
+
114
+ - uses: actions/setup-python@v6
115
+ with:
116
+ python-version: "3.12"
117
+
118
+ # cibuildwheel (igual que el repo dvicente-miatech/pyodbc): usa la
119
+ # imagen manylinux oficial de PyPA e instala unixODBC-devel DENTRO del
120
+ # contenedor. El repair de auditwheel (con --exclude libodbc.so.*)
121
+ # corre tambien dentro del contenedor, donde patchelf es nuevo.
122
+ - name: Build wheels
123
+ uses: pypa/cibuildwheel@v3.2.1
124
+ env:
125
+ CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
126
+ CIBW_ARCHS_LINUX: x86_64
127
+ CIBW_BUILD: "cp312-manylinux_x86_64"
128
+ CIBW_BEFORE_ALL_LINUX: yum -y install unixODBC-devel
129
+ CIBW_TEST_COMMAND: ""
130
+ # libodbc.so.* NUNCA se vendorea (ver AGENTS.md ss2 "trampa
131
+ # CCSID/SQLWCHAR"): cargar el driver de IBM con opciones de
132
+ # SQLWCHAR distintas a las del sistema es un riesgo real.
133
+ CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair --exclude "libodbc.so.*" --wheel-dir {dest_dir} {wheel}
134
+
135
+ - uses: actions/upload-artifact@v4
136
+ with:
137
+ name: wheels_manylinux_x86_64__${{ github.sha }}
138
+ path: wheelhouse/*.whl
139
+
140
+ build_linux_musllinux:
141
+ name: Build wheels (musllinux x86_64)
142
+ needs: bump_version
143
+ runs-on: ubuntu-22.04
144
+ steps:
145
+ - uses: actions/checkout@v5
146
+ with:
147
+ ref: ${{ needs.bump_version.outputs.tag }}
148
+
149
+ - uses: actions/setup-python@v6
150
+ with:
151
+ python-version: "3.12"
152
+
153
+ # cibuildwheel con la imagen musllinux_1_2 oficial de PyPA (Alpine,
154
+ # con apk) -- igual que el repo de referencia.
155
+ - name: Build wheels
156
+ uses: pypa/cibuildwheel@v3.2.1
157
+ env:
158
+ CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
159
+ CIBW_ARCHS_LINUX: x86_64
160
+ CIBW_BUILD: "cp312-musllinux_x86_64"
161
+ CIBW_BEFORE_ALL_LINUX: apk add unixodbc-dev
162
+ CIBW_TEST_COMMAND: ""
163
+ CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair --exclude "libodbc.so.*" --wheel-dir {dest_dir} {wheel}
164
+
165
+ - uses: actions/upload-artifact@v4
166
+ with:
167
+ name: wheels_musllinux_x86_64__${{ github.sha }}
168
+ path: wheelhouse/*.whl
169
+
170
+ create_release:
171
+ name: Crear GitHub Release
172
+ needs:
173
+ - bump_version
174
+ - build_sdist
175
+ - build_windows_wheels
176
+ - build_linux_manylinux
177
+ - build_linux_musllinux
178
+ runs-on: ubuntu-latest
179
+ permissions:
180
+ contents: write
181
+ steps:
182
+ - name: Descargar todos los artifacts
183
+ uses: actions/download-artifact@v4
184
+ with:
185
+ path: dist
186
+ pattern: '*__${{ github.sha }}'
187
+ merge-multiple: true
188
+
189
+ - name: Crear GitHub Release
190
+ uses: softprops/action-gh-release@v2
191
+ with:
192
+ tag_name: ${{ needs.bump_version.outputs.tag }}
193
+ files: dist/*
194
+ generate_release_notes: true
@@ -0,0 +1,14 @@
1
+ /target/
2
+ /dist/
3
+ /build/
4
+ *.pyd
5
+ *.so
6
+ *.dll
7
+ __pycache__/
8
+ *.pyc
9
+ .venv/
10
+ .env
11
+ *.egg-info/
12
+
13
+ AGENTS.md
14
+ CLAUDE.md