From d437b94f0687abec9b3f38fc9c62b46a237eb919 Mon Sep 17 00:00:00 2001 From: Anton Kulaga Date: Wed, 20 Nov 2024 19:15:31 +0100 Subject: [PATCH] fixed publishing --- environment.yaml | 3 ++- publish.sh | 50 ++++++++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/environment.yaml b/environment.yaml index 7f6a9fa..88a4dad 100644 --- a/environment.yaml +++ b/environment.yaml @@ -12,7 +12,8 @@ dependencies: - pip - pip: - litellm>=1.52.9 - - numpydoc + - numpydoc #for tool calling + - build #for building - semanticscholar>=0.8.4 #for just-agents-tools - llm-sandbox>=0.1.4 #for just-agents-coding - loguru #for just-agents-web diff --git a/publish.sh b/publish.sh index 3e2d6f6..826e548 100755 --- a/publish.sh +++ b/publish.sh @@ -2,39 +2,43 @@ # Function to extract version from pyproject.toml get_version() { + if [ ! -f "$1/pyproject.toml" ]; then + echo "Error: $1/pyproject.toml not found" + exit 1 + fi grep 'version = ' "$1/pyproject.toml" | cut -d'"' -f2 } +# Check if directories exist +for pkg in just_agents just_agents_web just_agents_tools just_agents_coding just_agents_router just_agents_examples; do + if [ ! -d "$pkg" ]; then + echo "Error: Directory $pkg not found" + exit 1 + fi +done + # Check versions -base_version=$(get_version "just-agents") -for pkg in just-agents-web just-agents-tools just-agents-coding just-agents-router just-agents-examples just-agents-all; do +base_version=$(get_version "just_agents") +for pkg in just_agents just_agents_web just_agents_tools just_agents_coding just_agents_router just_agents_examples; do pkg_version=$(get_version "$pkg") if [ "$base_version" != "$pkg_version" ]; then - echo "Version mismatch: $pkg ($pkg_version) != just-agents ($base_version)" + echo "Version mismatch: $pkg ($pkg_version) != just_agents ($base_version)" exit 1 fi done -# Remove old distributions -rm -rf dist/ -rm -rf */dist/ -rm -rf *.egg-info -rm -rf */*.egg-info - # Build each package -cd just-agents && python -m build && cd .. -cd just-agents-web && python -m build && cd .. -cd just-agents-tools && python -m build && cd .. -cd just-agents-coding && python -m build && cd .. -cd just-agents-router && python -m build && cd .. -cd just-agents-examples && python -m build && cd .. -cd just-agents-all && python -m build && cd .. +for pkg in just_agents just_agents_web just_agents_tools just_agents_coding just_agents_router just_agents_examples; do + echo "Building $pkg..." + (cd "$pkg" && python -m build) || { echo "Failed to build $pkg"; exit 1; } +done # Upload all packages -twine upload --verbose just-agents/dist/* --config-file .pypirc -twine upload --verbose just-agents-web/dist/* --config-file .pypirc -twine upload --verbose just-agents-tools/dist/* --config-file .pypirc -twine upload --verbose just-agents-coding/dist/* --config-file .pypirc -twine upload --verbose just-agents-router/dist/* --config-file .pypirc -twine upload --verbose just-agents-examples/dist/* --config-file .pypirc -twine upload --verbose just-agents-all/dist/* --config-file .pypirc \ No newline at end of file +for pkg in just_agents just_agents_web just_agents_tools just_agents_coding just_agents_router just_agents_examples; do + echo "Uploading $pkg..." + if [ -d "$pkg/dist" ]; then + twine upload --verbose "$pkg/dist/*" --config-file .pypirc || { echo "Failed to upload $pkg"; exit 1; } + else + echo "Warning: No dist directory found for $pkg" + fi +done \ No newline at end of file