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

ci: pre-commit autoupdate [pre-commit.ci] #1104

Merged
merged 2 commits into from
Nov 5, 2024
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default_language_version:
python: python3.11 # NOTE: sync with .python-version-default
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.0"
rev: "v0.7.2"
hooks:
- id: ruff
alias: r
Expand All @@ -20,7 +20,7 @@ repos:
verbose: true
types_or: [python, pyi, jupyter]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.12.1"
rev: "v1.13.0"
hooks:
- id: mypy
args: [--strict]
Expand Down
2 changes: 1 addition & 1 deletion src/openllm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def typer_callback(
VERBOSE_LEVEL.set(verbose)
if version:
output(
f"openllm, {importlib.metadata.version('openllm')}\nPython ({platform.python_implementation()}) {platform.python_version()}"
f'openllm, {importlib.metadata.version("openllm")}\nPython ({platform.python_implementation()}) {platform.python_version()}'
)
sys.exit(0)
if do_not_track:
Expand Down
8 changes: 4 additions & 4 deletions src/openllm/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def _get_deploy_cmd(bento: BentoInfo, target: typing.Optional[DeploymentTarget]
if INTERACTIVE.get():
import questionary

value = questionary.text(f"{env_info['name']}:", default=default).ask()
value = questionary.text(f'{env_info["name"]}:', default=default).ask()
else:
if default == '':
output(f"Environment variable {env_info['name']} is required but not provided", style='red')
output(f'Environment variable {env_info["name"]} is required but not provided', style='red')
raise typer.Exit(1)
else:
value = default

if value is None:
raise typer.Exit(1)
cmd += ['--env', f"{env_info['name']}={value}"]
cmd += ['--env', f'{env_info["name"]}={value}']

if target:
cmd += ['--instance-type', target.name]
Expand All @@ -75,7 +75,7 @@ def ensure_cloud_context():
try:
result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
context = json.loads(result)
output(f" bentoml already logged in: {context['endpoint']}", style='green', level=20)
output(f' bentoml already logged in: {context["endpoint"]}', style='green', level=20)
except subprocess.CalledProcessError:
output(' bentoml not logged in', style='red')
if not INTERACTIVE.get():
Expand Down
12 changes: 6 additions & 6 deletions src/openllm/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def pretty_gpu(self) -> str:
resources = self.bento_yaml['services'][0]['config']['resources']
if resources['gpu'] > 1:
acc = ACCELERATOR_SPECS[resources['gpu_type']]
return f"{acc.memory_size:.0f}Gx{resources['gpu']}"
return f'{acc.memory_size:.0f}Gx{resources["gpu"]}'
elif resources['gpu'] > 0:
acc = ACCELERATOR_SPECS[resources['gpu_type']]
return f'{acc.memory_size:.0f}G'
Expand Down Expand Up @@ -329,11 +329,11 @@ def run_command(cmd, cwd=None, env=None, copy_env=True, venv=None, silent=False)
for k, v in env.items():
output(f'$ export {k}={shlex.quote(v)}', style='orange')
if venv:
output(f"$ source {venv / 'bin' / 'activate'}", style='orange')
output(f"$ {' '.join(cmd)}", style='orange')
output(f'$ source {venv / "bin" / "activate"}', style='orange')
output(f'$ {" ".join(cmd)}', style='orange')

if venv:
py = venv / bin_dir / f"python{sysconfig.get_config_var('EXE')}"
py = venv / bin_dir / f'python{sysconfig.get_config_var("EXE")}'
else:
py = sys.executable

Expand Down Expand Up @@ -379,8 +379,8 @@ async def async_run_command(cmd, cwd=None, env=None, copy_env=True, venv=None, s
for k, v in env.items():
output(f'$ export {k}={shlex.quote(v)}', style='orange')
if venv:
output(f"$ source {venv / 'bin' / 'activate'}", style='orange')
output(f"$ {' '.join(cmd)}", style='orange')
output(f'$ source {venv / "bin" / "activate"}', style='orange')
output(f'$ {" ".join(cmd)}', style='orange')

if venv:
py = venv / 'bin' / 'python'
Expand Down
4 changes: 2 additions & 2 deletions src/openllm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def list_bento(
x
for x in model_list
if not (
f"{x.bento_yaml['name']}:{x.bento_yaml['version']}" in seen
or seen.add(f"{x.bento_yaml['name']}:{x.bento_yaml['version']}")
f'{x.bento_yaml["name"]}:{x.bento_yaml["version"]}' in seen
or seen.add(f'{x.bento_yaml["name"]}:{x.bento_yaml["version"]}')
)
]
return model_list
2 changes: 1 addition & 1 deletion src/openllm/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _resolve_bento_venv_spec(bento: BentoInfo, runtime_envs: Optional[EnvVars] =
envs = {k: runtime_envs.get(k, v) for k, v in bento_envs.items()} if runtime_envs else {}

return VenvSpec(
python_version=ver, requirements_txt=reqs, name_prefix=f"{bento.tag.replace(':', '_')}-1-", envs=EnvVars(envs)
python_version=ver, requirements_txt=reqs, name_prefix=f'{bento.tag.replace(":", "_")}-1-', envs=EnvVars(envs)
)


Expand Down