Skip to content

Commit 1dbf867

Browse files
committed
Merge branch 'features/refactor/core' into features/refactor/base-draft
[GuideLLM Refactor] core updates for pyproject.toml and settings.py #352
2 parents a2d19cd + 669848d commit 1dbf867

File tree

21 files changed

+92
-90
lines changed

21 files changed

+92
-90
lines changed

pyproject.toml

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ include = ["*"]
1010
[tool.setuptools.package-data]
1111
"guidellm.data" = ["*.gz"]
1212

13-
[tool.pdm]
14-
distribution = true
15-
1613

1714
# ************************************************
1815
# ********** Project Metadata **********
@@ -24,9 +21,8 @@ name = "guidellm"
2421
description = "Guidance platform for deploying and managing large language models."
2522
readme = { file = "README.md", content-type = "text/markdown" }
2623
requires-python = ">=3.9.0,<4.0"
27-
license = "Apache-2.0"
28-
license-files = ["LICENSE"]
29-
authors = [ { name = "Red Hat" } ]
24+
license = { text = "Apache-2.0" }
25+
authors = [{ name = "Red Hat" }]
3026
keywords = [
3127
"ai",
3228
"benchmarking",
@@ -47,25 +43,27 @@ keywords = [
4743
]
4844
dependencies = [
4945
"click>=8.0.0,<8.2.0",
46+
"culsans~=0.9.0",
5047
"datasets",
48+
"eval_type_backport",
49+
"faker",
5150
"ftfy>=6.0.0",
5251
"httpx[http2]<1.0.0",
5352
"loguru",
53+
"msgpack",
5454
"numpy",
5555
"pillow",
5656
"protobuf",
5757
"pydantic>=2.11.7",
5858
"pydantic-settings>=2.0.0",
5959
"pyyaml>=6.0.0",
6060
"rich",
61+
"sanic",
6162
"transformers",
63+
"uvloop>=0.18",
6264
]
6365

6466
[project.optional-dependencies]
65-
recommended = [
66-
"tiktoken>=0.11.0", # For OpenAI tokenizer
67-
"blobfile>=3.1.0", # For OpenAI tokenizer
68-
]
6967
dev = [
7068
# build
7169
"build>=1.0.0",
@@ -81,7 +79,7 @@ dev = [
8179
# testing
8280
"lorem~=0.1.1",
8381
"pytest~=8.2.2",
84-
"pytest-asyncio~=0.23.8",
82+
"pytest-asyncio~=1.1.0",
8583
"pytest-cov~=5.0.0",
8684
"pytest-mock~=3.14.0",
8785
"pytest-rerunfailures~=14.0",
@@ -106,9 +104,6 @@ dev = [
106104
"mkdocs-linkcheck~=1.0.6",
107105
]
108106

109-
[dependency-groups]
110-
dev = [ "guidellm[dev]" ]
111-
112107
[project.urls]
113108
homepage = "https://github.com/vllm-project/guidellm"
114109
source = "https://github.com/vllm-project/guidellm"
@@ -143,11 +138,17 @@ exclude = ["venv", ".tox"]
143138
follow_imports = 'silent'
144139

145140
[[tool.mypy.overrides]]
146-
module = ["datasets.*", "transformers.*", "setuptools.*", "setuptools_git_versioning.*"]
147-
ignore_missing_imports=true
141+
module = [
142+
"datasets.*",
143+
"transformers.*",
144+
"setuptools.*",
145+
"setuptools_git_versioning.*",
146+
]
147+
ignore_missing_imports = true
148148

149149

150150
[tool.ruff]
151+
target-version = "py39"
151152
line-length = 88
152153
indent-width = 4
153154
exclude = ["build", "dist", "env", ".venv"]
@@ -158,82 +159,83 @@ indent-style = "space"
158159

159160
[tool.ruff.lint]
160161
ignore = [
161-
"PLR0913",
162-
"TC001",
163-
"COM812",
164-
"ISC001",
165-
"TC002",
162+
"COM812", # ignore trailing comma errors due to older Python versions
163+
"PD011", # ignore .values usage since ruff assumes it's a Pandas DataFrame
164+
"PLR0913", # ignore too many arguments in function definitions
166165
"PLW1514", # allow Path.open without encoding
167-
"RET505", # allow `else` blocks
168-
"RET506", # allow `else` blocks
169-
"PD011", # ignore .values usage since ruff assumes it's a Pandas DataFrame
166+
"RET505", # allow `else` blocks
167+
"RET506", # allow `else` blocks
168+
"S311", # allow standard pseudo-random generators
169+
"TC001", # ignore imports used only for type checking
170+
"TC002", # ignore imports used only for type checking
171+
"TC003", # ignore imports used only for type checking
170172
]
171173
select = [
172174
# Rules reference: https://docs.astral.sh/ruff/rules/
173175

174176
# Code Style / Formatting
175-
"E", # pycodestyle: checks adherence to PEP 8 conventions including spacing, indentation, and line length
176-
"W", # pycodestyle: checks adherence to PEP 8 conventions including spacing, indentation, and line length
177-
"A", # flake8-builtins: prevents shadowing of Python built-in names
178-
"C", # Convention: ensures code adheres to specific style and formatting conventions
179-
"COM", # flake8-commas: enforces the correct use of trailing commas
180-
"ERA", # eradicate: detects commented-out code that should be removed
181-
"I", # isort: ensures imports are sorted in a consistent manner
182-
"ICN", # flake8-import-conventions: enforces import conventions for better readability
183-
"N", # pep8-naming: enforces PEP 8 naming conventions for classes, functions, and variables
184-
"NPY", # NumPy: enforces best practices for using the NumPy library
185-
"PD", # pandas-vet: enforces best practices for using the pandas library
186-
"PT", # flake8-pytest-style: enforces best practices and style conventions for pytest tests
187-
"PTH", # flake8-use-pathlib: encourages the use of pathlib over os.path for file system operations
188-
"Q", # flake8-quotes: enforces consistent use of single or double quotes
189-
"TCH", # flake8-type-checking: enforces type checking practices and standards
190-
"TID", # flake8-tidy-imports: enforces tidy and well-organized imports
177+
"E", # pycodestyle: checks adherence to PEP 8 conventions including spacing, indentation, and line length
178+
"W", # pycodestyle: checks adherence to PEP 8 conventions including spacing, indentation, and line length
179+
"A", # flake8-builtins: prevents shadowing of Python built-in names
180+
"C", # Convention: ensures code adheres to specific style and formatting conventions
181+
"COM", # flake8-commas: enforces the correct use of trailing commas
182+
"ERA", # eradicate: detects commented-out code that should be removed
183+
"I", # isort: ensures imports are sorted in a consistent manner
184+
"ICN", # flake8-import-conventions: enforces import conventions for better readability
185+
"N", # pep8-naming: enforces PEP 8 naming conventions for classes, functions, and variables
186+
"NPY", # NumPy: enforces best practices for using the NumPy library
187+
"PD", # pandas-vet: enforces best practices for using the pandas library
188+
"PT", # flake8-pytest-style: enforces best practices and style conventions for pytest tests
189+
"PTH", # flake8-use-pathlib: encourages the use of pathlib over os.path for file system operations
190+
"Q", # flake8-quotes: enforces consistent use of single or double quotes
191+
"TCH", # flake8-type-checking: enforces type checking practices and standards
192+
"TID", # flake8-tidy-imports: enforces tidy and well-organized imports
191193
"RUF022", # flake8-ruff: enforce sorting of __all__ in modules
192194

193195
# Code Structure / Complexity
194-
"C4", # flake8-comprehensions: improves readability and performance of list, set, and dict comprehensions
196+
"C4", # flake8-comprehensions: improves readability and performance of list, set, and dict comprehensions
195197
"C90", # mccabe: checks for overly complex code using cyclomatic complexity
196198
"ISC", # flake8-implicit-str-concat: prevents implicit string concatenation
197199
"PIE", # flake8-pie: identifies and corrects common code inefficiencies and mistakes
198-
"R", # Refactor: suggests improvements to code structure and readability
200+
"R", # Refactor: suggests improvements to code structure and readability
199201
"SIM", # flake8-simplify: simplifies complex expressions and improves code readability
200202

201203
# Code Security / Bug Prevention
202-
"ARG", # flake8-unused-arguments: detects unused function and method arguments
204+
"ARG", # flake8-unused-arguments: detects unused function and method arguments
203205
"ASYNC", # flake8-async: identifies incorrect or inefficient usage patterns in asynchronous code
204-
"B", # flake8-bugbear: detects common programming mistakes and potential bugs
205-
"BLE", # flake8-blind-except: prevents blind exceptions that catch all exceptions without handling
206-
"E", # Error: detects and reports errors in the code
207-
"F", # Pyflakes: detects unused imports, shadowed imports, undefined variables, and various formatting errors in string operations
208-
"INP", # flake8-no-pep420: prevents implicit namespace packages by requiring __init__.py
209-
"PGH", # pygrep-hooks: detects deprecated and dangerous code patterns
210-
"PL", # Pylint: comprehensive source code analyzer for enforcing coding standards and detecting errors
211-
"RSE", # flake8-raise: ensures exceptions are raised correctly
212-
"S", # flake8-bandit: detects security issues and vulnerabilities in the code
213-
"SLF", # flake8-self: prevents incorrect usage of the self argument in class methods
214-
"T10", # flake8-debugger: detects the presence of debugging tools such as pdb
215-
"T20", # flake8-print: detects print statements left in the code
216-
"UP", # pyupgrade: automatically upgrades syntax for newer versions of Python
217-
"W", # Warning: provides warnings about potential issues in the code
218-
"YTT", # flake8-2020: identifies code that will break with future Python releases
206+
"B", # flake8-bugbear: detects common programming mistakes and potential bugs
207+
"BLE", # flake8-blind-except: prevents blind exceptions that catch all exceptions without handling
208+
"E", # Error: detects and reports errors in the code
209+
"F", # Pyflakes: detects unused imports, shadowed imports, undefined variables, and various formatting errors in string operations
210+
"INP", # flake8-no-pep420: prevents implicit namespace packages by requiring __init__.py
211+
"PGH", # pygrep-hooks: detects deprecated and dangerous code patterns
212+
"PL", # Pylint: comprehensive source code analyzer for enforcing coding standards and detecting errors
213+
"RSE", # flake8-raise: ensures exceptions are raised correctly
214+
"S", # flake8-bandit: detects security issues and vulnerabilities in the code
215+
"SLF", # flake8-self: prevents incorrect usage of the self argument in class methods
216+
"T10", # flake8-debugger: detects the presence of debugging tools such as pdb
217+
"T20", # flake8-print: detects print statements left in the code
218+
"UP", # pyupgrade: automatically upgrades syntax for newer versions of Python
219+
"W", # Warning: provides warnings about potential issues in the code
220+
"YTT", # flake8-2020: identifies code that will break with future Python releases
219221

220222
# Code Documentation
221223
"FIX", # flake8-fixme: detects FIXMEs and other temporary comments that should be resolved
222224
]
223225

224226
[tool.ruff.lint.extend-per-file-ignores]
225227
"tests/**/*.py" = [
226-
"S101", # asserts allowed in tests
227-
"ARG", # Unused function args allowed in tests
228+
"S101", # asserts allowed in tests
229+
"ARG", # Unused function args allowed in tests
228230
"PLR2004", # Magic value used in comparison
229-
"TCH002", # No import only type checking in tests
230-
"SLF001", # enable private member access in tests
231-
"S105", # allow hardcoded passwords in tests
232-
"S311", # allow standard pseudo-random generators in tests
233-
"PT011", # allow generic exceptions in tests
234-
"N806", # allow uppercase variable names in tests
235-
"PGH003", # allow general ignores in tests
236-
"S106", # allow hardcoded passwords in tests
231+
"TCH002", # No import only type checking in tests
232+
"SLF001", # enable private member access in tests
233+
"S105", # allow hardcoded passwords in tests
234+
"S311", # allow standard pseudo-random generators in tests
235+
"PT011", # allow generic exceptions in tests
236+
"N806", # allow uppercase variable names in tests
237+
"PGH003", # allow general ignores in tests
238+
"S106", # allow hardcoded passwords in tests
237239
"PLR0915", # allow complext statements in tests
238240
]
239241

@@ -246,5 +248,5 @@ addopts = '-s -vvv --cache-clear'
246248
markers = [
247249
"smoke: quick tests to check basic functionality",
248250
"sanity: detailed tests to ensure major functions work correctly",
249-
"regression: tests to ensure that new changes do not break existing functionality"
251+
"regression: tests to ensure that new changes do not break existing functionality",
250252
]

src/guidellm/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
hf_logging.set_verbosity_error()
2121
logging.getLogger("transformers").setLevel(logging.ERROR)
2222

23-
from .config import (
23+
from .logger import configure_logger, logger
24+
from .settings import (
2425
DatasetSettings,
2526
Environment,
2627
LoggingSettings,
@@ -30,7 +31,6 @@
3031
reload_settings,
3132
settings,
3233
)
33-
from .logger import configure_logger, logger
3434

3535
__all__ = [
3636
"DatasetSettings",

src/guidellm/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
)
1414
from guidellm.benchmark.entrypoints import benchmark_with_scenario
1515
from guidellm.benchmark.scenario import GenerativeTextScenario, get_builtin_scenarios
16-
from guidellm.config import print_config
1716
from guidellm.preprocess.dataset import ShortPromptStrategy, process_dataset
1817
from guidellm.scheduler import StrategyType
18+
from guidellm.settings import print_config
1919
from guidellm.utils import DefaultGroupHandler
2020
from guidellm.utils import cli as cli_tools
2121

src/guidellm/backend/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from PIL import Image
88

99
from guidellm.backend.response import ResponseSummary, StreamingTextResponse
10-
from guidellm.config import settings
10+
from guidellm.settings import settings
1111

1212
__all__ = [
1313
"Backend",

src/guidellm/backend/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ResponseSummary,
1717
StreamingTextResponse,
1818
)
19-
from guidellm.config import settings
19+
from guidellm.settings import settings
2020

2121
__all__ = [
2222
"CHAT_COMPLETIONS",

src/guidellm/backend/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from pydantic import computed_field
44

5-
from guidellm.config import settings
65
from guidellm.objects.pydantic import StandardBaseModel
6+
from guidellm.settings import settings
77

88
__all__ = [
99
"RequestArgs",

src/guidellm/benchmark/aggregator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
GenerativeTextErrorStats,
2222
GenerativeTextResponseStats,
2323
)
24-
from guidellm.config import settings
2524
from guidellm.objects import (
2625
RunningStats,
2726
StandardBaseModel,
@@ -40,6 +39,7 @@
4039
SchedulerRequestResult,
4140
WorkerDescription,
4241
)
42+
from guidellm.settings import settings
4343
from guidellm.utils import check_load_processor
4444

4545
__all__ = [

src/guidellm/benchmark/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
SweepProfile,
2121
ThroughputProfile,
2222
)
23-
from guidellm.config import settings
2423
from guidellm.objects import (
2524
DistributionSummary,
2625
StandardBaseModel,
@@ -29,6 +28,7 @@
2928
from guidellm.presentation import UIDataBuilder
3029
from guidellm.presentation.injector import create_report
3130
from guidellm.scheduler import strategy_display_str
31+
from guidellm.settings import settings
3232
from guidellm.utils import Colors, split_text_list_by_length
3333
from guidellm.utils.dict import recursive_key_update
3434
from guidellm.utils.text import camelize_str

src/guidellm/benchmark/profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import numpy as np
55
from pydantic import Field, computed_field
66

7-
from guidellm.config import settings
87
from guidellm.objects import StandardBaseModel
98
from guidellm.scheduler import (
109
AsyncConstantStrategy,
@@ -15,6 +14,7 @@
1514
SynchronousStrategy,
1615
ThroughputStrategy,
1716
)
17+
from guidellm.settings import settings
1818

1919
__all__ = [
2020
"AsyncProfile",

src/guidellm/logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
from loguru import logger
4343

44-
from guidellm.config import LoggingSettings, settings
44+
from guidellm.settings import LoggingSettings, settings
4545

4646
__all__ = ["configure_logger", "logger"]
4747

@@ -72,7 +72,7 @@ def configure_logger(config: LoggingSettings = settings.logging):
7272
sys.stdout,
7373
level=config.console_log_level.upper(),
7474
format="<green>{time:YY-MM-DD HH:mm:ss}</green>|<level>{level: <8}</level> \
75-
|<cyan>{name}:{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"
75+
|<cyan>{name}:{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>",
7676
)
7777

7878
if config.log_file or config.log_file_level:

0 commit comments

Comments
 (0)