Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make python test dependencies optional #815

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
python-version-file: 'pyproject.toml'

- name: Install Python Deps
run: python -m pip install "."
run: python -m pip install ".[dev]"

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run: docker run -p 50051:50051 -d --name=repeater ghcr.io/defenseunicorns/leapfrogai/repeater:dev

- name: Install Python Deps
run: pip install "." "src/leapfrogai_api" "src/leapfrogai_sdk"
run: pip install ".[dev]" "src/leapfrogai_api" "src/leapfrogai_sdk"

- name: Run Pytest
run: python -m pytest tests/pytest -v
Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ license = {file = "LICENSE"}
dependencies = [ # Dev dependencies needed for all of lfai
"openai",
"pip-tools == 7.3.0",
"pytest",
"pytest-asyncio",
"httpx",
"ruff",
"python-dotenv",
"pytest-asyncio",
"locust",
"requests-toolbelt"
"python-dotenv"
]
requires-python = "~=3.11"

[project.optional-dependencies]
dev = ["locust", "pytest-asyncio", "requests-toolbelt", "pytest"]

[tool.pip-tools]
generate-hashes = true

Expand Down
1 change: 1 addition & 0 deletions src/leapfrogai_api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ install-api:
python -m pip install ../../src/leapfrogai_sdk
@cd ${MAKEFILE_DIR} && \
python -m pip install -e .
python -m pip install "../../.[dev]"

dev-run-api:
@cd ${MAKEFILE_DIR} && \
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ make build-llama-cpp-python
uds zarf package deploy zarf-package-llama-cpp-python-*.tar.zst

# Install the python dependencies
python -m pip install "."
python -m pip install ".[dev]"

# Run the tests!
# NOTE: Each model backend has its own e2e test files
Expand Down
13 changes: 9 additions & 4 deletions tests/load/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,21 @@ Before running the tests, ensure that your API URL and bearer token are properly

To start the Locust web interface and run the tests:

1. Navigate to the directory containing `loadtest.py`.
1. Install dependencies from the project root.
```bash
pip install ".[dev]"
```

2. Navigate to the directory containing `loadtest.py`.

2. Execute the following command:
3. Execute the following command:
```bash
locust -f loadtest.py --web-port 8089
```

3. Open your web browser and go to `http://0.0.0.0:8089`.
4. Open your web browser and go to `http://0.0.0.0:8089`.

4. Use the Locust web interface to configure and run your tests:
5. Use the Locust web interface to configure and run your tests:
- Set the number of users to simulate
- Set the spawn rate (users per second)
- Choose the host to test against (should match your `API_URL`)
Expand Down