Nano Banana Pro
Agent skill for nano-banana-pro
- **Project:** paravalid
Sign in to like and favorite skills
parallel_json_dumps(obj_list, workers='auto', min_size=100, **json_kwargs) -> list[str|Exception]parallel_json_loads(json_list, workers='auto', min_size=100, **json_kwargs) -> list[Any|Exception]parallel_validate(model_or_type, data_list, workers='auto', min_size=100, chunk_size=None, **opts) -> list[T|Exception]is_nogil_available() -> boolis_nogil_active() -> boollen(data) < min_size).errors='raise'; optional errors='collect' to interleave exceptions in the result list.timeout (global upper bound); cancel safely on timeout.paravalid/ paravalid/ init.py core.py json_parallel.py pydantic_parallel.py version.py tests/ test_core.py test_json.py test_pydantic.py benchmarks/ bench_json.py bench_pydantic.py examples/ example_json.py example_pydantic.py README.md pyproject.toml LICENSE .gitignore
is_nogil_available: prefer sysconfig.get_config_var("Py_GIL_DISABLED")==1; fallback to sys._is_gil_enabled() when present. Allow PARAVALID_ASSUME_NOGIL=1 for tests.is_nogil_active: runtime GIL state.auto_workers('auto'|int): use os.cpu_count().should_parallelize(n_items, min_size, nogil): only if no-GIL and n_items>=min_size.parallel_json_dumps/loads:
ThreadPoolExecutor(max_workers=auto_workers(workers)) + as_completed.timeout, errors=('raise'|'collect').json_kwargs (indent, ensure_ascii, default, etc.). Document that thread-safety of custom default is user’s responsibility.parallel_validate:
model is a BaseModel subclass, call model.model_validate. Otherwise use TypeAdapter[T].validate_python.chunk_size='auto'|int|None: 'auto' = conservative default, e.g., len(data)//(workers*6) with min 1.errors and timeout match JSON behavior.errors='collect' works.N uses sequential; safe cancellation on timeout.tests/test_core.py: nogil detection, auto_workers, should_parallelize.tests/test_json.py: dumps/loads ordering, exceptions, kwargs, timeout.tests/test_pydantic.py: model/type-adapter paths, chunking, exceptions, timeout.bench_json.py / bench_pydantic.py use pyperf; sweep N and workers.pip install paravalid (provide [pydantic] extra).errors, timeout, chunk_size.json.default and any global state touched by validators must be thread-safe.from __future__ import annotations.PARAVALID_DEBUG=1 if needed.core.py → unit tests.json_parallel.py → tests.pydantic_parallel.py → tests.__init__.py, pyproject.toml (extras), and minimal README examples.uv python install 3.13.7t uv python pin 3.13.7t uv add --dev pytest pyperf ruff build
uv run pytest -q
uv build
Read the repository’s CLAUDE.md and implement the paravalid MVP according to the DoD. Start with core.py and tests/test_core.py, make them pass, then implement json_parallel.py and its tests. After each step passes, proceed to the next one and report changes and commands you ran.