-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,040 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# OpenAI compatible server address. | ||
|
||
# If you are going to run custom OpenAI API compatible service change this configuration. | ||
# Could be specified by --openai-base-url CLI parameter | ||
OPENAI_BASE_URL=http://127.0.0.1:8080 | ||
|
||
# The OpenAI API Key. | ||
# Could be specified by --openai-api-key CLI parameter | ||
OPENAI_API_KEY=invalid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
TODO | ||
name: Code Quality Check | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
code_quality: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox | ||
- name: Run tox | ||
run: tox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
TODO | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,66 @@ | ||
.PHONY: install | ||
install: | ||
pip install -r requirements.txt | ||
python -m pip install . | ||
|
||
install-dev: | ||
pip install -e .[dev] | ||
|
||
quality: | ||
ruff check src tests | ||
isort --check-only src tests | ||
flake8 src tests --max-line-length 88 | ||
mypy src | ||
.PHONY: install.dev | ||
install.dev: | ||
python -m pip install -e .[dev] | ||
|
||
|
||
.PHONY: build | ||
build: | ||
python setup.py sdist bdist_wheel | ||
|
||
.PHONY: style | ||
style: | ||
ruff format src tests | ||
isort src tests | ||
flake8 src tests --max-line-length 88 | ||
python -m ruff format src tests | ||
python -m isort src tests | ||
python -m flake8 src tests --max-line-length 88 | ||
|
||
|
||
.PHONY: types | ||
types: | ||
python -m mypy --check-untyped-defs | ||
|
||
|
||
.PHONY: quality | ||
quality: | ||
python -m ruff check src tests | ||
python -m black --check src tests | ||
python -m isort --check src tests | ||
python -m mypy --check-untyped-defs | ||
|
||
|
||
|
||
.PHONY: test | ||
test: | ||
python -m pytest -s -vvv --cache-clear tests/ | ||
python -m pytest -s -vvv --cache-clear tests | ||
|
||
build: | ||
python setup.py sdist bdist_wheel | ||
|
||
.PHONY: test.unit | ||
test.unit: | ||
python -m pytest tests/unit | ||
|
||
|
||
.PHONY: test.integration | ||
test.integration: | ||
python -m pytest tests/integration | ||
|
||
|
||
.PHONY: test.e2e | ||
test.e2e: | ||
python -m pytest tests/e2e | ||
|
||
|
||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf __pycache__ | ||
rm -rf build | ||
rm -rf dist | ||
rm -rf *.egg-info | ||
find . -type f -name "*.pyc" -delete | ||
find . -type d -name "__pycache__" -exec rm -r {} + | ||
rm -rf .mypy_cache | ||
rm -rf .pytest_cache | ||
|
||
.PHONY: install install-dev quality style test test-unit test-integration test-e2e test-smoke test-sanity test-regression build clean | ||
rm -rf .tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,70 @@ | ||
# guidellm | ||
# guidellm | ||
|
||
# Project configuration | ||
|
||
The project is configured with environment variables. Check the example in `.env.example`. | ||
|
||
```sh | ||
# Create .env file and update the configuration | ||
cp .env.example .env | ||
|
||
# Export all variables | ||
set -o allexport; source .env; set +o allexport | ||
``` | ||
|
||
## Environment Variables | ||
|
||
| Variable | Default Value | Description | | ||
| --------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| OPENAI_BASE_URL | http://127.0.0.1:8080 | The host where the `openai` library will make requests to. For running integration tests it is required to have the external OpenAI compatible server running. | | ||
| OPENAI_API_KEY | invalid | [OpenAI Platform](https://platform.openai.com/api-keys) to create a new API key. This value is not used for tests. | | ||
|
||
</br> | ||
|
||
# Code Quality | ||
|
||
The variety of tools are available for checking the code quality. | ||
|
||
All the code quality tools configuration is placed into next files: `pyproject.toml`, `Makefile`, `tox.ini` | ||
|
||
**To provide the code quality next tools are used:** | ||
|
||
- `pytest` as a testing framework | ||
- `ruff` as a linter | ||
- `black` & `isort` as formatters | ||
- `mypy` as a static type checker | ||
- `tox` as a automation tool | ||
- `make` as a automation tool (works only on Unix by default) | ||
|
||
**Checking code quality using CLI** | ||
|
||
All the tools could be run right from the CLI. | ||
|
||
Recommended command template: `python -m pytest test.integration` | ||
|
||
|
||
**Checking code quality using Makefile** | ||
|
||
Using `Makefile` you can run almost all common scripts to check the code quality, install dependencies, and to provide auto fixes. All the commands from the `Makefile` are valid to be used in the CLI. | ||
|
||
Here are some commands | ||
|
||
```sh | ||
# install dev dependencies | ||
make install.dev | ||
|
||
# run unit tests | ||
make test.unit | ||
|
||
# run quality checkers | ||
make quality | ||
|
||
# run autofixes | ||
make style | ||
``` | ||
|
||
**Checking code quality using tox** | ||
|
||
The `tox` is an automation tool for running code quality checkers for selected Python versions. The configuration is placed in the `tox.ini`. | ||
|
||
To run the automation just run: `python -m tox` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
TODO | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from .base import Backend, BackendTypes, GenerativeResponse | ||
from .base import Backend, BackendEngine, GenerativeResponse | ||
from .openai import OpenAIBackend | ||
|
||
__all__ = [ | ||
"Backend", | ||
"BackendTypes", | ||
"BackendEngine", | ||
"GenerativeResponse", | ||
"OpenAIBackend", | ||
] |
Oops, something went wrong.