fix: resolve top-level resource classes in mypy - #710
fix: resolve top-level resource classes in mypy#710mrlonely (mameikagou) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b64b6728b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| from .functions.invoke import * | ||
| from .functions.stream import * | ||
| from .generated_types import * | ||
| from .generated_types import ( # noqa: F401 |
There was a problem hiding this comment.
Keep the generated exports synchronized automatically
Replacing the wildcard with this handwritten list disconnects the package root from the auto-generated generated_types.__all__. When platform type generation adds an export, it will no longer be available from braintrust; more seriously, when it renames or removes one—as recent generated-type updates have done—this stale import will make every import braintrust fail with ImportError. Preserve an automatically synchronized export mechanism, such as re-exporting the generated set and then explicitly overriding only the four conflicting resource names.
Useful? React with 👍 / 👎.
Fixes #498.
The package root wildcard-imported generated API
TypedDicts with the same names asExperiment,Dataset,Project, andPrompt. Runtime imports selected the resource classes, but mypy selected the generated types.This explicitly re-exports the non-conflicting generated types so the four resource names resolve consistently, while keeping every existing generated name available at the package root. A type regression test covers the public resource methods.
Validation:
uv run nox -s test_typesuv run nox -s pylint