Skip to content

dev_environment.py drops 0.9.0's runtime libraries when linking, breaking the dev env with "No schema named IFC4" #9488

Description

@theoryshaw

Bug Description

dev_environment.py copies the compiled dependencies into the repo with a single glob:

# src/bonsai/scripts/dev_environment.py
for path in PACKAGE_PATH.glob("ifcopenshell/*_wrapper*"):

and then replaces site-packages/ifcopenshell with a symlink to src/ifcopenshell-python/ifcopenshell.

That glob was written when the wrapper was self-contained. Since 0.9.0 it isn't: the package ships runtime libraries alongside it which are loaded by name at runtime rather than linked. From ifcopenshell-0.9.0a260909-py313-none-win_amd64.whl:

ifcopenshell/_ifcopenshell_wrapper.cp313-win_amd64.pyd      <- matches *_wrapper*
ifcopenshell/ifcopenshell.geometry.dll                      <- does not match
ifcopenshell/ifcopenshell.geometry.writer.dll               <- does not match
ifcopenshell/ifcopenshell.parse.dll                         <- does not match
ifcopenshell/ifcopenshell.plugin.dll                        <- does not match
ifcopenshell/ifcopenshell_document_rdb.dll                  <- does not match
ifcopenshell/ifcopenshell_geometry_kernel_opencascade.dll   <- does not match

Only the wrapper is copied into the repo. The symlink then shadows the originals still sitting in site-packages, so they become unreachable and the wrapper comes up without the libraries it needs. It surfaces as:

RuntimeError: No schema named IFC4

Comparing what the glob selects against what the package actually contains:

package *_wrapper* selects present and needed
ifcopenshell-0.8.6a260708-py313 2 2
ifcopenshell-0.9.0a260909-py313 2 8

To reproduce

  1. Install a Bonsai 0.9.0 build (Blender 5.1+).
  2. Run python src/bonsai/scripts/dev_environment.py, answering with that Blender version.
  3. Launch Blender. Bonsai fails to register with RuntimeError: No schema named IFC4.

Relationship to #9423

Same error text, different cause, and they are independent.

#9423 is the Windows packaging step failing to collect ifcopenshell_parse_schema_ifc*.dll into the published zip. This issue is the dev-link script failing to copy runtime libraries that are present in the package.

They compound rather than overlap: once #9423 is fixed and the schema libraries ship, this glob will still drop them on every dev_environment.py run, so a linked dev environment would stay broken even with a correct package.

Not Windows-specific in principle — the same omission applies to .so / .dylib on Linux and macOS.

Suggested fix

Select on file type instead of on the _wrapper name, so anything compiled in the package folder is copied:

library_suffixes = (".dll", ".pyd", ".so", ".dylib")
for path in PACKAGE_PATH.glob("ifcopenshell/*"):
    if not path.is_file():
        continue
    # Type stubs are checked into the repo, don't overwrite them.
    if path.suffix.lower() == ".pyi":
        continue
    if path.suffix.lower() not in library_suffixes and "_wrapper" not in path.name:
        continue
    ...

Checked against both packages above: identical selection for 0.8.6 (no behaviour change), and 8 files instead of 2 for 0.9.0. Future ifcopenshell_parse_schema_ifc*.dll files are then collected by the same .dll rule.

I have this working locally and am happy to open a PR.

Debug and Error Output

OS:              Windows 10 19045
Blender:         5.1 (bundled Python 3.13)
Bonsai:          0.9.0-alpha260909
Script:          src/bonsai/scripts/dev_environment.py @ v0.9.0 (23f3874de1)

Files in site-packages/ifcopenshell matching the current glob "ifcopenshell/*_wrapper*":
  _ifcopenshell_wrapper.cp313-win_amd64.pyd
  ifcopenshell_wrapper.py

Compiled files in the same folder that are NOT matched, and so are lost behind the symlink:
  ifcopenshell.geometry.dll
  ifcopenshell.geometry.writer.dll
  ifcopenshell.parse.dll
  ifcopenshell.plugin.dll
  ifcopenshell_document_rdb.dll
  ifcopenshell_geometry_kernel_opencascade.dll

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR ProposedA PR has been proposed for this bug/feature.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions