Skip to content

Commit

Permalink
Merge pull request #2409 from Agenta-AI/release/v0.30.0
Browse files Browse the repository at this point in the history
Release/v0.30.0
  • Loading branch information
aakrem authored Jan 8, 2025
2 parents c1729a0 + 3c84b7c commit dca0cb7
Show file tree
Hide file tree
Showing 113 changed files with 4,068 additions and 2,907 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.git
37 changes: 37 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Define the directories to check
DIRECTORIES=("agenta-backend" "agenta-cli")
ORIGINAL_DIR=$(pwd)

# Check for changes in frontend directory
if git diff --cached --name-only | grep -q '^agenta-web/'; then
cd agenta-web || exit

# Run Prettier check
if ! npm run format; then
echo '⚠️ Formatting issues detected. Running Prettier to fix them...'
npm run format-fix

echo '✅ Formatting issues fixed. Please stage the changes and commit the code again'
exit 1
fi

cd "$ORIGINAL_DIR" || exit
fi

# Check for changes in backend directory
for DIR in "${DIRECTORIES[@]}"; do
if git diff --cached --name-only | grep -q "^$DIR/"; then
cd "$DIR" || exit

# Run black for formatting
if ! black --check .; then
echo "⚠️ Formatting issues detected in $DIR. Running black to fix them..."
black .

echo "✅ Formatting issues fixed Please stage the changes and commit the code again $DIR."
exit 1
fi

cd "$ORIGINAL_DIR" || exit
fi
done
77 changes: 77 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Define the directories to check
DIRECTORIES=("agenta-backend" "agenta-cli")
ORIGINAL_DIR=$(pwd)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
FIRST_PUSH_FILE=".git/first_push_detected"

# Function to run frontend checks
run_frontend_checks() {
cd agenta-web || exit

# Run ESLint check
if ! npm run lint; then
echo '❌ ESLint issues detected. Please fix them before pushing.'
exit 1
fi

# Run TypeScript type check
if ! npm run types:check; then
echo '❌ TypeScript type check failed.'
exit 1
fi

echo '🎉 Frontend checks passed!'
cd "$ORIGINAL_DIR" || exit
}

# Function to run backend checks
run_backend_checks() {
local DIR=$1
cd "$DIR" || exit

# Run pylint checks
if ! pylint --recursive=y --errors-only .; then
echo "❌ pylint issues detected in $DIR. Please fix them before pushing."
exit 1
fi

echo "🎉 Backend checks passed for $DIR."
cd "$ORIGINAL_DIR" || exit
}

# Check if this is the first push
is_first_push() {
# Check if the branch exists locally
if ! git rev-parse --verify "$BRANCH_NAME" >/dev/null 2>&1; then
return 0 # First push, since the branch doesn't exist locally
fi

# Check if the branch exists remotely
if ! git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
return 0 # First push, since the branch doesn't exist remotely
fi

return 1 # Not the first push
}

# If: First-time push: Run all checks
# Else: Check directory-specific changes for existing branch
if is_first_push; then
echo "🚀 First-time push detected for branch: $BRANCH_NAME"
run_frontend_checks

# for DIR in "${DIRECTORIES[@]}"; do
# run_backend_checks "$DIR"
# done
else
echo "🔍 Checking directory changes for existing branch: $BRANCH_NAME"
if git diff --name-only --cached origin/"$BRANCH_NAME" | grep -q '^agenta-web/'; then
run_frontend_checks
fi

# for DIR in "${DIRECTORIES[@]}"; do
# if git diff --name-only --cached origin/"$BRANCH_NAME" | grep -q "^$DIR/"; then
# run_backend_checks "$DIR"
# fi
# done
fi
1 change: 1 addition & 0 deletions agenta-backend/agenta_backend/services/app_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ async def start_variant(
"AGENTA_BASE_ID": str(db_app_variant.base_id),
"AGENTA_APP_ID": str(db_app_variant.app_id),
"AGENTA_HOST": domain_name,
"AGENTA_RUNTIME": "true",
}
)
if isCloudEE():
Expand Down
11 changes: 8 additions & 3 deletions agenta-backend/agenta_backend/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import pytest
import asyncio

from agenta_backend.tests.engine import test_db_engine as db_engine
from agenta_backend.utils.common import isOss

if isOss():
from agenta_backend.tests.engine import test_db_engine as db_engine


@pytest.fixture(scope="session", autouse=True)
Expand All @@ -17,6 +20,8 @@ def event_loop():

yield res

res.run_until_complete(db_engine.remove_db()) # drop database
res.run_until_complete(db_engine.close_db()) # close connections to database
if isOss():
res.run_until_complete(db_engine.remove_db()) # drop database
res.run_until_complete(db_engine.close_db()) # close connections to database

res._close() # close event loop # type: ignore
2 changes: 1 addition & 1 deletion agenta-backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "agenta_backend"
version = "0.29.0"
version = "0.30.0"
description = ""
authors = ["Mahmoud Mabrouk <[email protected]>"]
readme = "README.md"
Expand Down
35 changes: 32 additions & 3 deletions agenta-cli/agenta/client/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
AgentaTreesResponse,
AggregatedResult,
AggregatedResultEvaluatorConfig,
AnalyticsResponse,
App,
AppVariantResponse,
AppVariantRevision,
BaseOutput,
BodyImportTestset,
BucketDto,
CollectStatusResponse,
ConfigDb,
ConfigDto,
Expand Down Expand Up @@ -42,6 +44,7 @@
EvaluatorOutputInterface,
ExceptionDto,
GetConfigResponse,
HeaderDto,
HttpValidationError,
HumanEvaluation,
HumanEvaluationScenario,
Expand All @@ -51,12 +54,14 @@
HumanEvaluationUpdate,
Image,
InviteRequest,
LegacyAnalyticsResponse,
LegacyDataPoint,
LifecycleDto,
LinkDto,
ListApiKeysResponse,
LlmRunRateLimit,
LlmTokens,
LmProvidersEnum,
MetricsDto,
NewHumanEvaluation,
NewTestset,
NodeDto,
Expand All @@ -74,11 +79,17 @@
Outputs,
ParentDto,
Permission,
ProjectsResponse,
ProviderKeyDto,
ProviderKind,
ReferenceDto,
ReferenceRequestModel,
Result,
RootDto,
Score,
SecretDto,
SecretKind,
SecretResponseDto,
SimpleEvaluationOutput,
Span,
SpanDetail,
Expand Down Expand Up @@ -111,6 +122,7 @@
)
from .errors import UnprocessableEntityError
from . import (
access_control,
apps,
bases,
configs,
Expand All @@ -120,12 +132,14 @@
evaluators,
observability,
observability_v_1,
scopes,
testsets,
variants,
vault,
)
from .client import AgentaApi, AsyncAgentaApi
from .containers import ContainerTemplatesResponse
from .observability_v_1 import Format, QueryTracesResponse
from .observability_v_1 import Format, QueryAnalyticsResponse, QueryTracesResponse
from .variants import AddVariantFromBaseAndConfigResponse

__all__ = [
Expand All @@ -140,12 +154,14 @@
"AgentaTreesResponse",
"AggregatedResult",
"AggregatedResultEvaluatorConfig",
"AnalyticsResponse",
"App",
"AppVariantResponse",
"AppVariantRevision",
"AsyncAgentaApi",
"BaseOutput",
"BodyImportTestset",
"BucketDto",
"CollectStatusResponse",
"ConfigDb",
"ConfigDto",
Expand Down Expand Up @@ -175,6 +191,7 @@
"ExceptionDto",
"Format",
"GetConfigResponse",
"HeaderDto",
"HttpValidationError",
"HumanEvaluation",
"HumanEvaluationScenario",
Expand All @@ -184,12 +201,14 @@
"HumanEvaluationUpdate",
"Image",
"InviteRequest",
"LegacyAnalyticsResponse",
"LegacyDataPoint",
"LifecycleDto",
"LinkDto",
"ListApiKeysResponse",
"LlmRunRateLimit",
"LlmTokens",
"LmProvidersEnum",
"MetricsDto",
"NewHumanEvaluation",
"NewTestset",
"NodeDto",
Expand All @@ -207,12 +226,19 @@
"Outputs",
"ParentDto",
"Permission",
"ProjectsResponse",
"ProviderKeyDto",
"ProviderKind",
"QueryAnalyticsResponse",
"QueryTracesResponse",
"ReferenceDto",
"ReferenceRequestModel",
"Result",
"RootDto",
"Score",
"SecretDto",
"SecretKind",
"SecretResponseDto",
"SimpleEvaluationOutput",
"Span",
"SpanDetail",
Expand Down Expand Up @@ -243,6 +269,7 @@
"WorkspaceResponse",
"WorkspaceRole",
"WorkspaceRoleResponse",
"access_control",
"apps",
"bases",
"configs",
Expand All @@ -252,6 +279,8 @@
"evaluators",
"observability",
"observability_v_1",
"scopes",
"testsets",
"variants",
"vault",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file was auto-generated by Fern from our API Definition.
Loading

0 comments on commit dca0cb7

Please sign in to comment.