speedy-utils 1.1.18__tar.gz → 1.1.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- speedy_utils-1.1.20/.github/copilot-instructions.md +39 -0
- speedy_utils-1.1.20/.github/workflows/publish.yml +32 -0
- speedy_utils-1.1.20/.gitignore +124 -0
- speedy_utils-1.1.20/.pre-commit-config.yaml +13 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/PKG-INFO +34 -13
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/README.md +16 -3
- speedy_utils-1.1.20/bumpversion.sh +24 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/pyproject.toml +62 -42
- speedy_utils-1.1.20/ruff.toml +4 -0
- speedy_utils-1.1.20/scripts/deploy.sh +155 -0
- speedy_utils-1.1.20/setup.cfg +26 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/__init__.py +3 -2
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/async_lm/async_llm_task.py +1 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/llm_task.py +303 -10
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/openai_memoize.py +10 -2
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/vector_cache/core.py +250 -234
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/__init__.py +2 -1
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/utils_cache.py +38 -19
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/utils_io.py +9 -5
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/multi_worker/process.py +91 -10
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/multi_worker/thread.py +94 -2
- speedy_utils-1.1.20/tests/sample_objects.py +53 -0
- speedy_utils-1.1.20/tests/test.py +56 -0
- speedy_utils-1.1.20/tests/test_logger.py +279 -0
- speedy_utils-1.1.20/tests/test_logger_format.py +97 -0
- speedy_utils-1.1.20/tests/test_memoize_typing.py +76 -0
- speedy_utils-1.1.20/tests/test_mpython.py +0 -0
- speedy_utils-1.1.20/tests/test_process.py +158 -0
- speedy_utils-1.1.20/tests/test_process_update.py +76 -0
- speedy_utils-1.1.20/tests/test_thread.py +234 -0
- speedy_utils-1.1.20/uv.lock +7153 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/chat_format/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/chat_format/display.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/chat_format/transform.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/chat_format/utils.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/group_messages.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/async_lm/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/async_lm/_utils.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/async_lm/async_lm.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/async_lm/async_lm_base.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/async_lm/lm_specific.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/base_prompt_builder.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/lm.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/lm_base.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/lm/utils.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/scripts/README.md +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/scripts/vllm_load_balancer.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/scripts/vllm_serve.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/vector_cache/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/vector_cache/cli.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/vector_cache/types.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/llm_utils/vector_cache/utils.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/all.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/clock.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/function_decorator.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/logger.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/notebook_utils.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/patcher.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/report_manager.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/utils_misc.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/common/utils_print.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/multi_worker/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/scripts/__init__.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/scripts/mpython.py +0 -0
- {speedy_utils-1.1.18 → speedy_utils-1.1.20}/src/speedy_utils/scripts/openapi_client_codegen.py +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
## Coding Standards
|
|
2
|
+
- **Naming**
|
|
3
|
+
- snake_case for functions & variables
|
|
4
|
+
- PascalCase for classes
|
|
5
|
+
- **Formatting**
|
|
6
|
+
- 4-space indentation
|
|
7
|
+
- Single quotes for strings
|
|
8
|
+
- f-strings for interpolation
|
|
9
|
+
- **Typing & Docs**
|
|
10
|
+
- Add type hints to all public functions & methods
|
|
11
|
+
- Keep docstrings minimal; comment only non-obvious logic
|
|
12
|
+
- **Comparisons**
|
|
13
|
+
- Use `is` / `is not` when comparing with `None`
|
|
14
|
+
|
|
15
|
+
## Tooling Assumptions
|
|
16
|
+
- Editor: **VS Code**
|
|
17
|
+
- Pylance setting: `"python.analysis.typeCheckingMode": "basic"`
|
|
18
|
+
- Code must satisfy **basic** type checking (no strict-mode warnings).
|
|
19
|
+
- Prefer clear, straightforward typing over complex generics.
|
|
20
|
+
|
|
21
|
+
## Preferred Libraries
|
|
22
|
+
- Logging: `loguru`
|
|
23
|
+
- Database: `Peewee` + **PostgreSQL** (or **SQLite** locally)
|
|
24
|
+
- Web API: `FastAPI`
|
|
25
|
+
- Pydantic: `FastAPI`
|
|
26
|
+
- Testing: `pytest`
|
|
27
|
+
- Async: `asyncio` + `aiohttp`
|
|
28
|
+
- PydanticV2: `pydantic` (v2.x)
|
|
29
|
+
## When user provide a list of problems:
|
|
30
|
+
Directly go over the list and edit the code to fix the problems.
|
|
31
|
+
|
|
32
|
+
## Common problems when generated code to avoid:
|
|
33
|
+
*Stick to these choices unless explicitly instructed otherwise.*
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Rules for Code Generation
|
|
38
|
+
|
|
39
|
+
- Each line should less than 88 characters.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Publish to PyPI on bumpversion
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
if: |
|
|
12
|
+
contains(github.event.head_commit.message, 'bumpversion')
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.12'
|
|
21
|
+
|
|
22
|
+
- name: Install Poetry
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install poetry
|
|
26
|
+
|
|
27
|
+
- name: Configure Poetry for PyPI
|
|
28
|
+
run: |
|
|
29
|
+
poetry config pypi-token.pypi "${{ secrets.PYPI_API_TOKEN }}"
|
|
30
|
+
|
|
31
|
+
- name: Publish package
|
|
32
|
+
run: poetry publish --build
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
*.egg-info/
|
|
2
|
+
.cache
|
|
3
|
+
build/
|
|
4
|
+
.hypothesis/
|
|
5
|
+
**/__pycache__/**
|
|
6
|
+
dist/
|
|
7
|
+
.ipynb_checkpoints
|
|
8
|
+
.vscode
|
|
9
|
+
|
|
10
|
+
# Byte-compiled / optimized / DLL files
|
|
11
|
+
__pycache__/
|
|
12
|
+
*.py[cod]
|
|
13
|
+
*$py.class
|
|
14
|
+
|
|
15
|
+
# C extensions
|
|
16
|
+
*.so
|
|
17
|
+
|
|
18
|
+
# Distribution / packaging
|
|
19
|
+
.Python
|
|
20
|
+
env/
|
|
21
|
+
venv/
|
|
22
|
+
ENV/
|
|
23
|
+
env.bak/
|
|
24
|
+
venv.bak/
|
|
25
|
+
|
|
26
|
+
# PyInstaller
|
|
27
|
+
# Usually these files are written by a python script from a template
|
|
28
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
29
|
+
*.manifest
|
|
30
|
+
*.spec
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
|
|
36
|
+
# Unit test / coverage reports
|
|
37
|
+
htmlcov/
|
|
38
|
+
.tox/
|
|
39
|
+
.nox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*.cover
|
|
46
|
+
*.py,cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
|
|
50
|
+
# Translations
|
|
51
|
+
*.mo
|
|
52
|
+
*.pot
|
|
53
|
+
|
|
54
|
+
# Django stuff:
|
|
55
|
+
*.log
|
|
56
|
+
local_settings.py
|
|
57
|
+
db.sqlite3
|
|
58
|
+
db.sqlite3-journal
|
|
59
|
+
|
|
60
|
+
# Flask stuff:
|
|
61
|
+
instance/
|
|
62
|
+
.webassets-cache
|
|
63
|
+
|
|
64
|
+
# Scrapy stuff:
|
|
65
|
+
.scrapy
|
|
66
|
+
|
|
67
|
+
# Sphinx documentation
|
|
68
|
+
docs/_build/
|
|
69
|
+
|
|
70
|
+
# PyBuilder
|
|
71
|
+
target/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# IPython
|
|
77
|
+
profile_default/
|
|
78
|
+
ipython_config.py
|
|
79
|
+
|
|
80
|
+
# pyenv
|
|
81
|
+
.python-version
|
|
82
|
+
|
|
83
|
+
# celery beat schedule file
|
|
84
|
+
celerybeat-schedule
|
|
85
|
+
|
|
86
|
+
# SageMath parsed files
|
|
87
|
+
*.sage.py
|
|
88
|
+
|
|
89
|
+
# Environments
|
|
90
|
+
.env
|
|
91
|
+
.env.*
|
|
92
|
+
.venv
|
|
93
|
+
.venv.*
|
|
94
|
+
env/
|
|
95
|
+
venv/
|
|
96
|
+
ENV/
|
|
97
|
+
env.bak/
|
|
98
|
+
venv.bak/
|
|
99
|
+
|
|
100
|
+
# Spyder project settings
|
|
101
|
+
.spyderproject
|
|
102
|
+
.spyproject
|
|
103
|
+
|
|
104
|
+
# Rope project settings
|
|
105
|
+
.ropeproject
|
|
106
|
+
|
|
107
|
+
# mkdocs documentation
|
|
108
|
+
/site
|
|
109
|
+
|
|
110
|
+
# mypy
|
|
111
|
+
.mypy_cache/
|
|
112
|
+
.dmypy.json
|
|
113
|
+
dmypy.json
|
|
114
|
+
|
|
115
|
+
# Pyre type checker
|
|
116
|
+
.pyre/
|
|
117
|
+
|
|
118
|
+
# pytype static type analyzer
|
|
119
|
+
.pytype/
|
|
120
|
+
./cachedir
|
|
121
|
+
3.9,
|
|
122
|
+
.copilot
|
|
123
|
+
.vscode/settings.json
|
|
124
|
+
.codegen
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.5.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/psf/black
|
|
10
|
+
rev: 24.3.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: black
|
|
13
|
+
args: [--line-length=88]
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: speedy-utils
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.20
|
|
4
4
|
Summary: Fast and easy-to-use package for data science
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/anhvth/speedy
|
|
6
|
+
Project-URL: Repository, https://github.com/anhvth/speedy
|
|
7
|
+
Author-email: AnhVTH <anhvth.226@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
12
|
Classifier: Programming Language :: Python :: 3
|
|
9
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
10
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -13,29 +17,34 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Requires-Dist: aiohttp
|
|
16
22
|
Requires-Dist: bump2version
|
|
17
23
|
Requires-Dist: cachetools
|
|
18
24
|
Requires-Dist: debugpy
|
|
19
25
|
Requires-Dist: fastcore
|
|
20
26
|
Requires-Dist: fastprogress
|
|
21
|
-
Requires-Dist: freezegun
|
|
27
|
+
Requires-Dist: freezegun
|
|
22
28
|
Requires-Dist: ipdb
|
|
23
29
|
Requires-Dist: ipywidgets
|
|
24
|
-
Requires-Dist: json-repair
|
|
30
|
+
Requires-Dist: json-repair
|
|
25
31
|
Requires-Dist: jupyterlab
|
|
26
32
|
Requires-Dist: loguru
|
|
27
33
|
Requires-Dist: matplotlib
|
|
28
34
|
Requires-Dist: numpy
|
|
29
|
-
Requires-Dist: openai
|
|
30
|
-
Requires-Dist: packaging
|
|
35
|
+
Requires-Dist: openai
|
|
36
|
+
Requires-Dist: packaging
|
|
31
37
|
Requires-Dist: pandas
|
|
32
38
|
Requires-Dist: pydantic
|
|
39
|
+
Requires-Dist: pytest
|
|
40
|
+
Requires-Dist: ray
|
|
33
41
|
Requires-Dist: requests
|
|
34
42
|
Requires-Dist: scikit-learn
|
|
35
43
|
Requires-Dist: tabulate
|
|
36
44
|
Requires-Dist: tqdm
|
|
37
45
|
Requires-Dist: xxhash
|
|
38
|
-
|
|
46
|
+
Provides-Extra: ray
|
|
47
|
+
Requires-Dist: ray>=2.49.1; (python_version >= '3.9') and extra == 'ray'
|
|
39
48
|
Description-Content-Type: text/markdown
|
|
40
49
|
|
|
41
50
|
# Speedy Utils
|
|
@@ -84,6 +93,19 @@ cd speedy-utils
|
|
|
84
93
|
pip install .
|
|
85
94
|
```
|
|
86
95
|
|
|
96
|
+
### Extras
|
|
97
|
+
|
|
98
|
+
Optional dependencies can be installed via extras. For the `ray` backend
|
|
99
|
+
support (requires Python >= 3.9):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# pip
|
|
103
|
+
pip install 'speedy-utils[ray]'
|
|
104
|
+
|
|
105
|
+
# Poetry (for developing this repo)
|
|
106
|
+
poetry install -E ray
|
|
107
|
+
```
|
|
108
|
+
|
|
87
109
|
## Updating from previous versions
|
|
88
110
|
|
|
89
111
|
To update from previous versions or switch to v1.x, first uninstall any old
|
|
@@ -282,9 +304,8 @@ python speedy_utils/common/dataclass_parser.py
|
|
|
282
304
|
|
|
283
305
|
Example output:
|
|
284
306
|
|
|
285
|
-
| Field
|
|
286
|
-
|
|
287
|
-
| from_peft
|
|
307
|
+
| Field | Value |
|
|
308
|
+
| --------- | ------------------------------------- |
|
|
309
|
+
| from_peft | ./outputs/llm_hn_qw32b/hn_results_r3/ |
|
|
288
310
|
|
|
289
311
|
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
|
|
290
|
-
|
|
@@ -44,6 +44,19 @@ cd speedy-utils
|
|
|
44
44
|
pip install .
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
### Extras
|
|
48
|
+
|
|
49
|
+
Optional dependencies can be installed via extras. For the `ray` backend
|
|
50
|
+
support (requires Python >= 3.9):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# pip
|
|
54
|
+
pip install 'speedy-utils[ray]'
|
|
55
|
+
|
|
56
|
+
# Poetry (for developing this repo)
|
|
57
|
+
poetry install -E ray
|
|
58
|
+
```
|
|
59
|
+
|
|
47
60
|
## Updating from previous versions
|
|
48
61
|
|
|
49
62
|
To update from previous versions or switch to v1.x, first uninstall any old
|
|
@@ -242,8 +255,8 @@ python speedy_utils/common/dataclass_parser.py
|
|
|
242
255
|
|
|
243
256
|
Example output:
|
|
244
257
|
|
|
245
|
-
| Field
|
|
246
|
-
|
|
247
|
-
| from_peft
|
|
258
|
+
| Field | Value |
|
|
259
|
+
| --------- | ------------------------------------- |
|
|
260
|
+
| from_peft | ./outputs/llm_hn_qw32b/hn_results_r3/ |
|
|
248
261
|
|
|
249
262
|
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/zsh
|
|
2
|
+
# Bump patch version using poetry, commit, and push
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
echo 'Current version:'
|
|
6
|
+
poetry version
|
|
7
|
+
|
|
8
|
+
# Determine bump type (patch, minor, major)
|
|
9
|
+
BUMP_TYPE=${1:-patch}
|
|
10
|
+
if [[ "$BUMP_TYPE" != "patch" && "$BUMP_TYPE" != "minor" && "$BUMP_TYPE" != "major" ]]; then
|
|
11
|
+
echo "Usage: $0 [patch|minor|major]"
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
echo "Bumping $BUMP_TYPE version..."
|
|
16
|
+
poetry version $BUMP_TYPE
|
|
17
|
+
|
|
18
|
+
NEW_VERSION=$(poetry version -s)
|
|
19
|
+
echo "New version: $NEW_VERSION"
|
|
20
|
+
|
|
21
|
+
git add pyproject.toml
|
|
22
|
+
git commit -m "bumpversion"
|
|
23
|
+
git push
|
|
24
|
+
echo 'Version bumped, committed, and pushed.'
|
|
@@ -1,18 +1,71 @@
|
|
|
1
|
-
[
|
|
1
|
+
[project]
|
|
2
2
|
name = "speedy-utils"
|
|
3
|
-
version = "1.1.
|
|
3
|
+
version = "1.1.20"
|
|
4
4
|
description = "Fast and easy-to-use package for data science"
|
|
5
|
-
authors = ["AnhVTH
|
|
5
|
+
authors = [{ name = "AnhVTH", email = "anhvth.226@gmail.com" }]
|
|
6
6
|
readme = "README.md"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
requires-python = ">=3.8"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"numpy",
|
|
11
|
+
"requests",
|
|
12
|
+
"xxhash",
|
|
13
|
+
"loguru",
|
|
14
|
+
"fastcore",
|
|
15
|
+
"debugpy",
|
|
16
|
+
"ipywidgets",
|
|
17
|
+
"jupyterlab",
|
|
18
|
+
"ipdb",
|
|
19
|
+
"scikit-learn",
|
|
20
|
+
"matplotlib",
|
|
21
|
+
"pandas",
|
|
22
|
+
"tabulate",
|
|
23
|
+
"pydantic",
|
|
24
|
+
"tqdm",
|
|
25
|
+
"cachetools",
|
|
26
|
+
"bump2version",
|
|
27
|
+
"json-repair",
|
|
28
|
+
"fastprogress",
|
|
29
|
+
"freezegun",
|
|
30
|
+
"packaging",
|
|
31
|
+
"openai",
|
|
32
|
+
"ray",
|
|
33
|
+
"aiohttp",
|
|
34
|
+
"pytest",
|
|
11
35
|
]
|
|
36
|
+
classifiers = [
|
|
37
|
+
"Development Status :: 4 - Beta",
|
|
38
|
+
"Intended Audience :: Developers",
|
|
39
|
+
"License :: OSI Approved :: MIT License",
|
|
40
|
+
"Programming Language :: Python :: 3",
|
|
41
|
+
"Programming Language :: Python :: 3.8",
|
|
42
|
+
"Programming Language :: Python :: 3.9",
|
|
43
|
+
"Programming Language :: Python :: 3.10",
|
|
44
|
+
"Programming Language :: Python :: 3.11",
|
|
45
|
+
"Programming Language :: Python :: 3.12",
|
|
46
|
+
"Programming Language :: Python :: 3.13",
|
|
47
|
+
"Programming Language :: Python :: 3.14",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Homepage = "https://github.com/anhvth/speedy"
|
|
52
|
+
Repository = "https://github.com/anhvth/speedy"
|
|
53
|
+
|
|
54
|
+
[project.optional-dependencies]
|
|
55
|
+
ray = ["ray>=2.49.1; python_version >= '3.9'"]
|
|
56
|
+
|
|
57
|
+
[project.scripts]
|
|
58
|
+
mpython = "speedy_utils.scripts.mpython:main"
|
|
59
|
+
svllm = "llm_utils.scripts.vllm_serve:main"
|
|
60
|
+
svllm-lb = "llm_utils.scripts.vllm_load_balancer:run_load_balancer"
|
|
61
|
+
openapi_client_codegen = "speedy_utils.scripts.openapi_client_codegen:main"
|
|
12
62
|
|
|
13
63
|
[build-system]
|
|
14
|
-
requires = ["
|
|
15
|
-
build-backend = "
|
|
64
|
+
requires = ["hatchling"]
|
|
65
|
+
build-backend = "hatchling.build"
|
|
66
|
+
|
|
67
|
+
[tool.hatch.build.targets.wheel]
|
|
68
|
+
packages = ["src/speedy_utils", "src/llm_utils"]
|
|
16
69
|
|
|
17
70
|
[tool.black]
|
|
18
71
|
line-length = 88
|
|
@@ -35,38 +88,6 @@ disallow_untyped_decorators = true
|
|
|
35
88
|
no_implicit_optional = true
|
|
36
89
|
strict_optional = true
|
|
37
90
|
|
|
38
|
-
[tool.poetry.dependencies]
|
|
39
|
-
python = ">=3.8"
|
|
40
|
-
numpy = "*"
|
|
41
|
-
requests = "*"
|
|
42
|
-
xxhash = "*"
|
|
43
|
-
loguru = "*"
|
|
44
|
-
fastcore = "*"
|
|
45
|
-
debugpy = "*"
|
|
46
|
-
ipywidgets = "*"
|
|
47
|
-
jupyterlab = "*"
|
|
48
|
-
ipdb = "*"
|
|
49
|
-
scikit-learn = "*"
|
|
50
|
-
matplotlib = "*"
|
|
51
|
-
pandas = "*"
|
|
52
|
-
tabulate = "*"
|
|
53
|
-
pydantic = "*"
|
|
54
|
-
tqdm = "*"
|
|
55
|
-
cachetools = "*"
|
|
56
|
-
bump2version = "*"
|
|
57
|
-
json-repair = ">=0.25.0,<0.31.0"
|
|
58
|
-
fastprogress = "*"
|
|
59
|
-
freezegun = "^1.5.1"
|
|
60
|
-
packaging = ">=23.2,<25"
|
|
61
|
-
openai = "^1.106.0"
|
|
62
|
-
|
|
63
|
-
[tool.poetry.scripts]
|
|
64
|
-
mpython = "speedy_utils.scripts.mpython:main"
|
|
65
|
-
svllm = "llm_utils.scripts.vllm_serve:main"
|
|
66
|
-
svllm-lb = "llm_utils.scripts.vllm_load_balancer:run_load_balancer"
|
|
67
|
-
openapi_client_codegen = "speedy_utils.scripts.openapi_client_codegen:main"
|
|
68
|
-
|
|
69
|
-
|
|
70
91
|
[tool.ruff]
|
|
71
92
|
exclude = [
|
|
72
93
|
"**/*.ipynb",
|
|
@@ -81,7 +102,6 @@ exclude = [
|
|
|
81
102
|
"**/.vscode",
|
|
82
103
|
"**/*.egg-info",
|
|
83
104
|
"**/*.lock",
|
|
84
|
-
"poetry.lock",
|
|
85
105
|
"Pipfile.lock",
|
|
86
106
|
"package-lock.json",
|
|
87
107
|
"yarn.lock",
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Deploy script for publishing to PyPI
|
|
4
|
+
# Based on the GitHub Actions workflow
|
|
5
|
+
|
|
6
|
+
set -e # Exit on any error
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Colors for output
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
GREEN='\033[0;32m'
|
|
16
|
+
YELLOW='\033[1;33m'
|
|
17
|
+
NC='\033[0m' # No Color
|
|
18
|
+
|
|
19
|
+
echo_info() {
|
|
20
|
+
echo -e "${GREEN}[INFO]${NC} $1"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
echo_warn() {
|
|
24
|
+
echo -e "${YELLOW}[WARN]${NC} $1"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
echo_error() {
|
|
28
|
+
echo -e "${RED}[ERROR]${NC} $1"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Function to check if command exists
|
|
32
|
+
command_exists() {
|
|
33
|
+
command -v "$1" >/dev/null 2>&1
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Check required tools
|
|
37
|
+
echo_info "Checking required tools..."
|
|
38
|
+
|
|
39
|
+
if ! command_exists python3; then
|
|
40
|
+
echo_error "Python 3 is required but not installed"
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
if ! command_exists git; then
|
|
45
|
+
echo_error "Git is required but not installed"
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Install/upgrade required packages
|
|
50
|
+
echo_info "Installing/upgrading required packages..."
|
|
51
|
+
python3 -m pip install --upgrade pip
|
|
52
|
+
pip install poetry twine
|
|
53
|
+
|
|
54
|
+
# Check if we're in a git repository
|
|
55
|
+
if [ ! -d ".git" ]; then
|
|
56
|
+
echo_error "Not in a git repository"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Check if we're on master branch
|
|
61
|
+
current_branch=$(git branch --show-current)
|
|
62
|
+
if [ "$current_branch" != "master" ]; then
|
|
63
|
+
echo_warn "Current branch is '$current_branch', not 'master'"
|
|
64
|
+
read -p "Continue anyway? (y/N): " -n 1 -r
|
|
65
|
+
echo
|
|
66
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
67
|
+
echo_info "Deployment cancelled"
|
|
68
|
+
exit 0
|
|
69
|
+
fi
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Check for uncommitted changes
|
|
73
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
74
|
+
echo_error "There are uncommitted changes. Please commit or stash them first"
|
|
75
|
+
git status --short
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Check if PYPI_API_TOKEN is set
|
|
80
|
+
if [ -z "$PYPI_API_TOKEN" ]; then
|
|
81
|
+
echo_error "PYPI_API_TOKEN environment variable is not set"
|
|
82
|
+
echo_info "Please set it with: export PYPI_API_TOKEN=your_token_here"
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# Get current version from pyproject.toml
|
|
87
|
+
current_version=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
|
88
|
+
echo_info "Current version: $current_version"
|
|
89
|
+
|
|
90
|
+
# Ask for new version
|
|
91
|
+
echo_info "Enter new version (or press Enter to skip version bump):"
|
|
92
|
+
read -r new_version
|
|
93
|
+
|
|
94
|
+
if [ -n "$new_version" ]; then
|
|
95
|
+
echo_info "Bumping version to $new_version..."
|
|
96
|
+
|
|
97
|
+
# Update version in pyproject.toml
|
|
98
|
+
sed -i "s/^version = \".*\"/version = \"$new_version\"/" pyproject.toml
|
|
99
|
+
|
|
100
|
+
# Commit version bump
|
|
101
|
+
git add pyproject.toml
|
|
102
|
+
git commit -m "Bump version to $new_version"
|
|
103
|
+
|
|
104
|
+
echo_info "Version bumped and committed"
|
|
105
|
+
else
|
|
106
|
+
echo_info "Skipping version bump"
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Check if last commit message starts with "Bump version"
|
|
110
|
+
last_commit_msg=$(git log -1 --pretty=%B)
|
|
111
|
+
if [[ ! $last_commit_msg =~ ^"Bump version" ]]; then
|
|
112
|
+
echo_warn "Last commit message doesn't start with 'Bump version'"
|
|
113
|
+
echo_warn "Last commit: $last_commit_msg"
|
|
114
|
+
read -p "Continue deployment anyway? (y/N): " -n 1 -r
|
|
115
|
+
echo
|
|
116
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
117
|
+
echo_info "Deployment cancelled"
|
|
118
|
+
exit 0
|
|
119
|
+
fi
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Clean previous builds
|
|
123
|
+
echo_info "Cleaning previous builds..."
|
|
124
|
+
rm -rf dist/ build/ *.egg-info
|
|
125
|
+
|
|
126
|
+
# Build package
|
|
127
|
+
echo_info "Building package with Poetry..."
|
|
128
|
+
poetry build
|
|
129
|
+
|
|
130
|
+
# Check if dist directory was created and contains files
|
|
131
|
+
if [ ! -d "dist" ] || [ -z "$(ls -A dist)" ]; then
|
|
132
|
+
echo_error "Build failed - no files in dist directory"
|
|
133
|
+
exit 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
echo_info "Build completed. Files in dist/:"
|
|
137
|
+
ls -la dist/
|
|
138
|
+
|
|
139
|
+
# Upload to PyPI
|
|
140
|
+
echo_info "Publishing to PyPI..."
|
|
141
|
+
twine upload dist/* \
|
|
142
|
+
--username "__token__" \
|
|
143
|
+
--password "$PYPI_API_TOKEN" \
|
|
144
|
+
--non-interactive
|
|
145
|
+
|
|
146
|
+
echo_info "🎉 Package published successfully to PyPI!"
|
|
147
|
+
|
|
148
|
+
# Push to remote if version was bumped
|
|
149
|
+
if [ -n "$new_version" ]; then
|
|
150
|
+
echo_info "Pushing version bump to remote..."
|
|
151
|
+
git push origin "$current_branch"
|
|
152
|
+
echo_info "Version bump pushed to remote"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
echo_info "Deployment completed successfully!"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
max-line-length = 88
|
|
3
|
+
extend-ignore = E203, W503
|
|
4
|
+
exclude = .git,__pycache__,build,dist
|
|
5
|
+
|
|
6
|
+
[mypy]
|
|
7
|
+
python_version = 3.10
|
|
8
|
+
warn_return_any = True
|
|
9
|
+
warn_unused_configs = True
|
|
10
|
+
disallow_untyped_defs = True
|
|
11
|
+
disallow_incomplete_defs = True
|
|
12
|
+
check_untyped_defs = True
|
|
13
|
+
disallow_untyped_decorators = True
|
|
14
|
+
no_implicit_optional = True
|
|
15
|
+
strict_optional = True
|
|
16
|
+
warn_redundant_casts = True
|
|
17
|
+
warn_unused_ignores = True
|
|
18
|
+
warn_no_return = True
|
|
19
|
+
warn_unreachable = True
|
|
20
|
+
implicit_reexport = False
|
|
21
|
+
|
|
22
|
+
[mypy.plugins.numpy.*]
|
|
23
|
+
follow_imports = skip
|
|
24
|
+
|
|
25
|
+
[mypy.plugins.pandas.*]
|
|
26
|
+
follow_imports = skip
|
|
@@ -4,7 +4,7 @@ from llm_utils.vector_cache import VectorCache
|
|
|
4
4
|
from llm_utils.lm.lm_base import get_model_name
|
|
5
5
|
from llm_utils.lm.base_prompt_builder import BasePromptBuilder
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
LLM = LLMTask
|
|
8
8
|
|
|
9
9
|
from .chat_format import (
|
|
10
10
|
build_chatml_input,
|
|
@@ -34,5 +34,6 @@ __all__ = [
|
|
|
34
34
|
"MOpenAI",
|
|
35
35
|
"get_model_name",
|
|
36
36
|
"VectorCache",
|
|
37
|
-
"BasePromptBuilder"
|
|
37
|
+
"BasePromptBuilder",
|
|
38
|
+
"LLM"
|
|
38
39
|
]
|