diff --git a/.cursorrules b/.cursorrules deleted file mode 100644 index 9dd95f8..0000000 --- a/.cursorrules +++ /dev/null @@ -1,40 +0,0 @@ -You are an AI assistant specialized in Python development. Your approach emphasizes: - -Clear project structure with separate directories for source code, tests, docs, and config. - -Modular design with distinct files for models, services, controllers, and utilities. - -Configuration management using environment variables. - -Robust error handling and logging, including context capture. - -Comprehensive testing with pytest. - -Detailed documentation using docstrings and README files. - -Dependency management via conda and virtual environments. - -Code style consistency using Ruff. - -CI/CD implementation with GitHub Actions. - -AI-friendly coding practices: - -You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development. - -Follow the following rules: - -For any python file, be sure to ALWAYS add typing annotations to each function or class. Be sure to include return types when necessary. Add descriptive docstrings to all python functions and classes as well. Please use pep257 convention. Update existing docstrings if need be. - -Make sure you keep any comments that exist in a file. - -When writing tests, make sure that you ONLY use pytest or pytest plugins, do NOT use the unittest module. All tests should have typing annotations as well. All tests should be in ./tests. Be sure to create all necessary files and folders. If you are creating files inside of ./tests or ./src/goob_ai, be sure to make a init.py file if one does not exist. - -All tests should be fully annotated and should contain docstrings. Be sure to import the following if TYPE_CHECKING: - -from _pytest.capture import CaptureFixture -from _pytest.fixtures import FixtureRequest -from _pytest.logging import LogCaptureFixture -from _pytest.monkeypatch import MonkeyPatch -from pytest_mock.plugin import MockerFixture - diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index 4b16343..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -pytest==7.3.1 -pytest-asyncio==0.23.6 -pytest-cov==6.0.0 -pytest-mock==3.14.0 -ragas==0.2.10 -langchain_openai==0.3.5 diff --git a/docker/start_docker.sh b/docker/start_docker.sh deleted file mode 100755 index f3dea9b..0000000 --- a/docker/start_docker.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash - -# this program is used to start the docker container for the leettools service - -set -e -u - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -BASE_DIR="$(cd "$DIR"/.. && pwd)" - -# read the optional .env filename if specified on command line using -e flag -# default is .env -ENV_FILE=".env" - -# Default values -FORCE_REMOVE=false - -# Initialize MOUNT_DIRS as an array -declare -a MOUNT_DIRS=() - -while getopts ":e:fm:" opt; do - case ${opt} in - e ) - ENV_FILE=$OPTARG - # if the file does not exist, exit - if [ ! -f "${BASE_DIR}"/"${ENV_FILE}" ]; then - echo "Specified env file not found: ${BASE_DIR}/${ENV_FILE}" - exit 1 - fi - ;; - f ) - FORCE_REMOVE=true - ;; - m ) - # Split multiple mount directories by comma and add to array - IFS=',' read -ra MOUNTS <<< "$OPTARG" - for mount in "${MOUNTS[@]}"; do - MOUNT_DIRS+=("$mount") - done - ;; - \? ) - echo "Usage: $0 [-e ] [-f] [-m ]" - echo " -e Specify environment file (default: ${BASE_DIR}/.env)" - echo " -f Force remove existing container" - echo " -m Specify comma-separated directories to mount (format: src:dest[,src2:dest2,...])" - exit 1 - ;; - esac -done - -# convert MOUNT_DIRS array to mount options -mount_opts="" -if [ ${#MOUNT_DIRS[@]} -gt 0 ]; then - for mount in "${MOUNT_DIRS[@]}"; do - mount_opts+="-v $mount:ro " - done -fi - -org_name="leettools" -app_name="leettools" -container_name="leettools" - -# If force remove is enabled, stop and remove existing container -if [ "$FORCE_REMOVE" = true ]; then - # Check if container exists and is running - if docker ps | grep -q "$container_name"; then - echo "Stopping running $container_name container..." - docker stop "$container_name" 2>/dev/null || true - fi - # Check if container exists (running or not) - if docker ps -a | grep -q "$container_name"; then - echo "Removing $container_name container..." - docker rm "$container_name" 2>/dev/null || true - fi -else - # Check if container exists (running or not) - if docker ps -a | grep -q "$container_name"; then - echo -e "\033[1;33mWarning:\033[0m $container_name container already exists" >&2 - echo -e "\033[1;33mSolution:\033[0m Use -f flag to force remove existing container" >&2 - exit 1 - fi -fi - -# read the version number project.toml file and use in the docker image -version=$(grep "^version = " "$BASE_DIR"/pyproject.toml | cut -d'"' -f2) - -# check if the version number is valid -if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Invalid version number: $version" - exit 1 -fi - -# check if the docker image exists -if ! docker images "${org_name}/${app_name}":"${version}" | grep -q "${version}"; then - echo "Docker image ${org_name}/${app_name}:${version} does not exist" - version="latest" - if ! docker images "${org_name}/${app_name}":"${version}" | grep -q "${version}"; then - echo "Docker image leettools-dev/leettools:${version} does not exist" - exit 1 - fi - echo "Using latest version instead" -fi - -# Check if the .env file exists in the root directory -if [ -f "${BASE_DIR}"/"${ENV_FILE}" ]; then - #Load environment variables from .env file - while IFS='=' read -r name value; do - if [[ ! $name =~ ^\# ]] && [[ -n $name ]]; then - # echo "$name" "$value"; - export "$name=$value"; - fi; - done < "${BASE_DIR}"/"${ENV_FILE}" - envfile_opt="--env-file ${BASE_DIR}/${ENV_FILE}" -else - envfile_opt="" -fi - -# check if the LEET_HOME, EDS_DATA_DIR, and EDS_LOG_DIR environment variables are set -if [ -z "${LEET_HOME:-}" ]; then - case "$(uname -s)" in - Darwin|Linux) - LEET_HOME=~/leettools - ;; - CYGWIN*|MINGW*|MSYS*) - LEET_HOME="$USERPROFILE/leettools" - ;; - *) - echo "Unsupported operating system, using the value from .env file" - ;; - esac - echo "LEET_HOME is not set, using the default value: $LEET_HOME" - export LEET_HOME="$LEET_HOME" -fi - -if [ -z "${EDS_DATA_DIR:-}" ]; then - EDS_DATA_DIR="${LEET_HOME}/data" -fi - -if [ -z "${EDS_LOG_DIR:-}" ]; then - EDS_LOG_DIR="${LEET_HOME}/logs" -fi - -if [ -z "${EDS_API_SERVICE_PORT:-}" ]; then - EDS_API_SERVICE_PORT=8000 -fi - -# run the docker container as a service with port 8000:8000 -# mount the data directory at $LEET_HOME, $EDS_DATA_DIR, $EDS_LOG_DIR -# run the docker container with the .env.docker file -leet_home_in_docker="/leettools" - -# print the docker run command -echo "Running docker container with command:" -echo "docker run -d ${envfile_opt} ${mount_opts} \\ - --name \"$container_name\" \\ - -p \"$EDS_API_SERVICE_PORT\":\"$EDS_API_SERVICE_PORT\" \\ - -e LEET_HOME=\"$leet_home_in_docker\" \\ - -v \"$LEET_HOME\":\"$leet_home_in_docker\" \\ - -v \"$EDS_DATA_DIR\":\"$leet_home_in_docker/data\" \\ - -v \"$EDS_LOG_DIR\":\"$leet_home_in_docker/logs\" \\ - ${org_name}/${app_name}:\"${version}\"" - -# run the docker container -# shellcheck disable=SC2086 -docker run -d ${envfile_opt} ${mount_opts} \ - --name "$container_name" \ - -p "$EDS_API_SERVICE_PORT":"$EDS_API_SERVICE_PORT" \ - -e LEET_HOME="$leet_home_in_docker" \ - -v "$LEET_HOME":"$leet_home_in_docker" \ - -v "$EDS_DATA_DIR":"$leet_home_in_docker/data" \ - -v "$EDS_LOG_DIR":"$leet_home_in_docker/logs" \ - ${org_name}/${app_name}:"${version}" \ No newline at end of file diff --git a/src/leettools/requirements.txt b/src/leettools/requirements.txt deleted file mode 100644 index 1f2a5a9..0000000 --- a/src/leettools/requirements.txt +++ /dev/null @@ -1,22 +0,0 @@ -beautifulsoup4==4.12.3 -chonkie==0.1.2 -click==8.1.7 -docling==2.10.0 -docling_core==2.9.0 -Jinja2==3.1.3 -markdownify==0.13.1 -nltk==3.8.1 -numpy==2.2.0 -openai==1.57.2 -psutil==5.9.8 -pydantic==2.10.3 -python-dotenv==1.0.1 -Requests==2.32.3 -rich==13.9.4 -scipy==1.14.1 -sentence_transformers==2.5.1 -tiktoken==0.8.0 -tldextract==5.1.3 -urllib3==2.2.3 -duckdb==1.1.3 -