diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml index 12d4e197..faadc048 100644 --- a/.github/workflows/automation.yml +++ b/.github/workflows/automation.yml @@ -28,9 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -e . - pip install pytest pytest-cov pytest-mock pytest-asyncio pytest-timeout + pip install -e ".[dev]" - name: Run tests env: @@ -97,5 +95,5 @@ jobs: - name: Check dependencies with safety run: | - pip install -r requirements.txt + pip install -e ".[dev]" safety check --full-report || echo "::warning::Vulnerable dependencies found." diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7b63636..b2fe27bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt') }} + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip-${{ matrix.python-version }}- ${{ runner.os }}-pip- @@ -68,10 +68,7 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - pip install -r requirements.txt - pip install -r requirements-dev.txt - pip install -e . - pip install pytest pytest-cov pytest-timeout pytest-asyncio pytest-mock + pip install -e ".[dev]" - name: Run tests with coverage env: diff --git a/AGENTS.md b/AGENTS.md index 9f86e362..95100f68 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,8 +37,7 @@ cortex install nginx --dry-run ```bash python3 -m venv venv source venv/bin/activate -pip install -e . -pip install -r requirements-dev.txt +pip install -e ".[dev]" pytest tests/ -v ``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a2edaebf..3048d5dc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -123,24 +123,19 @@ git remote add upstream https://github.com/cortexlinux/cortex.git python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -# Install dependencies -pip install -r requirements.txt -pip install -r requirements-dev.txt - -# Install in development mode -pip install -e . +# Install in development mode (includes all dependencies) +pip install -e ".[dev]" # Run tests to verify setup pytest tests/ -v ``` -### Requirements Files - -If `requirements-dev.txt` doesn't exist, install these manually: +### Dependencies -```bash -pip install pytest pytest-cov pytest-mock black pylint mypy bandit -``` +All dependencies are defined in `pyproject.toml`. To install: +- **Core dependencies**: `pip install -e .` +- **With dev tools**: `pip install -e ".[dev]"` +- **All extras**: `pip install -e ".[all]"` ### IDE Setup diff --git a/Makefile b/Makefile index 35aab6c9..0074bdd5 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,7 @@ help: dev: $(PYTHON) -m pip install -U pip - $(PYTHON) -m pip install -e . - $(PYTHON) -m pip install -r requirements-dev.txt + $(PYTHON) -m pip install -e ".[dev]" @echo "✅ Dev environment ready" test: diff --git a/README.md b/README.md index 19948549..174113c0 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,12 @@ python3 -m venv venv source venv/bin/activate # 3. Install Cortex +# Using pyproject.toml (recommended) pip install -e . +# Or install with dev dependencies +pip install -e ".[dev]" + # 4. Configure AI Provider (choose one): ## Option A: Ollama (FREE - Local LLM, no API key needed) diff --git a/docs/guides/Developer-Guide.md b/docs/guides/Developer-Guide.md index 99e5ab7a..4a06cead 100644 --- a/docs/guides/Developer-Guide.md +++ b/docs/guides/Developer-Guide.md @@ -11,8 +11,7 @@ python3 -m venv venv source venv/bin/activate # Install dev dependencies -pip install -r requirements.txt -pip install -r requirements-dev.txt +pip install -e ".[dev]" # Run tests pytest tests/ diff --git a/docs/guides/Getting-Started.md b/docs/guides/Getting-Started.md index 89b84ce9..5984a413 100644 --- a/docs/guides/Getting-Started.md +++ b/docs/guides/Getting-Started.md @@ -12,8 +12,8 @@ git clone https://github.com/cortexlinux/cortex.git cd cortex -# Install dependencies -pip install -r requirements.txt +# Install Cortex +pip install -e . # Configure API key export ANTHROPIC_API_KEY="your-key-here" diff --git a/pyproject.toml b/pyproject.toml index e59f5b83..2879e774 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,23 +42,36 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ + # LLM Provider APIs "anthropic>=0.18.0", "openai>=1.0.0", - "rich>=13.0.0", + # HTTP requests (for GitHub API, network operations) + "requests>=2.32.4", + # Configuration file parsing "pyyaml>=6.0.0", + # Environment variable loading from .env files "python-dotenv>=1.0.0", + # Encryption for environment variable secrets + "cryptography>=42.0.0", + # Terminal UI and formatting + "rich>=13.0.0", + # Type hints for older Python versions + "typing-extensions>=4.0.0", ] [project.optional-dependencies] dev = [ "pytest>=7.0.0", "pytest-cov>=4.0.0", - "pytest-timeout>=2.0.0", - "black>=23.0.0", - "ruff>=0.1.0", + "pytest-asyncio>=0.23.0", + "pytest-mock>=3.12.0", + "pytest-timeout>=2.3.0", + "black>=24.0.0", + "ruff>=0.8.0", "mypy>=1.0.0", "pre-commit>=3.0.0", "isort>=5.0.0", + "build>=0.10.0", ] security = [ "bandit>=1.7.0", diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 2ccb0205..00000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Development Dependencies -pytest>=7.0.0 -pytest-cov>=4.0.0 -pytest-asyncio>=0.23.0 -pytest-mock>=3.12.0 -pytest-timeout>=2.3.1 -black>=24.0.0 -ruff>=0.8.0 -isort>=5.13.0 -pre-commit>=3.0.0 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 166a777e..00000000 --- a/requirements.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Cortex Linux - Core Dependencies - -# LLM Provider APIs -anthropic>=0.18.0 -openai>=1.0.0 -requests>=2.32.4 - -# Configuration -PyYAML>=6.0.0 - -# Environment variable loading from .env files -python-dotenv>=1.0.0 - -# Encryption for environment variable secrets -cryptography>=42.0.0 - -# Terminal UI -rich>=13.0.0 - -# Configuration -pyyaml>=6.0.0 - -# Type hints for older Python versions -typing-extensions>=4.0.0 -PyYAML==6.0.3 diff --git a/setup.py b/setup.py deleted file mode 100644 index 3a218042..00000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -import os - -from setuptools import find_packages, setup - -with open("README.md", encoding="utf-8") as fh: - long_description = fh.read() - -# Try to read requirements from root, fallback to LLM directory -requirements_path = "requirements.txt" -if not os.path.exists(requirements_path): - requirements_path = os.path.join("LLM", "requirements.txt") - -if os.path.exists(requirements_path): - with open(requirements_path, encoding="utf-8") as fh: - requirements = [ - line.strip() - for line in fh - if line.strip() and not line.startswith("#") and not line.startswith("-r") - ] -else: - requirements = ["anthropic>=0.18.0", "openai>=1.0.0"] - -setup( - name="cortex-linux", - version="0.1.0", - author="Cortex Linux", - author_email="mike@cortexlinux.com", - description="AI-powered Linux command interpreter", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/cortexlinux/cortex", - packages=find_packages(), - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "Topic :: System :: Installation/Setup", - "Topic :: System :: Systems Administration", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Operating System :: POSIX :: Linux", - ], - python_requires=">=3.10", - install_requires=requirements, - entry_points={ - "console_scripts": [ - "cortex=cortex.cli:main", - ], - }, - include_package_data=True, -) diff --git a/tests/integration/test_end_to_end.py b/tests/integration/test_end_to_end.py index 00776095..ebf36bb8 100644 --- a/tests/integration/test_end_to_end.py +++ b/tests/integration/test_end_to_end.py @@ -17,8 +17,8 @@ "PYTHONPATH": "/workspace", "PYTHONDONTWRITEBYTECODE": "1", } -PIP_BOOTSTRAP = "python -m pip install --quiet --upgrade pip setuptools && python -m pip install --quiet --no-cache-dir -r /workspace/requirements.txt" -PIP_BOOTSTRAP_DEV = "python -m pip install --quiet --upgrade pip setuptools && python -m pip install --quiet --no-cache-dir -r /workspace/requirements.txt -r /workspace/requirements-dev.txt" +PIP_BOOTSTRAP = "python -m pip install --quiet --upgrade pip setuptools build && python -m pip install --quiet --no-cache-dir -e /workspace" +PIP_BOOTSTRAP_DEV = "python -m pip install --quiet --upgrade pip setuptools build && python -m pip install --quiet --no-cache-dir -e /workspace[dev]" @unittest.skipUnless(docker_available(), "Docker is required for integration tests")