@bluedynamics/cdk8s-plone 0.3.1 → 0.3.3

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 (68) hide show
  1. package/.jsii +2 -2
  2. package/lib/config/plone-vinyl-backend-response.vcl +25 -0
  3. package/lib/config/plone-vinyl-recv.vcl +18 -0
  4. package/{examples/volto → lib}/config/varnish.tpl.vcl +1 -1
  5. package/lib/httpcache.js +1 -1
  6. package/lib/plone.js +1 -1
  7. package/lib/vinylcache.js +1 -1
  8. package/package.json +3 -2
  9. package/.claude/claude.md +0 -39
  10. package/.claude/settings.local.json +0 -31
  11. package/CLAUDE.md +0 -352
  12. package/docs/superpowers/plans/2026-06-12-configurable-service-spec.md +0 -608
  13. package/docs/superpowers/specs/2026-06-12-configurable-service-spec-design.md +0 -192
  14. package/documentation/Makefile +0 -357
  15. package/documentation/README.md +0 -284
  16. package/documentation/mx.ini +0 -3
  17. package/documentation/sources/_static/logo.svg +0 -79
  18. package/documentation/sources/conf.py +0 -145
  19. package/documentation/sources/explanation/architecture.md +0 -336
  20. package/documentation/sources/explanation/cdk8s-workflow.md +0 -66
  21. package/documentation/sources/explanation/features.md +0 -374
  22. package/documentation/sources/explanation/index.md +0 -34
  23. package/documentation/sources/how-to/backup-and-restore.md +0 -107
  24. package/documentation/sources/how-to/configure-env-and-secrets.md +0 -184
  25. package/documentation/sources/how-to/configure-ingress-tls.md +0 -108
  26. package/documentation/sources/how-to/configure-security-context.md +0 -143
  27. package/documentation/sources/how-to/deploy-blicca.md +0 -334
  28. package/documentation/sources/how-to/deploy-volto.md +0 -324
  29. package/documentation/sources/how-to/deploy-with-httpcache.md +0 -224
  30. package/documentation/sources/how-to/deploy-with-vinyl-cache.md +0 -273
  31. package/documentation/sources/how-to/enable-prometheus-monitoring.md +0 -122
  32. package/documentation/sources/how-to/index.md +0 -85
  33. package/documentation/sources/how-to/scale-and-high-availability.md +0 -122
  34. package/documentation/sources/how-to/schedule-pods.md +0 -145
  35. package/documentation/sources/how-to/setup-prerequisites.md +0 -363
  36. package/documentation/sources/how-to/troubleshooting.md +0 -113
  37. package/documentation/sources/how-to/upgrade-and-rollout.md +0 -140
  38. package/documentation/sources/index.md +0 -109
  39. package/documentation/sources/reference/api/index.md +0 -40
  40. package/documentation/sources/reference/configuration-options.md +0 -352
  41. package/documentation/sources/reference/index.md +0 -41
  42. package/documentation/sources/tutorials/01-quick-start.md +0 -165
  43. package/documentation/sources/tutorials/index.md +0 -53
  44. package/examples/blicca/.env.example +0 -20
  45. package/examples/blicca/README.md +0 -339
  46. package/examples/blicca/__snapshots__/main.test.ts.snap +0 -1035
  47. package/examples/blicca/cdk8s.yaml +0 -6
  48. package/examples/blicca/config/varnish.tpl.vcl +0 -217
  49. package/examples/blicca/ingress.ts +0 -217
  50. package/examples/blicca/jest.config.js +0 -11
  51. package/examples/blicca/main.test.ts +0 -18
  52. package/examples/blicca/main.ts +0 -101
  53. package/examples/blicca/package.json +0 -36
  54. package/examples/blicca/postgres.cloudnativepg.ts +0 -63
  55. package/examples/blicca/postgres.plain.ts +0 -115
  56. package/examples/blicca/tsconfig.json +0 -33
  57. package/examples/volto/.env.example +0 -21
  58. package/examples/volto/README.md +0 -292
  59. package/examples/volto/__snapshots__/main.test.ts.snap +0 -1206
  60. package/examples/volto/cdk8s.yaml +0 -6
  61. package/examples/volto/ingress.ts +0 -229
  62. package/examples/volto/jest.config.js +0 -11
  63. package/examples/volto/main.test.ts +0 -18
  64. package/examples/volto/main.ts +0 -105
  65. package/examples/volto/package.json +0 -36
  66. package/examples/volto/postgres.cloudnativepg.ts +0 -63
  67. package/examples/volto/postgres.plain.ts +0 -115
  68. package/examples/volto/tsconfig.json +0 -33
@@ -1,192 +0,0 @@
1
- # Design: Generisch steuerbare Service-Resourcen
2
-
3
- **Datum:** 2026-06-12
4
- **Branch:** `feat/configurable-service-spec`
5
- **Status:** Approved (Design)
6
-
7
- ## Problem
8
-
9
- Die von cdk8s-plone generierten Kubernetes-`Service`-Resourcen sind schlecht
10
- steuerbar. Konkreter Anlass: Es soll `spec.trafficDistribution` gesetzt werden
11
- können — das geht aktuell nicht. Generell ist die `Service`-Spec faktisch
12
- hartcodiert: In [`src/service.ts`](../../../src/service.ts) baut `PloneService`
13
- über das rohe `k8s.KubeService` nur `spec.ports` + `spec.selector`. Alle anderen
14
- Felder (`type`, `sessionAffinity`, `externalTrafficPolicy`,
15
- `internalTrafficPolicy`, `publishNotReadyAddresses`, `loadBalancerClass`,
16
- `trafficDistribution`, …) sind nicht durchgereicht.
17
-
18
- Zusätzlich ist das Plumbing nicht wartbar: Nach oben (in
19
- [`src/plone.ts`](../../../src/plone.ts)) wird pro Feld einzeln geplumbt — aktuell
20
- nur `serviceAnnotations`. Jedes neue Feld bräuchte Änderungen an mehreren Stellen.
21
-
22
- ## Ziel
23
-
24
- Service-Spec-Felder konfigurierbar machen — möglichst generisch, mit wenig
25
- Pflegeaufwand pro Feld, JSII-/Python-kompatibel, ohne Breaking Change.
26
-
27
- ## Designentscheidungen (bestätigt)
28
-
29
- - **Hybrid-Ansatz:** Kuratierte typisierte Props für die häufigen Felder PLUS
30
- ein generischer Escape-Hatch für alles Übrige.
31
- - **Gruppiertes Plumbing:** Ein einziges `service`-Objekt in `PloneBaseOptions`
32
- statt flacher Einzel-Props. Neue Felder ändern nur den Config-Typ.
33
- - **`overrides`-Präzedenz:** `overrides` darf *alles* überschreiben (auch
34
- `ports`/`selector`) — volle Kontrolle für Power-User, dokumentiert.
35
-
36
- ## Lösung
37
-
38
- ### 1. Neuer Config-Typ `PloneServiceSpec` (in `src/service.ts`)
39
-
40
- ```typescript
41
- export interface PloneServiceSpec {
42
- // Kuratierte, häufig gebrauchte Felder (alle optional, typisiert, dokumentiert):
43
- readonly type?: string; // ClusterIP | NodePort | LoadBalancer | ExternalName
44
- readonly trafficDistribution?: string; // z.B. 'PreferClose'
45
- readonly sessionAffinity?: string; // 'ClientIP' | 'None'
46
- readonly externalTrafficPolicy?: string; // 'Cluster' | 'Local'
47
- readonly internalTrafficPolicy?: string; // 'Cluster' | 'Local'
48
- readonly publishNotReadyAddresses?: boolean;
49
- readonly loadBalancerClass?: string;
50
- readonly loadBalancerSourceRanges?: string[];
51
- readonly annotations?: { [name: string]: string }; // ersetzt serviceAnnotations
52
- readonly labels?: { [name: string]: string };
53
-
54
- // Escape-Hatch für alles Übrige (ipFamilyPolicy, clusterIP, ...):
55
- readonly overrides?: { [key: string]: any };
56
- }
57
- ```
58
-
59
- Der `overrides`-Typ ist ein freiform-Record `{ [key: string]: any }` — deckt
60
- jedes aktuelle und künftige k8s-Service-Feld ab, ohne dass Code angefasst werden
61
- muss.
62
-
63
- > **JSII-Constraint (entdeckt bei der Umsetzung):** Ursprünglich war
64
- > `overrides?: k8s.ServiceSpec` geplant. JSII lehnt das ab
65
- > (`JSII3000: Exported APIs cannot use un-exported type`), weil die generierten
66
- > Typen aus `src/imports/k8s.ts` nicht Teil der JSII-Assembly sind. Den gesamten
67
- > k8s-Import zu re-exportieren würde die öffentliche API mit der kompletten
68
- > Kubernetes-API zumüllen. Ein freiform-Record ist die idiomatische, voll
69
- > JSII-/Python-fähige (Python: `dict`) Lösung für einen generischen Escape-Hatch
70
- > und bleibt „für alles" offen. Die kuratierten Felder bleiben typisiert.
71
-
72
- ### 2. `PloneServiceOptions` erweitern
73
-
74
- `PloneServiceOptions` (das interne Interface von `PloneService`) bekommt ein
75
- optionales `spec?: PloneServiceSpec`. Die bestehenden Pflichtfelder
76
- (`targetPort`, `selectorLabel`, `portName`) bleiben unverändert. Das bestehende
77
- `annotations` und `labels` auf `PloneServiceOptions` bleiben erhalten
78
- (construct-managed Defaults), werden aber mit den Werten aus `spec` zusammen-
79
- geführt (siehe Merge-Regeln).
80
-
81
- ### 3. Merge-Reihenfolge in `PloneService`
82
-
83
- Vorhersagbar, shallow (ServiceSpec-Felder sind weitgehend flach):
84
-
85
- ```
86
- finalSpec = { ...generatedBase, ...curatedFields, ...overrides }
87
- ```
88
-
89
- Präzedenz steigend:
90
-
91
- 1. **Construct-Basis:** `ports`, `selector` (aus `targetPort`/`portName`/`selectorLabel`).
92
- 2. **Kuratierte Felder:** alle gesetzten Felder aus `spec` (außer `annotations`,
93
- `labels`, `overrides`).
94
- 3. **`overrides`:** `k8s.ServiceSpec`-Partial — höchste Präzedenz, überschreibt
95
- auch `ports`/`selector`. Dokumentiert als „at your own risk".
96
-
97
- `annotations` und `labels` aus `spec` fließen in `metadata` (nicht in `spec`):
98
- - `metadata.labels = { ...spec.labels, ...constructManagedLabels }`
99
- (construct-managed `part-of`/`managed-by` gewinnen — wie bisher).
100
- - `metadata.annotations = { ...serviceAnnotations (deprecated), ...spec.annotations }`
101
- (neue `spec.annotations` gewinnen bei Konflikt).
102
-
103
- ### 4. Plumbing: ein Punkt in `PloneBaseOptions` (`src/plone.ts`)
104
-
105
- ```typescript
106
- /**
107
- * Service configuration (type, trafficDistribution, sessionAffinity,
108
- * annotations, raw spec overrides, ...). Applies to the component's Service.
109
- */
110
- readonly service?: PloneServiceSpec;
111
-
112
- /**
113
- * @deprecated use `service.annotations` instead
114
- */
115
- readonly serviceAnnotations?: { [name: string]: string };
116
- ```
117
-
118
- `backend`/`frontend` erben beide aus `PloneBaseOptions`, daher gilt die
119
- `service`-Config automatisch für beide Services an genau einer Stelle.
120
-
121
- In `plone.ts` (Backend-Service ~Z. 468, Frontend-Service ~Z. 570) wird
122
- `spec` durchgereicht und die deprecated `serviceAnnotations` weiter unterstützt:
123
-
124
- ```typescript
125
- new PloneService(backendDeployment, 'service', {
126
- // ... unverändert: labels, targetPort, selectorLabel, portName ...
127
- spec: {
128
- ...backend.service,
129
- annotations: { ...backend.serviceAnnotations, ...backend.service?.annotations },
130
- },
131
- });
132
- ```
133
-
134
- ### 5. Backward-Compatibility
135
-
136
- `serviceAnnotations` bleibt funktionsfähig, wird als `@deprecated` markiert und
137
- mit `service.annotations` zusammengeführt (neue Variante gewinnt). Kein Breaking
138
- Change. Bestehende Snapshots ohne `service` bleiben unverändert (alle neuen
139
- Felder sind optional, ungesetzt → keine Spec-Änderung).
140
-
141
- ### 6. Tests (`test/service.test.ts`)
142
-
143
- Neue Snapshot-/Assertion-Fälle:
144
-
145
- - `trafficDistribution: 'PreferClose'` → erscheint in `spec`.
146
- - `type: 'LoadBalancer'` + `loadBalancerSourceRanges` → erscheinen in `spec`.
147
- - `sessionAffinity` / `externalTrafficPolicy` gesetzt.
148
- - `overrides` (z.B. `ipFamilyPolicy`) → erscheint in `spec`.
149
- - Präzedenz: `overrides` schlägt kuratiertes Feld (z.B. beide setzen `type`,
150
- `overrides` gewinnt).
151
- - Backward-Compat: nur `serviceAnnotations` gesetzt → unverändertes Verhalten;
152
- `serviceAnnotations` + `service.annotations` → korrekt gemergt.
153
-
154
- Snapshots aktualisieren via `npx projen test -- -u`.
155
-
156
- ### 7. Dokumentation
157
-
158
- Beim Schreiben/Editieren der Doku den Skill **`plone-doc-style:author`**
159
- verwenden (Diataxis-Quadranten-Zuordnung, MyST-Markup, Style-Enforcement),
160
- soweit es sinnvoll ist — d.h. für die handgeschriebenen Seiten unter
161
- `documentation/sources/` (Reference + How-to). Nicht für auto-generierte
162
- Artefakte (`API.md`).
163
-
164
- - **`API.md`** ist auto-generiert (`npx projen docgen`) — kein manuelles Edit,
165
- aber nach Implementierung neu generieren.
166
- - **`documentation/sources/reference/configuration-options.md`:** Den Abschnitt
167
- „Annotations" (~Z. 200) zu einem Abschnitt „Service" erweitern bzw. einen
168
- neuen Abschnitt für `PloneServiceSpec` ergänzen: Tabelle der kuratierten
169
- Felder + `overrides`, mit Beispiel (`trafficDistribution`, `LoadBalancer`).
170
- `serviceAnnotations` als deprecated kennzeichnen und auf `service.annotations`
171
- verweisen.
172
- - **`documentation/sources/how-to/`:** In `deploy-production-volto.md` ein
173
- kurzes Beispiel ergänzen (z.B. `trafficDistribution: 'PreferClose'` für
174
- topologie-nahes Routing), falls thematisch passend.
175
- - Doku-Build prüfen: `cd documentation && make docs`.
176
-
177
- ## Betroffene Dateien
178
-
179
- - `src/service.ts` — neuer `PloneServiceSpec`-Typ, erweiterte `PloneServiceOptions`, Merge-Logik.
180
- - `src/plone.ts` — `service`-Prop in `PloneBaseOptions`, Plumbing in Backend/Frontend, `serviceAnnotations` deprecaten.
181
- - `test/service.test.ts` (+ Snapshots) — neue Testfälle.
182
- - `documentation/sources/reference/configuration-options.md` — Service-Config dokumentieren.
183
- - `documentation/sources/how-to/deploy-production-volto.md` — optionales Beispiel.
184
- - `API.md` — regenerieren via `npx projen docgen`.
185
-
186
- ## Nicht im Scope (YAGNI)
187
-
188
- - Multi-Port-Services (mehrere `ports`-Einträge) — über `overrides` möglich,
189
- aber kein kuratiertes Feature.
190
- - Eigene Validierung der Enum-Strings (`type`, `sessionAffinity`, …) — k8s
191
- validiert serverseitig; wir bilden die Strings 1:1 ab.
192
- - Separate Service-Configs pro Service jenseits von backend/frontend.
@@ -1,357 +0,0 @@
1
- ##############################################################################
2
- # THIS FILE IS GENERATED BY MXMAKE
3
- #
4
- # DOMAINS:
5
- #: core.base
6
- #: core.mxenv
7
- #: docs.sphinx
8
- #
9
- # SETTINGS (ALL CHANGES MADE BELOW SETTINGS WILL BE LOST)
10
- ##############################################################################
11
-
12
- ## core.base
13
-
14
- # `deploy` target dependencies.
15
- # No default value.
16
- DEPLOY_TARGETS?=
17
-
18
- # target to be executed when calling `make run`
19
- # No default value.
20
- RUN_TARGET?=
21
-
22
- # Additional files and folders to remove when running clean target
23
- # No default value.
24
- CLEAN_FS?=
25
-
26
- # Optional makefile to include before default targets. This can
27
- # be used to provide custom targets or hook up to existing targets.
28
- # Default: include.mk
29
- INCLUDE_MAKEFILE?=include.mk
30
-
31
- # Optional additional directories to be added to PATH in format
32
- # `/path/to/dir/:/path/to/other/dir`. Gets inserted first, thus gets searched
33
- # first.
34
- # No default value.
35
- EXTRA_PATH?=
36
-
37
- # Path to Python project relative to Makefile (repository root).
38
- # Leave empty if Python project is in the same directory as Makefile.
39
- # For monorepo setups, set to subdirectory name (e.g., `backend`).
40
- # Future-proofed for multi-language monorepos (e.g., PROJECT_PATH_NODEJS).
41
- # No default value.
42
- PROJECT_PATH_PYTHON?=
43
-
44
- ## core.mxenv
45
-
46
- # Primary Python interpreter to use. It is used to create the
47
- # virtual environment if `VENV_ENABLED` and `VENV_CREATE` are set to `true`.
48
- # If global `uv` is used, this value is passed as `--python VALUE` to the venv creation.
49
- # uv then downloads the Python interpreter if it is not available.
50
- # for more on this feature read the [uv python documentation](https://docs.astral.sh/uv/concepts/python-versions/)
51
- # Default: python3
52
- PRIMARY_PYTHON?=3.13
53
-
54
- # Minimum required Python version.
55
- # Default: 3.10
56
- PYTHON_MIN_VERSION?=3.13
57
-
58
- # Install packages using the given package installer method.
59
- # Supported are `pip` and `uv`. When `uv` is selected, a global installation
60
- # is auto-detected and used if available. Otherwise, uv is installed in the
61
- # virtual environment or using `PRIMARY_PYTHON`, depending on the
62
- # `VENV_ENABLED` setting.
63
- # Default: pip
64
- PYTHON_PACKAGE_INSTALLER?=uv
65
-
66
- # Python version for UV to install/use when creating virtual
67
- # environments with global UV. Passed to `uv venv -p VALUE`. Supports version
68
- # specs like `3.11`, `3.14`, `cpython@3.14`. Defaults to PRIMARY_PYTHON value
69
- # for backward compatibility.
70
- # Default: $(PRIMARY_PYTHON)
71
- UV_PYTHON?=$(PRIMARY_PYTHON)
72
-
73
- # Flag whether to use virtual environment. If `false`, the
74
- # interpreter according to `PRIMARY_PYTHON` found in `PATH` is used.
75
- # Default: true
76
- VENV_ENABLED?=true
77
-
78
- # Flag whether to create a virtual environment. If set to `false`
79
- # and `VENV_ENABLED` is `true`, `VENV_FOLDER` is expected to point to an
80
- # existing virtual environment.
81
- # Default: true
82
- VENV_CREATE?=true
83
-
84
- # The folder of the virtual environment.
85
- # If `VENV_ENABLED` is `true` and `VENV_CREATE` is true it is used as the
86
- # target folder for the virtual environment. If `VENV_ENABLED` is `true` and
87
- # `VENV_CREATE` is false it is expected to point to an existing virtual
88
- # environment. If `VENV_ENABLED` is `false` it is ignored.
89
- # Default: .venv
90
- VENV_FOLDER?=.venv
91
-
92
- # mxdev to install in virtual environment.
93
- # Default: mxdev
94
- MXDEV?=mxdev
95
-
96
- # mxmake to install in virtual environment.
97
- # Default: mxmake
98
- MXMAKE?=mxmake
99
-
100
- ## docs.sphinx
101
-
102
- # Documentation source folder.
103
- # Default: docs/source
104
- DOCS_SOURCE_FOLDER?=sources
105
-
106
- # Documentation generation target folder.
107
- # Default: docs/html
108
- DOCS_TARGET_FOLDER?=html
109
-
110
- # Documentation linkcheck output folder.
111
- # Default: docs/linkcheck
112
- DOCS_LINKCHECK_FOLDER?=docs/linkcheck
113
-
114
- # Documentation Python requirements to be installed (via pip).
115
- # No default value.
116
- DOCS_REQUIREMENTS?=myst_parser sphinxcontrib.mermaid shibuya sphinx-design sphinx-copybutton
117
-
118
- ##############################################################################
119
- # END SETTINGS - DO NOT EDIT BELOW THIS LINE
120
- ##############################################################################
121
-
122
- INSTALL_TARGETS?=
123
- DIRTY_TARGETS?=
124
- CLEAN_TARGETS?=
125
- PURGE_TARGETS?=
126
-
127
- export PATH:=$(if $(EXTRA_PATH),$(EXTRA_PATH):,)$(PATH)
128
-
129
- # Helper variable: adds trailing slash to PROJECT_PATH_PYTHON only if non-empty
130
- PYTHON_PROJECT_PREFIX=$(if $(PROJECT_PATH_PYTHON),$(PROJECT_PATH_PYTHON)/,)
131
-
132
- # Defensive settings for make: https://tech.davis-hansson.com/p/make/
133
- SHELL:=bash
134
- .ONESHELL:
135
- # for Makefile debugging purposes add -x to the .SHELLFLAGS
136
- .SHELLFLAGS:=-eu -o pipefail -O inherit_errexit -c
137
- .SILENT:
138
- .DELETE_ON_ERROR:
139
- MAKEFLAGS+=--warn-undefined-variables
140
- MAKEFLAGS+=--no-builtin-rules
141
-
142
- # mxmake folder
143
- MXMAKE_FOLDER?=.mxmake
144
-
145
- # Sentinel files
146
- SENTINEL_FOLDER?=$(MXMAKE_FOLDER)/sentinels
147
- SENTINEL?=$(SENTINEL_FOLDER)/about.txt
148
- $(SENTINEL): $(firstword $(MAKEFILE_LIST))
149
- @mkdir -p $(SENTINEL_FOLDER)
150
- @echo "Sentinels for the Makefile process." > $(SENTINEL)
151
-
152
- ##############################################################################
153
- # mxenv
154
- ##############################################################################
155
-
156
- OS?=
157
-
158
- # Determine the executable path
159
- ifeq ("$(VENV_ENABLED)", "true")
160
- export VIRTUAL_ENV=$(abspath $(VENV_FOLDER))
161
- ifeq ("$(OS)", "Windows_NT")
162
- VENV_EXECUTABLE_FOLDER=$(VIRTUAL_ENV)/Scripts
163
- else
164
- VENV_EXECUTABLE_FOLDER=$(VIRTUAL_ENV)/bin
165
- endif
166
- export PATH:=$(VENV_EXECUTABLE_FOLDER):$(PATH)
167
- MXENV_PYTHON=python
168
- else
169
- MXENV_PYTHON=$(PRIMARY_PYTHON)
170
- endif
171
-
172
- # Determine the package installer with non-interactive flags
173
- ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
174
- PYTHON_PACKAGE_COMMAND=uv pip --no-progress
175
- else
176
- PYTHON_PACKAGE_COMMAND=$(MXENV_PYTHON) -m pip
177
- endif
178
-
179
- # Auto-detect global uv availability (simple existence check)
180
- ifeq ("$(PYTHON_PACKAGE_INSTALLER)","uv")
181
- UV_AVAILABLE:=$(shell command -v uv >/dev/null 2>&1 && echo "true" || echo "false")
182
- else
183
- UV_AVAILABLE:=false
184
- endif
185
-
186
- # Determine installation strategy
187
- # depending on the PYTHON_PACKAGE_INSTALLER and UV_AVAILABLE
188
- # - both vars can be false or
189
- # - one of them can be true,
190
- # - but never boths.
191
- USE_GLOBAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "true" ]] && echo "true" || echo "false")
192
- USE_LOCAL_UV:=$(shell [[ "$(PYTHON_PACKAGE_INSTALLER)" == "uv" && "$(UV_AVAILABLE)" == "false" ]] && echo "true" || echo "false")
193
-
194
- # Check if global UV is outdated (non-blocking warning)
195
- ifeq ("$(USE_GLOBAL_UV)","true")
196
- UV_OUTDATED:=$(shell uv self update --dry-run 2>&1 | grep -q "Would update" && echo "true" || echo "false")
197
- else
198
- UV_OUTDATED:=false
199
- endif
200
-
201
- MXENV_TARGET:=$(SENTINEL_FOLDER)/mxenv.sentinel
202
- $(MXENV_TARGET): $(SENTINEL)
203
- # Validation: Check Python version if not using global uv
204
- ifneq ("$(USE_GLOBAL_UV)","true")
205
- @$(PRIMARY_PYTHON) -c "import sys; vi = sys.version_info; sys.exit(1 if (int(vi[0]), int(vi[1])) >= tuple(map(int, '$(PYTHON_MIN_VERSION)'.split('.'))) else 0)" \
206
- && echo "Need Python >= $(PYTHON_MIN_VERSION)" && exit 1 || :
207
- else
208
- @echo "Using global uv for Python $(UV_PYTHON)"
209
- endif
210
- # Validation: Check VENV_FOLDER is set if venv enabled
211
- @[[ "$(VENV_ENABLED)" == "true" && "$(VENV_FOLDER)" == "" ]] \
212
- && echo "VENV_FOLDER must be configured if VENV_ENABLED is true" && exit 1 || :
213
- # Validation: Check uv not used with system Python
214
- @[[ "$(VENV_ENABLED)" == "false" && "$(PYTHON_PACKAGE_INSTALLER)" == "uv" ]] \
215
- && echo "Package installer uv does not work with a global Python interpreter." && exit 1 || :
216
- # Warning: Notify if global UV is outdated
217
- ifeq ("$(UV_OUTDATED)","true")
218
- @echo "WARNING: A newer version of uv is available. Run 'uv self update' to upgrade."
219
- endif
220
-
221
- # Create virtual environment
222
- ifeq ("$(VENV_ENABLED)", "true")
223
- ifeq ("$(VENV_CREATE)", "true")
224
- ifeq ("$(USE_GLOBAL_UV)","true")
225
- @echo "Setup Python Virtual Environment using global uv at '$(VENV_FOLDER)'"
226
- @uv venv --allow-existing --no-progress -p $(UV_PYTHON) --seed $(VENV_FOLDER)
227
- else
228
- @echo "Setup Python Virtual Environment using module 'venv' at '$(VENV_FOLDER)'"
229
- @$(PRIMARY_PYTHON) -m venv $(VENV_FOLDER)
230
- @$(MXENV_PYTHON) -m ensurepip -U
231
- endif
232
- endif
233
- else
234
- @echo "Using system Python interpreter"
235
- endif
236
-
237
- # Install uv locally if needed
238
- ifeq ("$(USE_LOCAL_UV)","true")
239
- @echo "Install uv in virtual environment"
240
- @$(MXENV_PYTHON) -m pip install uv
241
- endif
242
-
243
- # Install/upgrade core packages
244
- @$(PYTHON_PACKAGE_COMMAND) install -U pip setuptools wheel
245
- @echo "Install/Update MXStack Python packages"
246
- @$(PYTHON_PACKAGE_COMMAND) install -U $(MXDEV) $(MXMAKE)
247
- @touch $(MXENV_TARGET)
248
-
249
- .PHONY: mxenv
250
- mxenv: $(MXENV_TARGET)
251
-
252
- .PHONY: mxenv-dirty
253
- mxenv-dirty:
254
- @rm -f $(MXENV_TARGET)
255
-
256
- .PHONY: mxenv-clean
257
- mxenv-clean: mxenv-dirty
258
- ifeq ("$(VENV_ENABLED)", "true")
259
- ifeq ("$(VENV_CREATE)", "true")
260
- @rm -rf $(VENV_FOLDER)
261
- endif
262
- else
263
- @$(PYTHON_PACKAGE_COMMAND) uninstall -y $(MXDEV)
264
- @$(PYTHON_PACKAGE_COMMAND) uninstall -y $(MXMAKE)
265
- endif
266
-
267
- INSTALL_TARGETS+=mxenv
268
- DIRTY_TARGETS+=mxenv-dirty
269
- CLEAN_TARGETS+=mxenv-clean
270
-
271
- ##############################################################################
272
- # sphinx
273
- ##############################################################################
274
-
275
- # additional targets required for building docs.
276
- DOCS_TARGETS+=
277
-
278
- SPHINX_BIN=sphinx-build
279
- SPHINX_AUTOBUILD_BIN=sphinx-autobuild
280
-
281
- DOCS_TARGET:=$(SENTINEL_FOLDER)/sphinx.sentinel
282
- $(DOCS_TARGET): $(MXENV_TARGET)
283
- @echo "Install Sphinx"
284
- @$(PYTHON_PACKAGE_COMMAND) install -U sphinx sphinx-autobuild $(DOCS_REQUIREMENTS)
285
- @touch $(DOCS_TARGET)
286
-
287
- .PHONY: docs
288
- docs: $(DOCS_TARGET) $(DOCS_TARGETS)
289
- @echo "Build sphinx docs"
290
- @$(SPHINX_BIN) $(DOCS_SOURCE_FOLDER) $(DOCS_TARGET_FOLDER)
291
-
292
- .PHONY: docs-live
293
- docs-live: $(DOCS_TARGET) $(DOCS_TARGETS)
294
- @echo "Rebuild Sphinx documentation on changes, with live-reload in the browser"
295
- @$(SPHINX_AUTOBUILD_BIN) $(DOCS_SOURCE_FOLDER) $(DOCS_TARGET_FOLDER)
296
-
297
- .PHONY: docs-linkcheck
298
- docs-linkcheck: $(DOCS_TARGET) $(DOCS_TARGETS)
299
- @echo "Run Sphinx linkcheck"
300
- @$(SPHINX_BIN) -b linkcheck $(DOCS_SOURCE_FOLDER) $(DOCS_LINKCHECK_FOLDER)
301
-
302
- .PHONY: docs-dirty
303
- docs-dirty:
304
- @rm -f $(DOCS_TARGET)
305
-
306
- .PHONY: docs-clean
307
- docs-clean: docs-dirty
308
- @test -e $(MXENV_PYTHON) && $(MXENV_PYTHON) -m pip uninstall -y \
309
- sphinx sphinx-autobuild $(DOCS_REQUIREMENTS) || :
310
- @rm -rf $(DOCS_TARGET_FOLDER)
311
-
312
- INSTALL_TARGETS+=$(DOCS_TARGET)
313
- DIRTY_TARGETS+=docs-dirty
314
- CLEAN_TARGETS+=docs-clean
315
-
316
- ##############################################################################
317
- # Custom includes
318
- ##############################################################################
319
-
320
- -include $(INCLUDE_MAKEFILE)
321
-
322
- ##############################################################################
323
- # Default targets
324
- ##############################################################################
325
-
326
- INSTALL_TARGET:=$(SENTINEL_FOLDER)/install.sentinel
327
- $(INSTALL_TARGET): $(INSTALL_TARGETS)
328
- @touch $(INSTALL_TARGET)
329
-
330
- .PHONY: install
331
- install: $(INSTALL_TARGET)
332
- @touch $(INSTALL_TARGET)
333
-
334
- .PHONY: run
335
- run: $(RUN_TARGET)
336
-
337
- .PHONY: deploy
338
- deploy: $(DEPLOY_TARGETS)
339
-
340
- .PHONY: dirty
341
- dirty: $(DIRTY_TARGETS)
342
- @rm -f $(INSTALL_TARGET)
343
-
344
- .PHONY: clean
345
- clean: dirty $(CLEAN_TARGETS)
346
- @rm -rf $(CLEAN_TARGETS) $(MXMAKE_FOLDER) $(CLEAN_FS)
347
-
348
- .PHONY: purge
349
- purge: clean $(PURGE_TARGETS)
350
-
351
- .PHONY: runtime-clean
352
- runtime-clean:
353
- @echo "Remove runtime artifacts, like byte-code and caches."
354
- @find . -name '*.py[c|o]' -delete
355
- @find . -name '*~' -exec rm -f {} +
356
- @find . -name '__pycache__' -exec rm -fr {} +
357
-