Skip to content
This repository was archived by the owner on Feb 15, 2026. It is now read-only.

Commit d655b41

Browse files
committed
refactor(deps): replace pyyaml with json for metadata handling
CHANGES - Remove PyYAML dependency from pyproject.toml and uv.lock - Replace yaml.safe_load() with json.load() in build_index.py - Update workflow to generate JSON metadata instead of YAML - Change metadata filename from _metadata.yml to _metadata.json - Update cleanup script to preserve JSON metadata files - Delete existing YAML metadata files (conda, pip, poetry, uv) IMPACT - Eliminates external PyYAML dependency requirement - Uses Python standard library for metadata parsing - Reduces project complexity and dependency footprint TECHNICAL NOTES - Maintains identical metadata structure and functionality - JSON format more suitable for simple key-value configuration - Aligns with industry standard practices for metadata storage
1 parent f74575c commit d655b41

9 files changed

Lines changed: 13 additions & 54 deletions

File tree

.github/workflows/auto-update-docs.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ jobs:
5656
cp -a temp-docs/${{ matrix.docs_path }}/* ${{ matrix.target_dir }}/
5757
5858
# Add metadata file with source info
59-
echo "source_repo: ${{ matrix.repo }}" > ${{ matrix.target_dir }}/_metadata.yml
60-
echo "docs_path: ${{ matrix.docs_path }}" >> ${{ matrix.target_dir }}/_metadata.yml
61-
echo "updated_at: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> ${{ matrix.target_dir }}/_metadata.yml
62-
echo "commit_sha: $(cd temp-docs && git rev-parse HEAD)" >> ${{ matrix.target_dir }}/_metadata.yml
59+
cat > ${{ matrix.target_dir }}/_metadata.json << EOF
60+
{
61+
"source_repo": "${{ matrix.repo }}",
62+
"docs_path": "${{ matrix.docs_path }}",
63+
"updated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
64+
"commit_sha": "$(cd temp-docs && git rev-parse HEAD)"
65+
}
66+
EOF
6367
6468
- name: Clean non-documentation files
6569
run: ./scripts/clean-assets.sh

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ urls.repository = "https://github.com/KemingHe/python-dep-manager-companion-mcp-
99
urls.issues = "https://github.com/KemingHe/python-dep-manager-companion-mcp-server/issues"
1010
dependencies = [
1111
"fastmcp>=2.10.5",
12-
"pyyaml>=6.0.2",
1312
"tantivy>=0.24.0",
1413
]

scripts/clean-assets.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -e
1414
# --- Configuration ---
1515
# Convert comma-separated strings to arrays for easier processing.
1616
INCLUDE_EXTENSIONS="md,rst"
17-
INCLUDE_FILENAMES="_metadata.yml"
17+
INCLUDE_FILENAMES="_metadata.json"
1818

1919
# --- Logging ---
2020
echo "[INFO] Starting documentation cleanup process..."

src/assets/conda/_metadata.yml

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

src/assets/pip/_metadata.yml

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

src/assets/poetry/_metadata.yml

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

src/assets/uv/_metadata.yml

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

src/build_index.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import logging
1111
from pathlib import Path
1212
from typing import Dict, Any
13-
import yaml
13+
import json
1414
import tantivy
1515

1616

@@ -26,10 +26,10 @@
2626

2727

2828
def load_metadata(metadata_path: Path) -> Dict[str, Any]:
29-
"""Load package metadata from _metadata.yml file."""
29+
"""Load package metadata from _metadata.json file."""
3030
try:
3131
with open(metadata_path, "r", encoding="utf-8") as f:
32-
return yaml.safe_load(f) or {}
32+
return json.load(f) or {}
3333
except Exception as e:
3434
logger.warning(f"Failed to load metadata from {metadata_path}: {e}")
3535
return {}
@@ -93,7 +93,7 @@ def find_markdown_files(assets_dir: Path) -> list[tuple[Path, str, Dict[str, Any
9393
continue
9494

9595
package_name = package_dir.name
96-
metadata_path = package_dir / "_metadata.yml"
96+
metadata_path = package_dir / "_metadata.json"
9797
metadata = load_metadata(metadata_path)
9898

9999
logger.info(f"Scanning {package_name} documentation...")

uv.lock

Lines changed: 0 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)