qlix 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 (64) hide show
  1. qlix-0.1.0/.github/workflows/ci.yml +22 -0
  2. qlix-0.1.0/.github/workflows/publish.yml +42 -0
  3. qlix-0.1.0/.gitignore +9 -0
  4. qlix-0.1.0/CAPABILITIES.md +22 -0
  5. qlix-0.1.0/CUTOVER.md +45 -0
  6. qlix-0.1.0/LICENSE +21 -0
  7. qlix-0.1.0/PKG-INFO +112 -0
  8. qlix-0.1.0/README.md +89 -0
  9. qlix-0.1.0/RELEASE.md +9 -0
  10. qlix-0.1.0/examples/synthetic-smoke-ui.yaml +42 -0
  11. qlix-0.1.0/examples/synthetic-smoke.yaml +43 -0
  12. qlix-0.1.0/pyproject.toml +75 -0
  13. qlix-0.1.0/src/qlix/__init__.py +0 -0
  14. qlix-0.1.0/src/qlix/artifacts.py +39 -0
  15. qlix-0.1.0/src/qlix/auth/__init__.py +0 -0
  16. qlix-0.1.0/src/qlix/auth/browser.py +152 -0
  17. qlix-0.1.0/src/qlix/broker.py +1031 -0
  18. qlix-0.1.0/src/qlix/checks.py +117 -0
  19. qlix-0.1.0/src/qlix/cli.py +269 -0
  20. qlix-0.1.0/src/qlix/dsl/__init__.py +88 -0
  21. qlix-0.1.0/src/qlix/dsl/bookmark_audit.py +27 -0
  22. qlix-0.1.0/src/qlix/dsl/compiler.py +3062 -0
  23. qlix-0.1.0/src/qlix/dsl/engine_validation.py +14 -0
  24. qlix-0.1.0/src/qlix/dsl/expression_audit.py +310 -0
  25. qlix-0.1.0/src/qlix/dsl/field_audit.py +355 -0
  26. qlix-0.1.0/src/qlix/dsl/frontend_ui_acceptance.mjs +827 -0
  27. qlix-0.1.0/src/qlix/dsl/planner.py +769 -0
  28. qlix-0.1.0/src/qlix/dsl/runtime.py +942 -0
  29. qlix-0.1.0/src/qlix/dsl/schema.py +1669 -0
  30. qlix-0.1.0/src/qlix/dsl/spec.py +4357 -0
  31. qlix-0.1.0/src/qlix/dsl/ui_acceptance.py +685 -0
  32. qlix-0.1.0/src/qlix/dsl/ui_run.mjs +22 -0
  33. qlix-0.1.0/src/qlix/engine/__init__.py +0 -0
  34. qlix-0.1.0/src/qlix/engine/client.py +1389 -0
  35. qlix-0.1.0/src/qlix/engine/load_script.py +26 -0
  36. qlix-0.1.0/src/qlix/engine/master_guard.py +42 -0
  37. qlix-0.1.0/src/qlix/engine/qrs.py +79 -0
  38. qlix-0.1.0/src/qlix/engine/reload.py +195 -0
  39. qlix-0.1.0/src/qlix/engine/terminal_page.py +132 -0
  40. qlix-0.1.0/src/qlix/field_check.py +30 -0
  41. qlix-0.1.0/src/qlix/frontend_apply.py +130 -0
  42. qlix-0.1.0/src/qlix/py.typed +0 -0
  43. qlix-0.1.0/src/qlix/script_apply.py +157 -0
  44. qlix-0.1.0/src/qlix/script_diff.py +33 -0
  45. qlix-0.1.0/src/qlix/script_patch.py +53 -0
  46. qlix-0.1.0/src/qlix/script_plan.py +43 -0
  47. qlix-0.1.0/src/qlix/ui_run.py +36 -0
  48. qlix-0.1.0/tests/frontend_ui_acceptance.test.mjs +984 -0
  49. qlix-0.1.0/tests/test_broker.py +718 -0
  50. qlix-0.1.0/tests/test_browser_auth.py +252 -0
  51. qlix-0.1.0/tests/test_dsl_cli.py +75 -0
  52. qlix-0.1.0/tests/test_frontend_runtime.py +796 -0
  53. qlix-0.1.0/tests/test_master_guard.py +37 -0
  54. qlix-0.1.0/tests/test_persistent_reload.py +113 -0
  55. qlix-0.1.0/tests/test_qrs.py +72 -0
  56. qlix-0.1.0/tests/test_script_apply.py +160 -0
  57. qlix-0.1.0/tests/test_script_diff.py +23 -0
  58. qlix-0.1.0/tests/test_script_patch.py +62 -0
  59. qlix-0.1.0/tests/test_script_plan.py +69 -0
  60. qlix-0.1.0/tests/test_session_attempts.py +79 -0
  61. qlix-0.1.0/tests/test_session_reuse.py +218 -0
  62. qlix-0.1.0/tests/test_terminal_page.py +128 -0
  63. qlix-0.1.0/tests/test_ui_run.py +57 -0
  64. qlix-0.1.0/uv.lock +1422 -0
@@ -0,0 +1,22 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ check:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v5
14
+ with:
15
+ python-version: "3.12"
16
+ - run: uv sync --extra browser
17
+ - run: uv run --extra browser ruff check src tests
18
+ - run: uv run --extra browser ruff format --check src tests
19
+ - run: uv run --extra browser mypy src
20
+ - run: uv run --extra browser pytest -q
21
+ - run: uv build
22
+ - run: uv run twine check --strict dist/*
@@ -0,0 +1,42 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: astral-sh/setup-uv@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - run: uv sync --extra browser
18
+ - run: uv run --extra browser ruff check src tests
19
+ - run: uv run --extra browser ruff format --check src tests
20
+ - run: uv run --extra browser mypy src
21
+ - run: uv run --extra browser pytest -q
22
+ - run: uv build
23
+ - run: uv run twine check --strict dist/*
24
+ - uses: actions/upload-artifact@v4
25
+ with:
26
+ name: dist
27
+ path: dist/
28
+
29
+ publish:
30
+ needs: build
31
+ runs-on: ubuntu-latest
32
+ environment:
33
+ name: pypi
34
+ url: https://pypi.org/p/qlix
35
+ permissions:
36
+ id-token: write
37
+ steps:
38
+ - uses: actions/download-artifact@v4
39
+ with:
40
+ name: dist
41
+ path: dist/
42
+ - uses: pypa/gh-action-pypi-publish@release/v1
qlix-0.1.0/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
@@ -0,0 +1,22 @@
1
+ # Capability crosswalk
2
+
3
+ `qlix` consolidates the workflows already split between Dotfiles and Project Atom. The upstream CLI/API/SDK are the reference for supported operations and semantics, not a feature list to clone. “Ported” means the standalone package implements the capability; it does not mean either consumer has switched or the current build was tested against a live server.
4
+
5
+ | Capability and local source | `qlix` status | Upstream reference and parity check |
6
+ | --- | --- | --- |
7
+ | Shared named browser SSO and app selection — Dotfiles `bin/qlik` | **Ported.** `connect`, `connections`, `use`, `disconnect`; one per-user broker connection, serialized commands, idle teardown. | [CLI contexts](https://qlik.dev/toolkits/qlik-cli/qlik-cli-contexts/) document JWT for client-managed contexts; [Windows context login](https://qlik.dev/toolkits/qlik-cli/context/context-login/) documents username/password. No tested replacement for this deployment's interactive Microsoft/SAML session. A remembered app is not an open Engine document. |
8
+ | Engine sessions and app handles — Atom `qlik_engine.py`, `_browser_auth.py`; Dotfiles broker | **Ported.** Python transport and client; The broker reuses one same-app Engine connection and handle across serialized reads; handles are not exposed to CLI callers. | [QIX API](https://qlik.dev/apis/json-rpc/qix/) and [`@qlik/api/qix`](https://qlik.dev/toolkits/qlik-api/qix/) distinguish app sessions, identity/selection state, and resume/reconnect. This port does not promise SDK-style resumption, Cloud auth, or certificate auth. [`enigma.js`](https://github.com/qlik-oss/enigma.js) and [`enigma-go`](https://github.com/qlik-oss/enigma-go) are Engine clients, not browser SSO brokers. |
9
+ | App, sheet, field, object, and master inspection — Atom `list_apps.py`, `inspect_app.py`, `inspect_frontend.py`, `snapshot_master_library.py`; Dotfiles metadata commands | **Ported with interface changes.** `apps`, `sheets`, `fields`, `inspect`, `masters`; explicit QRS opt-in, dual-plane QIX/QRS master check. Old CSV output and legacy snapshot variants are not drop-in compatible. | [QRS client-managed guide](https://qlik.dev/toolkits/qlik-cli/qlik-cli-qrs-get-started/) and [SDK QIX app sessions and list APIs](https://qlik.dev/toolkits/qlik-api/qix/). QRS visibility is not an attestation of completeness; require matching Engine inventory. |
10
+ | Load-script read/syntax — Atom `reload_*.py`, `check_pri_script_syntax.py`, `check_tc_staging_script.py`, and syntax-check wrappers | **Ported for syntax and hashes.** `script-hash` and `script check`; anchor app can route the WebSocket without `OpenDoc`, and optional zero-valued parser variables exist only in the transient app. Raw diagnostics and script export are not CLI parity. | [Official `app validatescript`](https://qlik.dev/toolkits/qlik-cli/app/app-validatescript/) is the reference for script validation. The transient workflow uses `CreateSessionApp`, `CreateVariableEx`, `SetScript`, `CheckScriptSyntax`; no reload or save. A successful syntax check does not validate source data. |
11
+ | Script preview, preparation, deployment, reload, progress, cancellation — Atom `prepare_comop_m2_script.py`, `reload_pri_*`, `reload_vehicle_evolution.py`, `comop_reload_progress.py` | **Partial.** Offline candidate preparation via `script patch`, private local diff via `script diff`, read-only hash comparison via `script plan`, guarded script-only save/readback via `script apply`, and a monitored transient reload helper are ported. The Python-only persistent reload primitive configures full reload and checks terminal progress without saving, cancelling or retrying. Live verification and consumer integration remain. Keep target mapping, producer/consumer order, QVD readiness and domain-specific failure policy in Atom. | [Official `app build`](https://qlik.dev/toolkits/qlik-cli/app/app-build/) updates, reloads and saves by default, with `--no-reload` and `--no-save`. Do not replace Atom’s exact hash checks, private backups, domain readiness probes or save-after-verification rules with that default. [DoReloadEx](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/service-doc-doreloadex.htm) may report success when indexing fails, and [GetProgress(0)](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/service-global-getprogress.htm) returns reduced information. The helper treats missing terminal evidence as uncertain. |
12
+ | Declarative UI compiler, schemas, dependency audits, reviewed apply — Atom `libs/core/qlik_frontend`, `compile_*`, `diff_frontend`, `validate_frontend_*`, `apply_frontend` | **Ported.** `dsl` commands and Python APIs. Apply uses a separate session, requires explicit target and reviewed plan, journals before writes and has no automatic rollback. | [QIX](https://qlik.dev/apis/json-rpc/qix/) provides the actual properties and object APIs. [Official `app build`](https://qlik.dev/toolkits/qlik-cli/app/app-build/) accepts generic object JSON; it is not Atom’s YAML compiler or ownership-aware planner. Engine round-trip and actual rendering remain distinct checks. |
13
+ | One-off app repair guards — Atom `change_template.py`, `live_master_guard.py`, `dedupe_masters.py` and repair scripts | **Partial.** Snapshot/patch helpers and reusable measure/dimension drift guards are in the package. Generic orphan/inbound-reference checks still need an explicit safe deletion workflow if retained. App-specific patches, branding and destructive target lists stay in Atom. | Use QIX object/master properties and reference inventory for verification. A successful `Destroy*` call is not a proof of zero inbound references. |
14
+ | Browser UI acceptance — Atom `compile_frontend_ui_acceptance.py`, `frontend_ui_acceptance.mjs` | **Partial.** `dsl ui-schema`, `dsl ui-manifest`, and `dsl ui-run` expose the compiler and packaged runner. A trusted local driver supplies the authenticated tab; actual browser handoff and a live smoke remain. | QIX layout data is not a browser assertion. Keep this layer separate from Engine inspection. |
15
+
16
+ ## Reference boundaries
17
+
18
+ - [`qlik-oss/qlik-cli`](https://github.com/qlik-oss/qlik-cli) is a public **release mirror**, not a source-code dependency; [`qlik-api-ts`](https://github.com/qlik-oss/qlik-api-ts) is source for the JS/TS SDK. Its [client-managed examples](https://github.com/qlik-oss/qlik-api-ts/blob/main/docs/examples/qlik-sense-enterprise.md) use JWT or exported certificates. Compare distribution and auth separately.
19
+ - Qlik's [Python Platform SDK](https://qlik.dev/toolkits/platform-sdk/) is planned for deprecation and explicitly not recommended for new integrations.
20
+ - Cloud support, browser SSO on arbitrary proxies, server administration and a generic RPC CLI are **not** implied by this consolidation. The Python Engine client provides lower-level methods; permissions and deployment capabilities still come from Qlik.
21
+
22
+ Finish the verified ports before deleting their originals. See [CUTOVER.md](CUTOVER.md) for the consumer switch.
qlix-0.1.0/CUTOVER.md ADDED
@@ -0,0 +1,45 @@
1
+ # Remove the old Qlik implementations
2
+
3
+ `qlix` owns generic connection, QIX/QRS and frontend delivery code. Atom owns deployment defaults and business behavior. Dotfiles owns installation, operator defaults and Rex wiring. Do not retain local import shims or vendor the package in either repository.
4
+
5
+ ## Cutover criteria
6
+
7
+ The goal is a working replacement for each workflow the consumers still need, not a PyPI release or matching command names. A locally built wheel is sufficient for rehearsal. Before a shared checkout depends on the package, pin an artifact its consumers can install reproducibly; do not put a developer's checkout or home-directory path in the shared lockfile.
8
+
9
+ | Workflow | Evidence | Before retiring the original |
10
+ | --- | --- | --- |
11
+ | Dotfiles browser sign-in, reuse, and app/sheet metadata | Live two-terminal Rex smoke passed; idle/disconnect/error handling covered by subprocess tests. | Done for the local cutover; legacy broker and duplicate tests removed. |
12
+ | Atom frontend compiler, plan, and bundle provenance | Offline compiler, planner, and Qlik regression suites passed using the wheel in a disposable Atom checkout. | Keep domain artifacts in Atom and rerun after switching the pinned dependency. |
13
+ | Atom inventory, master snapshots, and syntax validation | Live QIX sheet/field commands and a complete private snapshot reused one socket (53 sheets, 261 fields, 140 reported masters). A seeded transient syntax check passed with zero errors and its second socket was not retained. Fake QRS contract tests pass. | Verify QRS on an authorized deployment if needed by consumers, and check legacy file formats before deleting wrappers. |
14
+ | Atom frontend writes and recovery | Fake Engine tests exercise drift rejection, journal-before-write, save, and verification. | With separate authorization, test on a disposable app: reviewed apply, reinspection/no-op, and drift rejection before writes. |
15
+ | Atom script deployment/reload | Local diff, hash-bound plan, guarded script-only save, and a caller-owned persistent reload helper are implemented. The helper monitors but does not save, retry, or cancel persistent work. | On an authorized disposable app, prove script save and that the deployment reports terminal progress through `GetProgress(0)`. Integrate the helper without changing Atom’s readiness checks, recovery policy or save ordering. |
16
+ | Atom browser acceptance | The installed CLI can export the suite schema, compile a manifest, and invoke the packaged runner through a trusted driver module. | Smoke-test a real driver on a disposable app; keep any Atom suites and fixtures that assert business behavior. |
17
+
18
+ Do not remove the remaining Atom implementation merely because a wheel builds or installs.
19
+
20
+ ## Atom
21
+
22
+ 1. Configure the package source and regenerate the Python lock with `uv`. Verify a clean sync without local `PYTHONPATH` additions.
23
+ 2. Put the virtual-proxy URL in Atom deployment configuration. Calls that depended on Atom's implicit default must pass it explicitly; the package intentionally has no deployment-specific default. Keep vehicle-specific `qlik_frontend.operational` logic in its Atom domain, not in the distributed DSL.
24
+ 3. Switch callers to `qlix.engine.client`, `qlix.auth.browser`, and `qlix.dsl`. Replace generic CLI invocations with the packaged commands once their flags and output formats are validated. Keep domain validators, script builders, QVS/DSL project assets and application bindings in Atom. Repoint any domain CLI that depends on a helper in an old standalone file before removing that file.
25
+ 4. Run Atom's data-free gate. On an authorized disposable test environment, verify client authentication, representative inspection, syntax check, and a dry-run plan made from a real snapshot. Verify any workflows that use raw Engine RPC or produce local artifacts, not just imports.
26
+ 5. Delete superseded implementations and duplicate tests after the callers pass; retain Atom-specific integration and domain regression tests. Search for old imports, CLI names, path setup and docs. Package QRS app discovery emits JSON, whereas the old app listing also wrote CSV; check consumers before treating those surfaces as identical.
27
+
28
+ ## Dotfiles
29
+
30
+ 1. Replace the `home/common.nix` symlink to `bin/qlik` with installation wiring for the pinned package, browser extra and a supported Chromium runtime. If the `qlik` alias is kept, it must only exec `qlix`. Update `skills/qlik/SKILL.md` and the Justfile test target; remove `QLIK_ATOM_ROOT` setup.
31
+ 2. In your Rex session, verify named connection reuse between terminals, Engine availability, and metadata commands. Brokers have separate profiles; coordinate reuse and shut down the old broker with its own command only when no other terminal needs it. Never copy cookies or remove active browser locks.
32
+ 3. Remove `bin/qlik` and the duplicated broker lifecycle tests once the installed replacement is working. Keep only a small wiring smoke test if needed.
33
+
34
+ ## Disposable rehearsal (local `0.1.0` wheel)
35
+
36
+ - `uv run --with` exercised Atom after removing its Engine, browser auth and generic DSL files in an archived copy and remapping 149 Python files. The Qlik-focused data-free suite passed 2,420 tests. One hidden dependency surfaced: the PRI review bundle hashes compiler source files. At cutover, fingerprint the installed `qlix.dsl` resources and distribution version, not absent `python/libs/core/qlik_frontend/*.py` paths.
37
+ - An isolated `uv tool install` proved the installed executable works without the Atom checkout and that a thin alias can call it. Tested version, local connection listing and offline compile only; Rex live session reuse was not tested. If official `qlik` is installed alongside this tool, use `qlix` as the entry point rather than shadowing it with an alias.
38
+
39
+ ## Dotfiles live smoke and retirement
40
+
41
+ The installed `0.1.0` wheel completed interactive browser SSO on WSLg from Rex. A second Rex terminal reused the same named broker to list apps and read sheet metadata. No apps were changed. Dotfiles then removed its broker and duplicate lifecycle tests; its Justfile accepts an approved wheel and verifies the supplied release SHA-256 before handing it to `uv`. The old implementing files' uncommitted changes were backed up privately before removal. The Atom import switch remains a rehearsal, not a production dependency change. A later parity run reached the Hub but the Engine socket closed with code 1001 (reported as a likely session limit). The transient syntax check did not run and private snapshot capture was not reached. No automatic retry or persistent app change occurred.
42
+
43
+ The updated broker subsequently passed the socket reuse and snapshot smoke in Rex: from zero Engine sockets, three metadata commands and a full private snapshot reached one successful open, with the same broker PID. The snapshot was mode `0600`; it was removed after counting metadata. A synthetic transient syntax check with a seeded variable increased the count to two, confirmed success, and left no cached Engine socket. There was no persistent save, reload, or app modification.
44
+
45
+ No release upload or app deployment is implied by building a wheel.
qlix-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Juan
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.
qlix-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.5
2
+ Name: qlix
3
+ Version: 0.1.0
4
+ Summary: CLI-centric Qlik Sense Engine API client, script manager, and declarative frontend DSL
5
+ Project-URL: Homepage, https://github.com/huaxel/qlix
6
+ Project-URL: Repository, https://github.com/huaxel/qlix
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: bi,cli,dsl,engine-api,qix,qlik,qlik-sense
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: pydantic>=2.0.0
19
+ Requires-Dist: pyyaml>=6.0.0
20
+ Provides-Extra: browser
21
+ Requires-Dist: playwright>=1.45.0; extra == 'browser'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # qlix
25
+
26
+ A standalone CLI and Python library for the Qlik Sense Engine API (QIX) and a declarative frontend YAML DSL. No Project Atom checkout, Dotfiles install, or organization-specific endpoint is required.
27
+
28
+ ## Install a local build
29
+
30
+ Requires Python 3.12+ on Unix. This is a private alpha; it has not been published to PyPI.
31
+
32
+ ```sh
33
+ uv build
34
+ uv tool install 'qlix[browser]' --find-links ./dist
35
+ uv tool run --from 'qlix[browser]' --find-links ./dist playwright install chromium
36
+ ```
37
+
38
+ The `browser` extra is only needed for live commands. Chromium needs its platform libraries and a graphical display for interactive sign-in. The existing browser profile can be reused with `QLIK_HEADLESS=1` if sign-in does not require interaction.
39
+
40
+ ## Connect and inspect
41
+
42
+ ```sh
43
+ qlix connect default --url https://qlik.example.com/proxy --wait
44
+ qlix connections
45
+ qlix apps
46
+ qlix apps --source qrs
47
+ qlix masters --app "$APP_ID" --output ./masters.json
48
+ qlix sheets --app "$APP_ID"
49
+ qlix fields --app "$APP_ID"
50
+ qlix inspect --app "$APP_ID" --output-dir ./inspection
51
+ qlix script-hash --app "$APP_ID"
52
+ qlix disconnect default
53
+ ```
54
+
55
+ The Unix broker owns the browser and serializes Engine calls. It keeps SSO alive across CLI invocations until explicit disconnect or idle timeout (20 minutes by default). Repeated metadata commands for the same app reuse its Engine socket and document handle. Switching apps or running a transient syntax check first closes the old socket; a syntax-check socket is not retained. Failed operations are not replayed. `connections` reports `engine_socket_opens` (successful opens for that broker) and `engine_session_cached` (a retained session, not a liveness probe). Disconnect affects all users of that named local connection. Use `--connection NAME` on inspection commands or set `QLIK_CONNECTION`. `use UUID --context NAME` remembers an app for `sheets` and `fields` for the lifetime of the broker. The broker and interactive apply commands take the same local endpoint lease: a second one cannot start until the first is closed. Engine handshakes do not retry automatically. A suspected session-limit refusal releases the browser, leaves `session-limit` visible, and blocks a fresh sign-in to that endpoint on this host for five minutes—even after disconnect or under another connection name. This is a local cooldown, not confirmation that Qlik freed an upstream slot; wait longer if your proxy requires it. Other clients and hosts do not share the lease. `connections` reports local broker status, not Engine health. `apps` defaults to Engine `GetDocList`; `--source qrs` uses the session's configured QRS access without opening an Engine socket. `masters` compares the QRS master inventory against QIX and refuses to write a file if they disagree. Use `inspect` for Engine-only inspection.
56
+
57
+ `inspect` captures app structure and master definitions, not data pages, in a new private directory. Treat definitions, field names, and embedded literals as sensitive. `script-hash` returns a SHA-256 digest, not live script contents. `qlix script check candidate.qvs` uses a transient Engine app; it does not reload, save, or open a persistent app. Use `--anchor-app UUID` if the proxy needs an app route and repeat `--seed-zero NAME` for parser defaults that a reload would otherwise assign. It reports a digest and error count, not raw Engine diagnostics. Broker requests are capped at 4 MiB including JSON encoding. The broker does not expose arbitrary RPC, export rows, or write persistent apps. The low-level `qlix.engine.client` library exposes Engine session/RPC methods to Python callers; do not assume those methods are read-only.
58
+
59
+ To prepare a load-script candidate offline from a reviewed JSON manifest:
60
+
61
+ ```sh
62
+ qlix script patch original.qvs --manifest changes.json --output candidate.qvs
63
+ ```
64
+
65
+ The manifest has a `changes` array with `name`, `before`, and `after` strings. Each `before` must occur exactly once in the original; overlapping edits are refused. The command writes a new owner-only file and prints source and candidate hashes, not script contents. This prepares a candidate; it does not connect, validate, or deploy it.
66
+
67
+ To compare that candidate with the current live script without sending its contents to Qlik:
68
+
69
+ ```sh
70
+ qlix script plan candidate.qvs --connection work --app "$APP_ID" --output script-plan.json
71
+ ```
72
+
73
+ To review the text as well, run `qlix script diff before.qvs candidate.qvs --output review.diff` on two local files. The diff is private and the JSON summary contains only hashes, a change flag, and the output path. Compare those hashes to the live plan before treating the diff as evidence for that plan.
74
+
75
+ The private plan binds the endpoint and app ID to the live and candidate SHA-256 digests. `noop` means the UTF-8 bytes match exactly; line-ending differences count as changes. The plan does not check syntax, authorize deployment, reload, or save.
76
+
77
+ `qlix script apply candidate.qvs --review-plan script-plan.json` rehearses offline. Saving requires `--apply --confirm-plan HASH --base-url URL --artifacts-dir EXISTING_DIR`, an exact candidate and target match, a transient syntax check, and a fresh live script comparison. It backs up the old script privately, journals attempts, and reopens the app to verify the script after saving. It does **not** reload, verify the data model, or roll back automatically. This path is covered by fake Engine tests; do not treat it as live acceptance.
78
+
79
+ ## Frontend DSL
80
+
81
+ ```sh
82
+ qlix dsl schema > frontend.schema.json
83
+ qlix dsl compile examples/synthetic-smoke.yaml --check
84
+ qlix dsl compile examples/synthetic-smoke.yaml > compiled.json
85
+ qlix dsl validate-fields spec.yaml inspection/app.json
86
+ qlix dsl validate-expressions spec.yaml --app "$APP_ID"
87
+ qlix dsl ui-manifest spec.yaml acceptance.yaml --app "$APP_ID" \
88
+ --base-url https://qlik.example.com/proxy --output acceptance.json
89
+ qlix dsl plan spec.yaml --app "$APP_ID" --snapshot inspection/app.json \
90
+ --library inspection/library.json > review.json
91
+ qlix dsl apply spec.yaml --app "$APP_ID" --snapshot inspection/app.json \
92
+ --library inspection/library.json --review-plan review.json
93
+ ```
94
+
95
+ Compilation, field auditing, UI manifest generation, planning, and apply preview are offline. `validate-expressions` uses the named broker for metadata-only checks of expressions, fields, variables, and bookmarks. Use `qlix dsl ui-schema` to export the acceptance suite schema. To run a compiled manifest, use `qlix dsl ui-run manifest.json --driver /path/to/trusted-driver.mjs --output report.json` (requires Node.js).
96
+
97
+ The driver is executable local code, not a downloaded manifest dependency. It exports `async withTab({baseUrl, appId}, run)`, supplies an authenticated tab on the intended disposable app's sheet, awaits `run(tab)` once, and owns cleanup. The tab must expose `playwright`, `goto`, `reload`, `getAXState`, and `dev.logs` as used by the packaged runner. Keep driver stdout clear. The CLI writes a new private report and exits nonzero on assertion failure. It does not open a browser, start SSO, or manage Qlik slots on the driver's behalf; use a driver that reuses the authorized browser session. This integration is tested offline, not live.
98
+
99
+ `dsl apply` defaults to an offline rehearsal against the exact reviewed plan. Only `--apply --confirm-plan HASH --base-url URL --artifacts-dir DIR` enables persistent writes. The endpoint must be the one reviewed by the operator: the plan binds the app ID, not the server. Live apply uses its own browser session, not the read-only broker. Coordinate with other users before ending a shared connection; do not run duplicate sign-ins or concurrent writers. The runtime checks for live drift, journals before mutation, saves and verifies, and writes a new ownership baseline; it does not provide automatic rollback. Start on a disposable app.
100
+
101
+ Direct certificate/API-key transports and administrative QRS lifecycle commands are not implemented. The Python-only `qlix.engine.reload.reload_open_document` configures and monitors a full reload on a caller-owned, dedicated Engine session; it does not save, cancel, or retry. It requires positive Engine success, terminal progress, and no reported reload or indexing errors. Qlik documents that `GetProgress(0)` provides reduced information, so missing terminal evidence fails closed. A reload can already have written shared outputs even if no app save occurs. The caller must handle authorization, backups, domain checks, recovery, and saving. The existing transient-only monitor remains separate and can request cancellation of its owned temporary reload.
102
+
103
+ ## Consumer cutover
104
+
105
+ `qlix` owns generic connection, Engine/QRS client, and frontend delivery code. Atom keeps deployment URLs and app bindings, QVS/DSL assets, and domain validation. Dotfiles keeps installation and shell/Rex wiring plus personal defaults, not a second broker. Dotfiles retired its implementation after a live two-terminal SSO and metadata smoke test; installation consumes a verified wheel. Atom still has its original implementation until a pinned build is available for reproducible installation and its caller migration is complete. Do not replace either with an absolute checkout path. See [the capability crosswalk](CAPABILITIES.md) for what has moved and how it compares with Qlik's tools, and [the cutover checklist](CUTOVER.md) for switching consumers.
106
+
107
+ ## Provenance and release gate
108
+
109
+ - Connection broker and lifecycle test patterns: Dotfiles `bin/qlik` and `scripts/tests/qlik-cli.test.py` from the local worktree based on `8a15e10` (including uncommitted broker lifecycle changes).
110
+ - Engine client, browser auth, frontend DSL and examples: Project Atom `qlik/tools/`, `python/libs/core/qlik_frontend/`, and `qlik/specs/` at `96805840f` (local extraction). Domain-specific operations and production fixtures are not part of this package.
111
+ - License: [MIT](LICENSE), selected by the owner of the extracted code. `qlix` is an independent project, not an official Qlik product.
112
+ - Before a PyPI upload: verify the exact release artifacts, confirm package-name acceptance and branding, and get explicit release approval. Browser SSO and read-only inventory were smoke-tested on one client-managed deployment; live writes were not tested. See [RELEASE.md](RELEASE.md).
qlix-0.1.0/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # qlix
2
+
3
+ A standalone CLI and Python library for the Qlik Sense Engine API (QIX) and a declarative frontend YAML DSL. No Project Atom checkout, Dotfiles install, or organization-specific endpoint is required.
4
+
5
+ ## Install a local build
6
+
7
+ Requires Python 3.12+ on Unix. This is a private alpha; it has not been published to PyPI.
8
+
9
+ ```sh
10
+ uv build
11
+ uv tool install 'qlix[browser]' --find-links ./dist
12
+ uv tool run --from 'qlix[browser]' --find-links ./dist playwright install chromium
13
+ ```
14
+
15
+ The `browser` extra is only needed for live commands. Chromium needs its platform libraries and a graphical display for interactive sign-in. The existing browser profile can be reused with `QLIK_HEADLESS=1` if sign-in does not require interaction.
16
+
17
+ ## Connect and inspect
18
+
19
+ ```sh
20
+ qlix connect default --url https://qlik.example.com/proxy --wait
21
+ qlix connections
22
+ qlix apps
23
+ qlix apps --source qrs
24
+ qlix masters --app "$APP_ID" --output ./masters.json
25
+ qlix sheets --app "$APP_ID"
26
+ qlix fields --app "$APP_ID"
27
+ qlix inspect --app "$APP_ID" --output-dir ./inspection
28
+ qlix script-hash --app "$APP_ID"
29
+ qlix disconnect default
30
+ ```
31
+
32
+ The Unix broker owns the browser and serializes Engine calls. It keeps SSO alive across CLI invocations until explicit disconnect or idle timeout (20 minutes by default). Repeated metadata commands for the same app reuse its Engine socket and document handle. Switching apps or running a transient syntax check first closes the old socket; a syntax-check socket is not retained. Failed operations are not replayed. `connections` reports `engine_socket_opens` (successful opens for that broker) and `engine_session_cached` (a retained session, not a liveness probe). Disconnect affects all users of that named local connection. Use `--connection NAME` on inspection commands or set `QLIK_CONNECTION`. `use UUID --context NAME` remembers an app for `sheets` and `fields` for the lifetime of the broker. The broker and interactive apply commands take the same local endpoint lease: a second one cannot start until the first is closed. Engine handshakes do not retry automatically. A suspected session-limit refusal releases the browser, leaves `session-limit` visible, and blocks a fresh sign-in to that endpoint on this host for five minutes—even after disconnect or under another connection name. This is a local cooldown, not confirmation that Qlik freed an upstream slot; wait longer if your proxy requires it. Other clients and hosts do not share the lease. `connections` reports local broker status, not Engine health. `apps` defaults to Engine `GetDocList`; `--source qrs` uses the session's configured QRS access without opening an Engine socket. `masters` compares the QRS master inventory against QIX and refuses to write a file if they disagree. Use `inspect` for Engine-only inspection.
33
+
34
+ `inspect` captures app structure and master definitions, not data pages, in a new private directory. Treat definitions, field names, and embedded literals as sensitive. `script-hash` returns a SHA-256 digest, not live script contents. `qlix script check candidate.qvs` uses a transient Engine app; it does not reload, save, or open a persistent app. Use `--anchor-app UUID` if the proxy needs an app route and repeat `--seed-zero NAME` for parser defaults that a reload would otherwise assign. It reports a digest and error count, not raw Engine diagnostics. Broker requests are capped at 4 MiB including JSON encoding. The broker does not expose arbitrary RPC, export rows, or write persistent apps. The low-level `qlix.engine.client` library exposes Engine session/RPC methods to Python callers; do not assume those methods are read-only.
35
+
36
+ To prepare a load-script candidate offline from a reviewed JSON manifest:
37
+
38
+ ```sh
39
+ qlix script patch original.qvs --manifest changes.json --output candidate.qvs
40
+ ```
41
+
42
+ The manifest has a `changes` array with `name`, `before`, and `after` strings. Each `before` must occur exactly once in the original; overlapping edits are refused. The command writes a new owner-only file and prints source and candidate hashes, not script contents. This prepares a candidate; it does not connect, validate, or deploy it.
43
+
44
+ To compare that candidate with the current live script without sending its contents to Qlik:
45
+
46
+ ```sh
47
+ qlix script plan candidate.qvs --connection work --app "$APP_ID" --output script-plan.json
48
+ ```
49
+
50
+ To review the text as well, run `qlix script diff before.qvs candidate.qvs --output review.diff` on two local files. The diff is private and the JSON summary contains only hashes, a change flag, and the output path. Compare those hashes to the live plan before treating the diff as evidence for that plan.
51
+
52
+ The private plan binds the endpoint and app ID to the live and candidate SHA-256 digests. `noop` means the UTF-8 bytes match exactly; line-ending differences count as changes. The plan does not check syntax, authorize deployment, reload, or save.
53
+
54
+ `qlix script apply candidate.qvs --review-plan script-plan.json` rehearses offline. Saving requires `--apply --confirm-plan HASH --base-url URL --artifacts-dir EXISTING_DIR`, an exact candidate and target match, a transient syntax check, and a fresh live script comparison. It backs up the old script privately, journals attempts, and reopens the app to verify the script after saving. It does **not** reload, verify the data model, or roll back automatically. This path is covered by fake Engine tests; do not treat it as live acceptance.
55
+
56
+ ## Frontend DSL
57
+
58
+ ```sh
59
+ qlix dsl schema > frontend.schema.json
60
+ qlix dsl compile examples/synthetic-smoke.yaml --check
61
+ qlix dsl compile examples/synthetic-smoke.yaml > compiled.json
62
+ qlix dsl validate-fields spec.yaml inspection/app.json
63
+ qlix dsl validate-expressions spec.yaml --app "$APP_ID"
64
+ qlix dsl ui-manifest spec.yaml acceptance.yaml --app "$APP_ID" \
65
+ --base-url https://qlik.example.com/proxy --output acceptance.json
66
+ qlix dsl plan spec.yaml --app "$APP_ID" --snapshot inspection/app.json \
67
+ --library inspection/library.json > review.json
68
+ qlix dsl apply spec.yaml --app "$APP_ID" --snapshot inspection/app.json \
69
+ --library inspection/library.json --review-plan review.json
70
+ ```
71
+
72
+ Compilation, field auditing, UI manifest generation, planning, and apply preview are offline. `validate-expressions` uses the named broker for metadata-only checks of expressions, fields, variables, and bookmarks. Use `qlix dsl ui-schema` to export the acceptance suite schema. To run a compiled manifest, use `qlix dsl ui-run manifest.json --driver /path/to/trusted-driver.mjs --output report.json` (requires Node.js).
73
+
74
+ The driver is executable local code, not a downloaded manifest dependency. It exports `async withTab({baseUrl, appId}, run)`, supplies an authenticated tab on the intended disposable app's sheet, awaits `run(tab)` once, and owns cleanup. The tab must expose `playwright`, `goto`, `reload`, `getAXState`, and `dev.logs` as used by the packaged runner. Keep driver stdout clear. The CLI writes a new private report and exits nonzero on assertion failure. It does not open a browser, start SSO, or manage Qlik slots on the driver's behalf; use a driver that reuses the authorized browser session. This integration is tested offline, not live.
75
+
76
+ `dsl apply` defaults to an offline rehearsal against the exact reviewed plan. Only `--apply --confirm-plan HASH --base-url URL --artifacts-dir DIR` enables persistent writes. The endpoint must be the one reviewed by the operator: the plan binds the app ID, not the server. Live apply uses its own browser session, not the read-only broker. Coordinate with other users before ending a shared connection; do not run duplicate sign-ins or concurrent writers. The runtime checks for live drift, journals before mutation, saves and verifies, and writes a new ownership baseline; it does not provide automatic rollback. Start on a disposable app.
77
+
78
+ Direct certificate/API-key transports and administrative QRS lifecycle commands are not implemented. The Python-only `qlix.engine.reload.reload_open_document` configures and monitors a full reload on a caller-owned, dedicated Engine session; it does not save, cancel, or retry. It requires positive Engine success, terminal progress, and no reported reload or indexing errors. Qlik documents that `GetProgress(0)` provides reduced information, so missing terminal evidence fails closed. A reload can already have written shared outputs even if no app save occurs. The caller must handle authorization, backups, domain checks, recovery, and saving. The existing transient-only monitor remains separate and can request cancellation of its owned temporary reload.
79
+
80
+ ## Consumer cutover
81
+
82
+ `qlix` owns generic connection, Engine/QRS client, and frontend delivery code. Atom keeps deployment URLs and app bindings, QVS/DSL assets, and domain validation. Dotfiles keeps installation and shell/Rex wiring plus personal defaults, not a second broker. Dotfiles retired its implementation after a live two-terminal SSO and metadata smoke test; installation consumes a verified wheel. Atom still has its original implementation until a pinned build is available for reproducible installation and its caller migration is complete. Do not replace either with an absolute checkout path. See [the capability crosswalk](CAPABILITIES.md) for what has moved and how it compares with Qlik's tools, and [the cutover checklist](CUTOVER.md) for switching consumers.
83
+
84
+ ## Provenance and release gate
85
+
86
+ - Connection broker and lifecycle test patterns: Dotfiles `bin/qlik` and `scripts/tests/qlik-cli.test.py` from the local worktree based on `8a15e10` (including uncommitted broker lifecycle changes).
87
+ - Engine client, browser auth, frontend DSL and examples: Project Atom `qlik/tools/`, `python/libs/core/qlik_frontend/`, and `qlik/specs/` at `96805840f` (local extraction). Domain-specific operations and production fixtures are not part of this package.
88
+ - License: [MIT](LICENSE), selected by the owner of the extracted code. `qlix` is an independent project, not an official Qlik product.
89
+ - Before a PyPI upload: verify the exact release artifacts, confirm package-name acceptance and branding, and get explicit release approval. Browser SSO and read-only inventory were smoke-tested on one client-managed deployment; live writes were not tested. See [RELEASE.md](RELEASE.md).
qlix-0.1.0/RELEASE.md ADDED
@@ -0,0 +1,9 @@
1
+ # Preparing a release
2
+
3
+ `qlix` is MIT-licensed. Source provenance is documented in [README.md](README.md). Qlik is not the publisher of this package.
4
+
5
+ 1. Choose a new version if the same version was ever uploaded. Check PyPI name acceptance separately; a missing listing does not reserve the name.
6
+ 2. Verify and build from the intended source revision with `uv run --extra browser ruff check`, `uv run --extra browser mypy src`, `uv run --extra browser pytest`, then `uv build`.
7
+ 3. Run `uv run twine check --strict` against the exact wheel and sdist. Check they contain `LICENSE` and `License-Expression: MIT`. Review the artifact file lists for deployment configuration, credentials, data, and local build debris; verify an installed-wheel smoke outside the checkout. Record both artifact digests.
8
+ 4. Upload only after explicit release approval. If using PyPI Trusted Publishing, use the authorized repository and release workflow. Do not copy tokens into source, tool arguments, or terminal logs.
9
+ 5. After release, lock Atom against the approved published version before removing its duplicated generic implementation. See [CUTOVER.md](CUTOVER.md).
@@ -0,0 +1,42 @@
1
+ # UI acceptance over the synthetic smoke specification: three objects, no fiscal
2
+ # fields. Compiles offline; running it needs an inspected disposable app because
3
+ # every checkpoint performs a real browser action.
4
+ version: 1
5
+ start_sheet: pilot
6
+ steps:
7
+ - name: loaded
8
+ sheet: pilot
9
+ values:
10
+ - object: constant
11
+ text: "1"
12
+ texts:
13
+ - object: series
14
+ text: "Série synthétique"
15
+ table_headers:
16
+ - object: rows
17
+ text: "Pas synthétique"
18
+ visible: true
19
+ table_rows:
20
+ - object: rows
21
+ cells: ["1", "1"]
22
+ # The ordering form: row 4 appears below row 5 on the rendered axis.
23
+ - object: rows
24
+ cells: ["4", "1"]
25
+ before_cells: ["5", "1"]
26
+ # The absence form: no rendered row may match a fourth synthetic step.
27
+ - object: rows
28
+ cells: ["99", "1"]
29
+ visible: false
30
+ - name: reloaded
31
+ sheet: pilot
32
+ reload: true
33
+ values:
34
+ - object: constant
35
+ text: "1"
36
+ cleanup:
37
+ - name: release
38
+ sheet: pilot
39
+ reload: true
40
+ values:
41
+ - object: constant
42
+ text: "1"
@@ -0,0 +1,43 @@
1
+ # Synthetic frontend smoke test: no data fields, load scripts, or live app binding.
2
+ # Compile offline; any live application still requires an inspected disposable app
3
+ # and separate approval of the exact generated plan.
4
+ version: 1
5
+ app: frontend_smoke
6
+
7
+ dimensions:
8
+ step:
9
+ expression: "=ValueLoop(1,3)"
10
+ label: "Pas synthétique"
11
+ field_dependencies: []
12
+
13
+ measures:
14
+ constant:
15
+ expression: "1"
16
+ label: "Valeur synthétique (attendue : 1)"
17
+ format: integer
18
+
19
+ sheets:
20
+ pilot:
21
+ title: "Validation DSL — test synthétique"
22
+ description: "Tests isolés : KPI, série et tableau synthétiques, sans champs fiscaux"
23
+ grid: [24, 12]
24
+ objects:
25
+ constant:
26
+ type: kpi
27
+ title: "KPI synthétique : 1"
28
+ subtitle: "Validation du compilateur DSL, sans lecture des données fiscales"
29
+ measure: constant
30
+ position: [0, 0, 12, 3]
31
+ series:
32
+ type: line
33
+ title: "Série synthétique — trois points"
34
+ dimension: step
35
+ measure: constant
36
+ position: [0, 3, 12, 9]
37
+ rows:
38
+ type: table
39
+ show_totals: false
40
+ title: "Tableau synthétique — trois lignes"
41
+ dimension: step
42
+ measure: constant
43
+ position: [12, 3, 12, 9]
@@ -0,0 +1,75 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "qlix"
7
+ version = "0.1.0"
8
+ description = "CLI-centric Qlik Sense Engine API client, script manager, and declarative frontend DSL"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.12"
13
+ keywords = ["qlik", "qlik-sense", "qix", "engine-api", "cli", "dsl", "bi"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Typing :: Typed",
22
+ ]
23
+ dependencies = [
24
+ "pydantic>=2.0.0",
25
+ "pyyaml>=6.0.0",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ browser = ["playwright>=1.45.0"]
30
+
31
+ [project.scripts]
32
+ qlix = "qlix.cli:main"
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/huaxel/qlix"
36
+ Repository = "https://github.com/huaxel/qlix"
37
+
38
+ [dependency-groups]
39
+ dev = [
40
+ "pytest>=8.0.0",
41
+ "pytest-asyncio>=0.24.0",
42
+ "jsonschema>=4.25.0",
43
+ "ruff>=0.8.0",
44
+ "mypy>=1.13.0",
45
+ "types-PyYAML>=6.0.0",
46
+ "build>=1.2.0",
47
+ "twine>=6.0.0",
48
+ ]
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["src/qlix"]
52
+
53
+ [tool.ruff]
54
+ line-length = 100
55
+ target-version = "py312"
56
+
57
+ [tool.ruff.lint]
58
+ select = ["E", "F", "I", "UP", "B", "SIM"]
59
+ ignore = ["E501"]
60
+
61
+ [tool.ruff.lint.per-file-ignores]
62
+ "src/qlix/dsl/*.py" = ["B905", "SIM102"] # Inherited DSL; preserve upstream behavior.
63
+ "tests/*.py" = ["SIM117"]
64
+
65
+ [tool.mypy]
66
+ python_version = "3.12"
67
+ warn_unused_configs = true
68
+ disallow_untyped_defs = true
69
+ check_untyped_defs = true
70
+ mypy_path = "src"
71
+
72
+ [tool.pytest.ini_options]
73
+ testpaths = ["tests"]
74
+ asyncio_mode = "auto"
75
+ asyncio_default_fixture_loop_scope = "function"
File without changes
@@ -0,0 +1,39 @@
1
+ """Private, atomically installed local workflow artifacts."""
2
+
3
+ import json
4
+ import os
5
+ import uuid
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+
10
+ def durable_json(path: Path, value: dict[str, Any], *, replace: bool = False) -> None:
11
+ """Serialize and atomically install a private JSON artifact."""
12
+ payload = json.dumps(value, indent=2, ensure_ascii=False, allow_nan=False) + "\n"
13
+ durable_bytes(path, payload.encode("utf-8"), replace=replace)
14
+
15
+
16
+ def durable_bytes(path: Path, payload: bytes, *, replace: bool = False) -> None:
17
+ """Private artifact, fsynced and atomically installed; no clobber by default."""
18
+ if path.exists() and not replace:
19
+ raise FileExistsError(f"Artifact already exists: {path}")
20
+ temporary = path.with_name(path.name + "." + uuid.uuid4().hex + ".tmp")
21
+ descriptor = os.open(temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
22
+ try:
23
+ with os.fdopen(descriptor, "wb") as stream:
24
+ stream.write(payload)
25
+ stream.flush()
26
+ os.fsync(stream.fileno())
27
+ if replace:
28
+ os.replace(temporary, path)
29
+ else:
30
+ # The destination must not exist at installation time, even if another
31
+ # process creates it after the pre-existence check above.
32
+ os.link(temporary, path)
33
+ directory = os.open(path.parent, os.O_RDONLY)
34
+ try:
35
+ os.fsync(directory)
36
+ finally:
37
+ os.close(directory)
38
+ finally:
39
+ temporary.unlink(missing_ok=True)
File without changes