Skip to content

Commit 234ae6f

Browse files
committed
Merge pull request #275 from clamsproject/develop
releasing 1.4.0
2 parents 3eb4e44 + c8950d7 commit 234ae6f

124 files changed

Lines changed: 833 additions & 12705 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ tags
8383
.tags
8484

8585
# sphinx
86-
documentation/_build/
86+
docs-test/

Makefile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,14 @@ $(generatedcode): VERSION
3737
ls $(generatedcode)*
3838

3939
# generating jsonschema depends on mmif-python and pydantic
40-
docs: mmif := $(shell grep mmif-python requirements.txt)
41-
docs: pydantic := $(shell grep pydantic requirements.txt)
42-
docs: VERSION $(generatedcode)
43-
pip install --upgrade --no-input "$(mmif)" "$(pydantic)"
44-
rm -rf docs
45-
mkdir -p docs
46-
python3 -m clams.appmetadata.__init__ > documentation/appmetadata.jsonschema
47-
sphinx-build -a -b html documentation/ docs
48-
mv documentation/appmetadata.jsonschema docs/
49-
touch docs/.nojekyll
50-
echo 'sdk.clams.ai' > docs/CNAME
40+
docs:
41+
@echo "WARNING: The 'docs' target is deprecated and will be removed."
42+
@echo "The 'docs' directory is no longer used. Documentation is now hosted in the central CLAMS documentation hub."
43+
@echo "Use 'make doc' for local builds."
44+
@echo "Nothing is done."
45+
46+
doc: VERSION
47+
python3 build-tools/docs.py
5148

5249
package: VERSION
5350
pip install --upgrade -r requirements.dev

build-tools/docs.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import argparse
2+
import subprocess
3+
import sys
4+
import os
5+
import shutil
6+
from pathlib import Path
7+
8+
def run_command(command, cwd=None, check=True, env=None):
9+
"""Helper to run a shell command."""
10+
print(f"Running: {' '.join(str(c) for c in command)}")
11+
result = subprocess.run(command, cwd=cwd, env=env)
12+
if check and result.returncode != 0:
13+
print(f"Error: Command failed with exit code {result.returncode}")
14+
sys.exit(result.returncode)
15+
return result
16+
17+
def build_docs_local(source_dir: Path):
18+
"""
19+
Builds documentation for the provided source directory.
20+
Assumes it's running in an environment with necessary tools.
21+
"""
22+
print("--- Running in Local Build Mode ---")
23+
24+
# 1. Generate source code and install in editable mode.
25+
print("\n--- Step 1: Installing in editable mode ---")
26+
try:
27+
run_command([sys.executable, "-m", "pip", "install", "-e", "."], cwd=source_dir)
28+
# Explicitly run schema generation to be sure
29+
run_command([sys.executable, "setup.py", "generate_schema"], cwd=source_dir)
30+
except SystemExit:
31+
print("Warning: 'pip install -e .' failed. This might be due to an externally managed environment.")
32+
print("Attempting to proceed with documentation build assuming dependencies are met...")
33+
34+
# 2. Install documentation-specific dependencies.
35+
print("\n--- Step 2: Installing documentation dependencies ---")
36+
doc_reqs = source_dir / "build-tools" / "requirements.docs.txt"
37+
if not doc_reqs.exists():
38+
print(f"Error: Documentation requirements not found at {doc_reqs}")
39+
sys.exit(1)
40+
try:
41+
run_command([sys.executable, "-m", "pip", "install", "-r", str(doc_reqs)])
42+
except SystemExit:
43+
print("Warning: Failed to install documentation dependencies.")
44+
# Check if sphinx-build is available
45+
if shutil.which("sphinx-build") is None:
46+
print("Error: 'sphinx-build' not found and installation failed.")
47+
print("Please install dependencies manually or run this script inside a virtual environment.")
48+
sys.exit(1)
49+
print("Assuming dependencies are already installed...")
50+
51+
# 3. Build the documentation using Sphinx.
52+
print("\n--- Step 3: Building Sphinx documentation ---")
53+
docs_source_dir = source_dir / "documentation"
54+
docs_build_dir = source_dir / "docs-test"
55+
56+
# Schema generation is now handled in conf.py
57+
# schema_src = source_dir / "clams" / "appmetadata.jsonschema"
58+
# schema_dst = docs_source_dir / "appmetadata.jsonschema"
59+
# if schema_src.exists():
60+
# shutil.copy(schema_src, schema_dst)
61+
62+
sphinx_command = [
63+
sys.executable, "-m", "sphinx.cmd.build",
64+
str(docs_source_dir),
65+
str(docs_build_dir),
66+
"-b", "html", # build html
67+
"-a", # write all files (rebuild everything)
68+
"-E", # don't use a saved environment, reread all files
69+
]
70+
run_command(sphinx_command)
71+
72+
print(f"\nDocumentation build complete. Output in: {docs_build_dir}")
73+
return docs_build_dir
74+
75+
def main():
76+
parser = argparse.ArgumentParser(
77+
description="Build documentation for the clams-python project."
78+
)
79+
args = parser.parse_args()
80+
81+
build_docs_local(Path.cwd())
82+
83+
if __name__ == "__main__":
84+
main()

build-tools/requirements.docs.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sphinx>=7.0,<8.0
2+
furo
3+
m2r2
4+
sphinx-jsonschema

0 commit comments

Comments
 (0)