Title: dev_environment.py: detect Blender's bundled Python from disk instead of a hardcoded version boundary · Issue #9227 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: dev_environment.py: detect Blender's bundled Python from disk instead of a hardcoded version boundary · Issue #9227 · IfcOpenShell/IfcOpenShell
X Title: dev_environment.py: detect Blender's bundled Python from disk instead of a hardcoded version boundary · Issue #9227 · IfcOpenShell/IfcOpenShell
Description: src/bonsai/scripts/dev_environment.py derives the site-packages path from a hardcoded Blender→Python version boundary: BLENDER_VERSION_INT = tuple(map(int, BLENDER_VERSION.split("."))) PYTHON_VERSION = "3.13" if BLENDER_VERSION_INT >= (5...
Open Graph Description: src/bonsai/scripts/dev_environment.py derives the site-packages path from a hardcoded Blender→Python version boundary: BLENDER_VERSION_INT = tuple(map(int, BLENDER_VERSION.split("."))) PYTHON_VERSI...
X Description: src/bonsai/scripts/dev_environment.py derives the site-packages path from a hardcoded Blender→Python version boundary: BLENDER_VERSION_INT = tuple(map(int, BLENDER_VERSION.split("."))) PY...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9227
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"dev_environment.py: detect Blender's bundled Python from disk instead of a hardcoded version boundary","articleBody":"`src/bonsai/scripts/dev_environment.py` derives the site-packages path from a hardcoded Blender→Python version boundary:\n\n```python\nBLENDER_VERSION_INT = tuple(map(int, BLENDER_VERSION.split(\".\")))\nPYTHON_VERSION = \"3.13\" if BLENDER_VERSION_INT >= (5, 1) else \"3.11\"\nPACKAGE_PATH = BLENDER_PATH / rf\"extensions/.local/lib/python{PYTHON_VERSION}/site-packages\"\n```\n\nd30c25010 already fixed the immediate breakage (before it, only an exact `== \"5.1\"` match got 3.13, so Blender 5.2 fell through to 3.11 and the script aborted). This issue is about the remaining structural problem rather than a current failure.\n\n### Problem\n\nThe boundary has to be hand-edited every time Blender bumps its bundled Python. The current form is correct only until Blender ships 3.14 — at that point every 5.1+ user gets `python3.13`, the path doesn't exist, and the script dies on:\n\n```\nAssertionError: Path 'PACKAGE_PATH=...\\extensions\\.local\\lib\\python3.13\\site-packages' doesn't exist, ensure variable is set correctly.\n```\n\nThat is the same failure mode this script has already produced twice (7e1843b96 for 5.1, d30c25010 for 5.2). Each occurrence blocks new contributors setting up a dev environment, and the error message doesn't hint at the real cause.\n\n### Proposal\n\nThe information is already on disk — read it instead of predicting it. Glob `extensions/.local/lib/python*/site-packages` and take the highest match, keeping the version mapping only as a fallback so the existing assertion still prints a sensible path:\n\n```python\ndef find_package_path() -> Path:\n extensions_lib = BLENDER_PATH / \"extensions/.local/lib\"\n candidates = sorted(extensions_lib.glob(\"python*/site-packages\"))\n if candidates:\n # Highest Python version wins if there are leftovers from an older Blender.\n return candidates[-1]\n # Fallback so the assert below reports a sensible path.\n blender_version_int = tuple(map(int, BLENDER_VERSION.split(\".\")))\n fallback = \"3.13\" if blender_version_int >= (5, 1) else \"3.11\"\n return extensions_lib / f\"python{fallback}/site-packages\"\n```\n\nThis is self-maintaining across future Blender releases and needs no change when 3.14 lands.\n\nTwo details worth deciding on:\n\n- `sorted()` on the glob is string ordering, so `python3.9` would sort above `python3.13`. Blender has been on 3.10+ for a while so it doesn't bite today, but a numeric key on the version parts would be more honest if you'd rather not rely on that.\n- Picking the highest match assumes a stale folder from an older Blender is never the correct target. That holds because `BLENDER_PATH` is already version-scoped, so the folder only contains one Blender's extensions.\n\n### Related: print `PACKAGE_PATH`\n\nIndependent of the above — `PACKAGE_PATH` is the one path the script asserts on but never shows in its \"Script settings\" block, so the failure appears without context. Adding it next to `REPO_PATH`/`BLENDER_PATH`/`BONSAI_PATH` makes the assertion self-explanatory.\n\nI have both changes locally and can open a PR.\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-08-02T13:43:30Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9227"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bceaa150-f3ff-9847-9c9b-a292ebcbcd04 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8C8:3670FE:655D91:89792A:6B04CA22 |
| html-safe-nonce | b16e3ba6d657606c37ec1a70217e2c7e3c549a9556daf71effcea29d197f4c4e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEM4OjM2NzBGRTo2NTVEOTE6ODk3OTJBOjZCMDRDQTIyIiwidmlzaXRvcl9pZCI6Ijg3MDgwODcxODU2MDMzNDkwMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f58da6d6edd832620946e06e48942af61ec138ce7849689f563c0b2ed80929b8 |
| hovercard-subject-tag | issue:5042694820 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/9227/issue_layout |
| twitter:image | https://opengraph.githubassets.com/626a08e56504eaefd015c336e4e5aa7c65ed05660e151a21c5cedcf83a26899e/IfcOpenShell/IfcOpenShell/issues/9227 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/626a08e56504eaefd015c336e4e5aa7c65ed05660e151a21c5cedcf83a26899e/IfcOpenShell/IfcOpenShell/issues/9227 |
| og:image:alt | src/bonsai/scripts/dev_environment.py derives the site-packages path from a hardcoded Blender→Python version boundary: BLENDER_VERSION_INT = tuple(map(int, BLENDER_VERSION.split("."))) PYTHON_VERSI... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | theoryshaw |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4 |
| turbo-cache-control | no-preview |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width