Skip to content

Commit d8fb4ae

Browse files
committed
chore: cleanup code and env requirements
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
1 parent 578308b commit d8fb4ae

19 files changed

+1745
-1443
lines changed

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- name: Dependabot metadata
1414
id: metadata
15-
uses: dependabot/fetch-metadata@v2.3.0
15+
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 # ratchet:dependabot/fetch-metadata@v2.3.0
1616
with:
1717
github-token: "${{ secrets.GITHUB_TOKEN }}"
1818
- name: Enable auto-merge for Dependabot PRs

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # ratchet:actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install uv
25+
run: |
26+
pip install uv
27+
28+
- name: Install dependencies with uv
29+
run: |
30+
uv pip install -e .
31+
uv pip install pytest pexpect
32+
33+
- name: Run tests
34+
run: |
35+
pytest tests -v

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ cython_debug/
163163
venv/
164164
.envrc
165165
_version.py
166+
.cursor

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default_language_version:
77
python: python3.11 # NOTE: sync with .python-version-default
88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: "v0.11.2"
10+
rev: "v0.11.4"
1111
hooks:
1212
- id: ruff
1313
alias: r

.ruff.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extend-include = ["*.ipynb"]
22
preview = true
3-
line-length = 119
4-
indent-width = 4
3+
line-length = 100
4+
indent-width = 2
55

66
[format]
77
preview = true
@@ -18,21 +18,16 @@ ignore = [
1818
]
1919
select = [
2020
"F",
21-
"G", # flake8-logging-format
22-
"PERF", # perflint
23-
"RUF", # Ruff-specific rules
21+
"G", # flake8-logging-format
22+
"PERF", # perflint
23+
"RUF", # Ruff-specific rules
2424
"W6",
2525
"E71",
2626
"E72",
2727
"E112",
2828
"E113",
29-
# "E124",
3029
"E203",
3130
"E272",
32-
# "E303",
33-
# "E304",
34-
# "E501",
35-
# "E502",
3631
"E702",
3732
"E703",
3833
"E731",

gen_readme.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@
99
import subprocess, sys, pathlib, json, jinja2
1010

1111
if __name__ == '__main__':
12-
with (pathlib.Path('.').parent / 'README.md').open('w') as f:
13-
f.write(
14-
jinja2.Environment(loader=jinja2.FileSystemLoader('.'))
15-
.get_template('README.md.tpl')
16-
.render(
17-
model_dict=json.loads(
18-
subprocess.run(
19-
[
20-
sys.executable,
21-
'-m',
22-
'uv',
23-
'run',
24-
'--with-editable',
25-
'.',
26-
'openllm',
27-
'model',
28-
'list',
29-
'--output',
30-
'readme',
31-
],
32-
text=True,
33-
check=True,
34-
capture_output=True,
35-
).stdout.strip()
36-
)
37-
)
12+
with (pathlib.Path('.').parent / 'README.md').open('w') as f:
13+
f.write(
14+
jinja2.Environment(loader=jinja2.FileSystemLoader('.'))
15+
.get_template('README.md.tpl')
16+
.render(
17+
model_dict=json.loads(
18+
subprocess.run(
19+
[
20+
sys.executable,
21+
'-m',
22+
'uv',
23+
'run',
24+
'--with-editable',
25+
'.',
26+
'openllm',
27+
'model',
28+
'list',
29+
'--output',
30+
'readme',
31+
],
32+
text=True,
33+
check=True,
34+
capture_output=True,
35+
).stdout.strip()
3836
)
37+
)
38+
)

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dependencies = [
4343
"uv",
4444
"openai==1.70.0",
4545
"huggingface-hub",
46+
"hf-xet",
4647
"typing-extensions>=4.12.2",
4748
]
4849
keywords = [
@@ -87,6 +88,12 @@ src-dir = "src/openllm"
8788
requires = ["hatchling==1.27.0", "hatch-vcs==0.4.0"]
8889
build-backend = 'hatchling.build'
8990

91+
[dependency-groups]
92+
tests = [
93+
"pexpect>=4.9.0",
94+
"pytest>=8.3.5",
95+
]
96+
9097
[tool.hatch.version]
9198
source = "vcs"
9299
fallback-version = "0.0.0"

0 commit comments

Comments
 (0)