Skip to content

Commit 228865b

Browse files
committed
fix: use separate tooling env for settings-doc
fix: well that didn't work fix: update tasks fix: format settings doc files
1 parent 0170a87 commit 228865b

File tree

5 files changed

+44
-146
lines changed

5 files changed

+44
-146
lines changed

.env.example

Lines changed: 0 additions & 121 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,6 @@ docs/source/_build
9797
pixi.lock
9898
*.egg-info
9999
docs/templates/_builtin_markdown.jinja
100+
101+
# docs site
102+
site

docs/admin/reference/env-variables.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
*This page is auto-generated from the settings classes in `diracx.core.settings`.*
44

5-
65
## AuthSettings
76

87
Settings for the authentication service.
98

10-
119
### `DIRACX_SERVICE_AUTH_DIRAC_CLIENT_ID`
1210

1311
*Optional*, default value: `myDIRACClientID`
@@ -107,14 +105,10 @@ Set of security properties available in this DIRAC installation.
107105
These properties define various authorization capabilities and are used
108106
for access control decisions. Defaults to all available security properties.
109107

110-
111-
112-
113108
## SandboxStoreSettings
114109

115110
Settings for the sandbox store.
116111

117-
118112
### `DIRACX_SANDBOX_STORE_BUCKET_NAME`
119113

120114
**Required**
@@ -154,14 +148,10 @@ Logical name of the Storage Element for the sandbox store.
154148
This name is used within DIRAC to refer to this sandbox storage
155149
endpoint in job descriptions and file catalogs.
156150

157-
158-
159-
160151
## OTELSettings
161152

162153
Settings for the Open Telemetry Configuration.
163154

164-
165155
### `DIRACX_OTEL_ENABLED`
166156

167157
*Optional*, default value: `False`
@@ -172,7 +162,7 @@ Settings for the Open Telemetry Configuration.
172162

173163
### `DIRACX_OTEL_GRPC_ENDPOINT`
174164

175-
*Optional*, default value: ``
165+
*Optional*, default value: \`\`
176166

177167
### `DIRACX_OTEL_GRPC_INSECURE`
178168

pixi.toml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ diracx-logic = { path = "diracx-logic", editable = true, extras = ["testing"] }
3030
[feature.diracx-routers.pypi-dependencies]
3131
diracx-routers = { path = "diracx-routers", editable = true, extras = ["testing"] }
3232

33-
# Settings documentation feature
34-
[feature.settings-doc.pypi-dependencies]
35-
settings-doc = "*"
36-
3733
# DiracX features for providing tasks. This is needed to make it so that running
3834
# "pixi run pytest-diracx-core -vvv --pdb" passes the arguments as expected.
3935
# See: https://github.com/prefix-dev/pixi/issues/1519#issuecomment-2651078457
@@ -61,11 +57,6 @@ description = "Run the tests for diracx-logic"
6157
cmd = "cd diracx-routers/ && pytest"
6258
description = "Run the tests for diracx-routers"
6359

64-
# Settings documentation task
65-
[feature.settings-doc.tasks.generate-settings-doc]
66-
cmd = "python scripts/generate_settings_docs.py"
67-
description = "Auto-discover and generate settings documentation with validation"
68-
6960
# Gubbins features for providing dependencies
7061
[feature.gubbins.pypi-dependencies]
7162
gubbins = { path = "extensions/gubbins", editable = true, extras = ["testing"] }
@@ -149,6 +140,22 @@ shellcheck = "*"
149140
cmd = "find . -not -wholename './.pixi/*' -name '*.sh' -print -exec shellcheck --exclude=SC1090,SC1091 --external-source '{}' ';'"
150141
description = "Run shellcheck on all shell scripts"
151142

143+
# Settings documentation feature
144+
[feature.settings-doc.dependencies]
145+
python = "*"
146+
[feature.settings-doc.pypi-dependencies]
147+
settings-doc = "*"
148+
mdformat = "*"
149+
mdformat-mkdocs = "*"
150+
mdformat-gfm = "*"
151+
mdformat-black = "*"
152+
diracx-core = { path = "diracx-core", editable = true }
153+
diracx-routers = { path = "diracx-routers", editable = true }
154+
# Settings documentation task
155+
[feature.settings-doc.tasks.generate-settings-doc]
156+
cmd = "python scripts/generate_settings_docs.py"
157+
description = "Auto-discover and generate settings documentation with validation"
158+
152159
[environments]
153160
# DiracX environments
154161
default = {features = ["task-diracx", "diracx", "diracx-core", "diracx-api", "diracx-cli", "diracx-client", "diracx-db", "diracx-logic", "diracx-routers", "settings-doc"], solve-group = "diracx"}
@@ -177,6 +184,7 @@ gubbins-generate-client = {features = ["client-gen", "diracx-client", "gubbins-c
177184
mkdocs = {features = ["mkdocs"], no-default-feature = true}
178185
shellcheck = {features = ["shellcheck"], no-default-feature = true}
179186
pre-commit = {features = ["pre-commit"], no-default-feature = true}
187+
settings-doc = {features = ["settings-doc"], no-default-feature = true}
180188

181189
# Meta-tasks for running many tests at once
182190
[tasks.pytest-diracx-all-one-by-one]

scripts/generate_settings_docs.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import pkgutil
1818
import re
1919
import shutil
20+
import subprocess
2021
import sys
2122
from pathlib import Path
2223
from typing import Any
@@ -212,7 +213,7 @@ def generate_all_templates(
212213
settings_classes: dict[str, dict],
213214
docs_dir: Path,
214215
repo_root: Path,
215-
) -> None:
216+
) -> list:
216217
"""Generate documentation for all discovered templates."""
217218
# Collect all unique modules that contain settings
218219
modules = sorted(set(info["module"] for info in settings_classes.values()))
@@ -334,6 +335,23 @@ def compare_and_update_files(
334335
def normalize(text: str) -> str:
335336
return "\n".join(line for line in text.splitlines() if line.strip())
336337

338+
# First, run mdformat on all .bak files to ensure consistent formatting
339+
backup_files = [backup for _, backup in generated_files]
340+
if backup_files:
341+
try:
342+
subprocess.run( # noqa: S603
343+
["mdformat", "--number"] + [str(f) for f in backup_files],
344+
check=True,
345+
capture_output=True,
346+
text=True,
347+
)
348+
except subprocess.CalledProcessError as e:
349+
print(f"⚠️ mdformat failed: {e.stderr}")
350+
return False
351+
except FileNotFoundError:
352+
print("⚠️ mdformat not found in environment")
353+
return False
354+
337355
all_up_to_date = True
338356

339357
for original_file, backup_file in generated_files:
@@ -401,10 +419,10 @@ def main():
401419
templates, settings_classes, docs_dir, repo_root
402420
)
403421

404-
print("\n📝 Generating .env file...")
405-
dotenv_path = repo_root / ".env.example"
406-
dotenv_backup = generate_dotenv_file(settings_classes, dotenv_path)
407-
generated_files.append((dotenv_path, dotenv_backup))
422+
# print("\n📝 Generating .env file...")
423+
# dotenv_path = repo_root / ".env.example"
424+
# dotenv_backup = generate_dotenv_file(settings_classes, dotenv_path)
425+
# generated_files.append((dotenv_path, dotenv_backup))
408426

409427
# Update files if they're different
410428
print("\n📝 Updating files...")

0 commit comments

Comments
 (0)