mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 04:06:42 +00:00
fix(env): keep the batch-size constant reachable without pulling in PyYAML
ac5e7d54c4 removed a duplicated literal by having the tuning handler take
BATCH_SIZE from the client that owns it. That import walks straight out of the
stdlib:
handlers/__init__ -> i18n/tuning -> client -> languages -> cache.yaml -> yaml
and the .env generator runs on the bare bootstrap python, before any dependency
is installed. The client needs SOURCE_LANGUAGE from the language table, so it
can never satisfy that contract itself.
The constant moves into a module with no imports of its own, which the handler
README names as the allowed shape: a handler may import any repo module whose
own closure is stdlib-only. Both the client and the handler read it from there,
so the literal still exists once.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
762be5f67d
commit
77292f9041
3 files changed
+12
-2
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ import json
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from utils.i18n.client import BATCH_SIZE
|
||||
from utils.i18n.limits import BATCH_SIZE
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from utils.env.builder import BuildContext, EnvBuilder
|
||||
|
||||
@@ -16,13 +16,13 @@ from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from utils.i18n.languages import SOURCE_LANGUAGE
|
||||
from utils.i18n.limits import BATCH_SIZE
|
||||
from utils.i18n.placeholders import has_words, mask, unmask
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterable
|
||||
|
||||
SERVER_CODES = {"zh": "zh-Hans"}
|
||||
BATCH_SIZE = 20
|
||||
POLL_SECONDS = 5
|
||||
REQUEST_TIMEOUT_SECONDS = 600
|
||||
RETRY_ATTEMPTS = 4
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
"""Client limits the env generator and the translator must agree on.
|
||||
|
||||
They live apart from the client itself because the generator runs on the bare
|
||||
bootstrap interpreter: importing the client would pull in the language table and
|
||||
with it a YAML parser the generator is not allowed to need.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
BATCH_SIZE = 20
|
||||
Reference in new issue
Block a user