Clean up dead code, fix type errors, and add publish workflow

Remove unused _append_ops_call_method, fix _property_data_from_member
call signature, replace sys.version_info guard with hasattr check for
__buffer__ protocol, fix implicit string concatenations, add msgbus
overrides for 4.0-4.4, add conformance tests, and add publish script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 11:07:52 +02:00
co-authored by Claude Opus 4.6
parent 673b9e54bc
commit f4df542dd1
17 changed files with 954 additions and 165 deletions
+8 -14
View File
@@ -296,10 +296,9 @@ def generate_package_files(
major_minor: str,
top_level_packages: list[str],
python_version: str,
revision: int = 0,
) -> None:
"""Generate pyproject.toml and README.md for the publishable package."""
package_version = f"{full_version}.{revision}"
package_version = f"{full_version}.0"
pyproject = build_generated_pyproject(
major_minor, package_version, top_level_packages, python_version
@@ -324,7 +323,7 @@ def generate_package_files(
(output_dir / pkg / "py.typed").touch()
def generate_for_version(blender_path: str, revision: int = 0) -> None:
def generate_for_version(blender_path: str) -> None:
"""Generate stubs for a single Blender executable."""
full_version, major_minor = get_blender_version(blender_path)
python_version = get_blender_python_version(blender_path)
@@ -356,7 +355,6 @@ def generate_for_version(blender_path: str, revision: int = 0) -> None:
major_minor,
top_level_packages,
python_version,
revision,
)
# Store the Python version for later type checking
@@ -405,8 +403,9 @@ def typecheck_stubs(versions: list[str] | None = None) -> None:
json.dumps(
{
"extraPaths": ["."],
"typeCheckingMode": "strict",
"typeCheckingMode": "all",
"pythonVersion": python_version,
"reportPropertyTypeMismatch": False,
}
)
)
@@ -480,9 +479,10 @@ def conformance_check(versions: list[str] | None = None) -> None:
{
"include": [str(test_dir)],
"extraPaths": [str(version_dir)],
"typeCheckingMode": "strict",
"typeCheckingMode": "all",
"pythonVersion": python_version,
"reportUnusedExpression": False,
"reportUnusedCallResult": False,
}
)
)
@@ -513,12 +513,6 @@ if __name__ == "__main__":
action="store_true",
help="Run conformance tests against generated stubs",
)
parser.add_argument(
"--revision",
type=int,
default=0,
help="Package revision number (default: 0, e.g. 4.5.8.1 for revision 1)",
)
parser.add_argument(
"versions",
nargs="*",
@@ -540,11 +534,11 @@ if __name__ == "__main__":
if (major, minor) < min_version:
print(
f"Blender {version} is not supported"
f" (minimum: {min_version[0]}.{min_version[1]})"
+ f" (minimum: {min_version[0]}.{min_version[1]})"
)
sys.exit(1)
print(f"=== Blender {version} ===")
blender_path = get_blender_executable(version)
generate_for_version(str(blender_path), revision=args.revision)
generate_for_version(str(blender_path))
print()
print("Done.")