batchwizard 0.2.0__tar.gz → 0.4.0__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.
- batchwizard-0.4.0/.github/workflows/ci.yml +53 -0
- batchwizard-0.4.0/.github/workflows/publish.yml +33 -0
- batchwizard-0.4.0/.gitignore +162 -0
- batchwizard-0.2.0/README.md → batchwizard-0.4.0/PKG-INFO +76 -7
- batchwizard-0.2.0/PKG-INFO → batchwizard-0.4.0/README.md +46 -34
- batchwizard-0.4.0/pyproject.toml +78 -0
- batchwizard-0.4.0/src/batchwizard/__init__.py +16 -0
- batchwizard-0.4.0/src/batchwizard/cli.py +344 -0
- {batchwizard-0.2.0 → batchwizard-0.4.0}/src/batchwizard/config.py +12 -5
- batchwizard-0.4.0/src/batchwizard/models.py +61 -0
- batchwizard-0.4.0/src/batchwizard/processor.py +160 -0
- batchwizard-0.4.0/src/batchwizard/providers/__init__.py +19 -0
- batchwizard-0.4.0/src/batchwizard/providers/base.py +30 -0
- batchwizard-0.4.0/src/batchwizard/providers/openai.py +96 -0
- batchwizard-0.4.0/src/batchwizard/store.py +91 -0
- batchwizard-0.4.0/src/batchwizard/ui.py +143 -0
- {batchwizard-0.2.0 → batchwizard-0.4.0}/src/batchwizard/utils.py +16 -2
- batchwizard-0.4.0/tests/conftest.py +25 -0
- batchwizard-0.4.0/tests/test_openai_provider.py +141 -0
- batchwizard-0.4.0/tests/test_orchestrator.py +175 -0
- batchwizard-0.4.0/tests/test_store.py +69 -0
- batchwizard-0.4.0/uv.lock +627 -0
- batchwizard-0.2.0/pyproject.toml +0 -37
- batchwizard-0.2.0/src/batchwizard/__init__.py +0 -6
- batchwizard-0.2.0/src/batchwizard/cli.py +0 -192
- batchwizard-0.2.0/src/batchwizard/models.py +0 -18
- batchwizard-0.2.0/src/batchwizard/processor.py +0 -153
- batchwizard-0.2.0/src/batchwizard/ui.py +0 -258
- {batchwizard-0.2.0 → batchwizard-0.4.0}/LICENSE +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: astral-sh/setup-uv@v5
|
|
16
|
+
- run: uv sync --group dev
|
|
17
|
+
- run: uv run ruff check src/
|
|
18
|
+
- run: uv run ruff format --check src/
|
|
19
|
+
|
|
20
|
+
test:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
- uses: astral-sh/setup-uv@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
- run: uv sync --group dev
|
|
33
|
+
# No test suite exists yet; run pytest only if tests/ appears.
|
|
34
|
+
# Remove the guard once tests land (Phase 2).
|
|
35
|
+
- run: |
|
|
36
|
+
if [ -d tests ]; then
|
|
37
|
+
uv run pytest tests/
|
|
38
|
+
else
|
|
39
|
+
echo "No tests directory yet — skipping."
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
build:
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
with:
|
|
47
|
+
fetch-depth: 0
|
|
48
|
+
- uses: astral-sh/setup-uv@v5
|
|
49
|
+
- run: uv build
|
|
50
|
+
- uses: actions/upload-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: dist
|
|
53
|
+
path: dist/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
with:
|
|
13
|
+
fetch-depth: 0
|
|
14
|
+
- uses: astral-sh/setup-uv@v5
|
|
15
|
+
- run: uv build
|
|
16
|
+
- uses: actions/upload-artifact@v4
|
|
17
|
+
with:
|
|
18
|
+
name: dist
|
|
19
|
+
path: dist/
|
|
20
|
+
|
|
21
|
+
publish:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
environment: pypi
|
|
25
|
+
permissions:
|
|
26
|
+
# Required for PyPI Trusted Publishing (OIDC) — no API token needed
|
|
27
|
+
id-token: write
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/download-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
110
|
+
.pdm.toml
|
|
111
|
+
.pdm-python
|
|
112
|
+
.pdm-build/
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
#.idea/
|
|
@@ -1,7 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: batchwizard
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: BatchWizard: Manage OpenAI batch processing jobs with ease
|
|
5
|
+
Project-URL: Homepage, https://github.com/cmakafui/batchwizard
|
|
6
|
+
Project-URL: Repository, https://github.com/cmakafui/batchwizard
|
|
7
|
+
Project-URL: Issues, https://github.com/cmakafui/batchwizard/issues
|
|
8
|
+
Author: Carl Kugblenu
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: async,batch,cli,openai
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: aiofiles>=24.1
|
|
22
|
+
Requires-Dist: loguru>=0.7
|
|
23
|
+
Requires-Dist: openai>=1.37
|
|
24
|
+
Requires-Dist: pydantic-settings>=2.3
|
|
25
|
+
Requires-Dist: pydantic>=2.8
|
|
26
|
+
Requires-Dist: python-dotenv>=1.0
|
|
27
|
+
Requires-Dist: rich>=13.7
|
|
28
|
+
Requires-Dist: typer>=0.12
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
1
31
|
# BatchWizard
|
|
2
32
|
|
|
3
33
|
BatchWizard is a powerful CLI tool for managing OpenAI batch processing jobs with ease. It provides functionalities to upload files, create batch jobs, check their status, and download the results. The tool uses asynchronous processing to efficiently handle multiple jobs concurrently.
|
|
4
34
|
|
|
35
|
+

|
|
36
|
+
|
|
5
37
|
## Table of Contents
|
|
6
38
|
|
|
7
39
|
- [Installation](#installation)
|
|
@@ -75,12 +107,44 @@ You can also process multiple files or directories:
|
|
|
75
107
|
batchwizard process /path/to/file1.jsonl /path/to/directory_with_jsonl_files /path/to/file2.jsonl
|
|
76
108
|
```
|
|
77
109
|
|
|
110
|
+
### Submit Without Blocking (fire and forget)
|
|
111
|
+
|
|
112
|
+
`process` blocks until every batch completes — which can take up to 24 hours. To submit and get your terminal back:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
batchwizard submit /path/to/inputs/ # or: batchwizard process ... --submit-only
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Submitted jobs are recorded in a local manifest (SQLite, in the BatchWizard config directory). Later — even after a reboot — reattach with:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
batchwizard watch [--output-directory OUTPUT_DIR]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`watch` picks up every pending job from the manifest, polls until completion, and downloads the results.
|
|
125
|
+
|
|
126
|
+
### Check Tracked Jobs
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
batchwizard status [--all]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Shows pending jobs from the local manifest (`--all` includes finished ones), with any failure reasons.
|
|
133
|
+
|
|
134
|
+
### Failure Reasons and Error Files
|
|
135
|
+
|
|
136
|
+
When a batch fails, BatchWizard surfaces the provider's actual error (e.g. `insufficient_funds`, `invalid_request` with the offending line). When individual requests inside a batch fail, the per-request error file is downloaded alongside the results as `<batch_id>_errors.jsonl`.
|
|
137
|
+
|
|
138
|
+
### Batch Endpoints
|
|
139
|
+
|
|
140
|
+
By default requests go to `/v1/chat/completions`. Use `--endpoint` on `process`/`submit` for other batch-capable endpoints such as `/v1/responses` or `/v1/embeddings`.
|
|
141
|
+
|
|
78
142
|
### List Recent Jobs
|
|
79
143
|
|
|
80
|
-
To list recent batch jobs:
|
|
144
|
+
To list recent batch jobs from the provider:
|
|
81
145
|
|
|
82
146
|
```bash
|
|
83
|
-
batchwizard list-jobs [--limit NUM]
|
|
147
|
+
batchwizard list-jobs [--limit NUM]
|
|
84
148
|
```
|
|
85
149
|
|
|
86
150
|
### Cancel a Job
|
|
@@ -96,9 +160,11 @@ batchwizard cancel <job_id>
|
|
|
96
160
|
To download results for a completed batch job:
|
|
97
161
|
|
|
98
162
|
```bash
|
|
99
|
-
batchwizard download <job_id> [--output-
|
|
163
|
+
batchwizard download <job_id> [--output-directory OUTPUT_DIR]
|
|
100
164
|
```
|
|
101
165
|
|
|
166
|
+
This downloads the results file and, if any requests failed, the per-request error file.
|
|
167
|
+
|
|
102
168
|
## Configuration
|
|
103
169
|
|
|
104
170
|
### Setting up the OpenAI API Key
|
|
@@ -129,11 +195,14 @@ batchwizard configure --reset
|
|
|
129
195
|
|
|
130
196
|
BatchWizard supports the following commands:
|
|
131
197
|
|
|
132
|
-
- `process`:
|
|
198
|
+
- `process`: Submit batch jobs and wait for completion (add `--submit-only` to return immediately).
|
|
199
|
+
- `submit`: Submit batch jobs and exit; jobs are tracked in the local manifest.
|
|
200
|
+
- `watch`: Reattach to pending jobs, poll, and download results.
|
|
201
|
+
- `status`: Show jobs tracked in the local manifest.
|
|
133
202
|
- `configure`: Manage BatchWizard configuration.
|
|
134
|
-
- `list-jobs`: List recent batch jobs.
|
|
203
|
+
- `list-jobs`: List recent batch jobs from the provider.
|
|
135
204
|
- `cancel`: Cancel a specific batch job.
|
|
136
|
-
- `download`: Download results for a
|
|
205
|
+
- `download`: Download results (and error file) for a batch job.
|
|
137
206
|
|
|
138
207
|
For detailed information on each command, use the `--help` option:
|
|
139
208
|
|
|
@@ -165,7 +234,7 @@ We welcome contributions to BatchWizard! To contribute, follow these steps:
|
|
|
165
234
|
To run tests, use `pytest`:
|
|
166
235
|
|
|
167
236
|
```bash
|
|
168
|
-
pytest
|
|
237
|
+
uv run pytest tests/
|
|
169
238
|
```
|
|
170
239
|
|
|
171
240
|
Ensure your code passes all tests and meets the coding standards before opening a pull request.
|
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: batchwizard
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: BatchWizard: Manage OpenAI batch processing jobs with ease
|
|
5
|
-
Home-page: https://github.com/cmakafui/batchwizard
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: openai,batch,cli,async
|
|
8
|
-
Author: Carl Kugblenu
|
|
9
|
-
Requires-Python: >=3.9,<4.0
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Requires-Dist: aiofiles (>=24.1.0,<25.0.0)
|
|
17
|
-
Requires-Dist: loguru (>=0.7.2,<0.8.0)
|
|
18
|
-
Requires-Dist: openai (>=1.37.0,<2.0.0)
|
|
19
|
-
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
|
|
20
|
-
Requires-Dist: pydantic-settings (>=2.3.4,<3.0.0)
|
|
21
|
-
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
22
|
-
Requires-Dist: rich (>=13.7.1,<14.0.0)
|
|
23
|
-
Requires-Dist: typer (>=0.12.3,<0.13.0)
|
|
24
|
-
Project-URL: Repository, https://github.com/cmakafui/batchwizard
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
|
|
27
1
|
# BatchWizard
|
|
28
2
|
|
|
29
3
|
BatchWizard is a powerful CLI tool for managing OpenAI batch processing jobs with ease. It provides functionalities to upload files, create batch jobs, check their status, and download the results. The tool uses asynchronous processing to efficiently handle multiple jobs concurrently.
|
|
30
4
|
|
|
5
|
+

|
|
6
|
+
|
|
31
7
|
## Table of Contents
|
|
32
8
|
|
|
33
9
|
- [Installation](#installation)
|
|
@@ -101,12 +77,44 @@ You can also process multiple files or directories:
|
|
|
101
77
|
batchwizard process /path/to/file1.jsonl /path/to/directory_with_jsonl_files /path/to/file2.jsonl
|
|
102
78
|
```
|
|
103
79
|
|
|
80
|
+
### Submit Without Blocking (fire and forget)
|
|
81
|
+
|
|
82
|
+
`process` blocks until every batch completes — which can take up to 24 hours. To submit and get your terminal back:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
batchwizard submit /path/to/inputs/ # or: batchwizard process ... --submit-only
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Submitted jobs are recorded in a local manifest (SQLite, in the BatchWizard config directory). Later — even after a reboot — reattach with:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
batchwizard watch [--output-directory OUTPUT_DIR]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`watch` picks up every pending job from the manifest, polls until completion, and downloads the results.
|
|
95
|
+
|
|
96
|
+
### Check Tracked Jobs
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
batchwizard status [--all]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Shows pending jobs from the local manifest (`--all` includes finished ones), with any failure reasons.
|
|
103
|
+
|
|
104
|
+
### Failure Reasons and Error Files
|
|
105
|
+
|
|
106
|
+
When a batch fails, BatchWizard surfaces the provider's actual error (e.g. `insufficient_funds`, `invalid_request` with the offending line). When individual requests inside a batch fail, the per-request error file is downloaded alongside the results as `<batch_id>_errors.jsonl`.
|
|
107
|
+
|
|
108
|
+
### Batch Endpoints
|
|
109
|
+
|
|
110
|
+
By default requests go to `/v1/chat/completions`. Use `--endpoint` on `process`/`submit` for other batch-capable endpoints such as `/v1/responses` or `/v1/embeddings`.
|
|
111
|
+
|
|
104
112
|
### List Recent Jobs
|
|
105
113
|
|
|
106
|
-
To list recent batch jobs:
|
|
114
|
+
To list recent batch jobs from the provider:
|
|
107
115
|
|
|
108
116
|
```bash
|
|
109
|
-
batchwizard list-jobs [--limit NUM]
|
|
117
|
+
batchwizard list-jobs [--limit NUM]
|
|
110
118
|
```
|
|
111
119
|
|
|
112
120
|
### Cancel a Job
|
|
@@ -122,9 +130,11 @@ batchwizard cancel <job_id>
|
|
|
122
130
|
To download results for a completed batch job:
|
|
123
131
|
|
|
124
132
|
```bash
|
|
125
|
-
batchwizard download <job_id> [--output-
|
|
133
|
+
batchwizard download <job_id> [--output-directory OUTPUT_DIR]
|
|
126
134
|
```
|
|
127
135
|
|
|
136
|
+
This downloads the results file and, if any requests failed, the per-request error file.
|
|
137
|
+
|
|
128
138
|
## Configuration
|
|
129
139
|
|
|
130
140
|
### Setting up the OpenAI API Key
|
|
@@ -155,11 +165,14 @@ batchwizard configure --reset
|
|
|
155
165
|
|
|
156
166
|
BatchWizard supports the following commands:
|
|
157
167
|
|
|
158
|
-
- `process`:
|
|
168
|
+
- `process`: Submit batch jobs and wait for completion (add `--submit-only` to return immediately).
|
|
169
|
+
- `submit`: Submit batch jobs and exit; jobs are tracked in the local manifest.
|
|
170
|
+
- `watch`: Reattach to pending jobs, poll, and download results.
|
|
171
|
+
- `status`: Show jobs tracked in the local manifest.
|
|
159
172
|
- `configure`: Manage BatchWizard configuration.
|
|
160
|
-
- `list-jobs`: List recent batch jobs.
|
|
173
|
+
- `list-jobs`: List recent batch jobs from the provider.
|
|
161
174
|
- `cancel`: Cancel a specific batch job.
|
|
162
|
-
- `download`: Download results for a
|
|
175
|
+
- `download`: Download results (and error file) for a batch job.
|
|
163
176
|
|
|
164
177
|
For detailed information on each command, use the `--help` option:
|
|
165
178
|
|
|
@@ -191,7 +204,7 @@ We welcome contributions to BatchWizard! To contribute, follow these steps:
|
|
|
191
204
|
To run tests, use `pytest`:
|
|
192
205
|
|
|
193
206
|
```bash
|
|
194
|
-
pytest
|
|
207
|
+
uv run pytest tests/
|
|
195
208
|
```
|
|
196
209
|
|
|
197
210
|
Ensure your code passes all tests and meets the coding standards before opening a pull request.
|
|
@@ -203,4 +216,3 @@ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file
|
|
|
203
216
|
## Contact
|
|
204
217
|
|
|
205
218
|
For any questions or feedback, feel free to open an issue on the [GitHub repository](https://github.com/cmakafui/batchwizard).
|
|
206
|
-
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "batchwizard"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "BatchWizard: Manage OpenAI batch processing jobs with ease"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
authors = [{ name = "Carl Kugblenu" }]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
keywords = ["openai", "batch", "cli", "async"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"typer>=0.12",
|
|
22
|
+
"rich>=13.7",
|
|
23
|
+
"openai>=1.37",
|
|
24
|
+
"pydantic>=2.8",
|
|
25
|
+
"pydantic-settings>=2.3",
|
|
26
|
+
"aiofiles>=24.1",
|
|
27
|
+
"loguru>=0.7",
|
|
28
|
+
"python-dotenv>=1.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/cmakafui/batchwizard"
|
|
33
|
+
Repository = "https://github.com/cmakafui/batchwizard"
|
|
34
|
+
Issues = "https://github.com/cmakafui/batchwizard/issues"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
batchwizard = "batchwizard.cli:app"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=8.3",
|
|
42
|
+
"pytest-asyncio>=0.24",
|
|
43
|
+
"pytest-mock>=3.14",
|
|
44
|
+
"ruff>=0.5",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
49
|
+
build-backend = "hatchling.build"
|
|
50
|
+
|
|
51
|
+
[tool.hatch.version]
|
|
52
|
+
source = "vcs"
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
packages = ["src/batchwizard"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
line-length = 88
|
|
59
|
+
target-version = "py311"
|
|
60
|
+
|
|
61
|
+
[tool.ruff.lint]
|
|
62
|
+
select = [
|
|
63
|
+
"E", # pycodestyle errors
|
|
64
|
+
"W", # pycodestyle warnings
|
|
65
|
+
"F", # pyflakes
|
|
66
|
+
"I", # isort
|
|
67
|
+
"UP", # pyupgrade
|
|
68
|
+
"B", # flake8-bugbear
|
|
69
|
+
]
|
|
70
|
+
ignore = ["E501"]
|
|
71
|
+
|
|
72
|
+
[tool.ruff.lint.per-file-ignores]
|
|
73
|
+
# Typer declares CLI params via function-call defaults by design
|
|
74
|
+
"src/batchwizard/cli.py" = ["B008"]
|
|
75
|
+
|
|
76
|
+
[tool.pytest.ini_options]
|
|
77
|
+
pythonpath = ["src"]
|
|
78
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# __init__.py
|
|
2
|
+
from .cli import app
|
|
3
|
+
from .models import BatchStatus, JobRecord, JobState
|
|
4
|
+
from .processor import BatchOrchestrator
|
|
5
|
+
from .providers import get_provider
|
|
6
|
+
from .store import JobStore
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"BatchOrchestrator",
|
|
10
|
+
"BatchStatus",
|
|
11
|
+
"JobRecord",
|
|
12
|
+
"JobState",
|
|
13
|
+
"JobStore",
|
|
14
|
+
"app",
|
|
15
|
+
"get_provider",
|
|
16
|
+
]
|