Title: Create a static version of the IfcOpenShell hl Python API · Issue #2693 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: Create a static version of the IfcOpenShell hl Python API · Issue #2693 · IfcOpenShell/IfcOpenShell
X Title: Create a static version of the IfcOpenShell hl Python API · Issue #2693 · IfcOpenShell/IfcOpenShell
Description: We have a wonderful high level API, kudos to everybody involved. We were also all in agreement with the ifcopenshell.api.run("module.function", ...args) kind of approach. By centrally invoking all API functionality through a central func...
Open Graph Description: We have a wonderful high level API, kudos to everybody involved. We were also all in agreement with the ifcopenshell.api.run("module.function", ...args) kind of approach. By centrally invoking all ...
X Description: We have a wonderful high level API, kudos to everybody involved. We were also all in agreement with the ifcopenshell.api.run("module.function", ...args) kind of approach. By centrally inv...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/2693
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Create a static version of the IfcOpenShell hl Python API","articleBody":"We have a wonderful high level API, kudos to everybody involved.\r\n\r\nWe were also all in agreement with the `ifcopenshell.api.run(\"module.function\", ...args)` kind of approach. By centrally invoking all API functionality through a central function we eliminate boiler-plate within the individual API functions and we are in really good shape to run API calls e.g collaboratively on a central server!\r\n\r\nHowever, I think the python ecosystem is more and more evolving towards static type decorations. Our approach makes the required arguments of a call completely opaque at the call site so we can't benefit from the static analysis built into IDEs these days. And, tbh, we've seen quite a couple of test cases failing lately due to mismatching in arguments passed to API functions.\r\n\r\nHere's a plan. Why don't we at the cmake install step [0] generate [1] [2] static equivalents of all the API usecases?\r\n\r\nThoughts?\r\n\r\n#### `api/aggregate/assign_object.py`\r\n\r\n```python\r\nclass Usecase:\r\n def __init__(self, file, product=None, relating_object=None):\r\n ...\r\n```\r\n\r\n#### `api/aggregate/__init__.py`\r\n\r\n```python\r\n# existing content\r\n# ...\r\n\r\n# appended at install\r\ndef assign_object(file : ifcopenshell.file, product : ifcopenshell.entity_instance = None, relating_object : ifcopenshell.entity_instance = None) -> ifcopenshell.entity_instance:\r\n # [doc_string]\r\n ifcopenshell.api.run(\"aggregate.assign_object\", file, product=product, relating_object=relating_object)\r\n```\r\n\r\n[0] https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcwrap/CMakeLists.txt#L95\r\n\r\n[1] I think that would be `install(SCRIPT` or `install(CODE`, but maybe `add_custom_command(\u003ctarget> POST_BUILD)` or `add_custom_target()` + `add_dependency()` would also work?\r\n\r\n[2] For python parsing is it `ast.parse()` or is there sth more convenient specific-purpose we can use?","author":{"url":"https://github.com/aothms","@type":"Person","name":"aothms"},"datePublished":"2023-01-13T08:47:36Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/2693"}
| 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:f4fa28eb-a57a-951a-c950-8255f31c5440 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8270:1B1760:D7F7F:127CDF:6B04B106 |
| html-safe-nonce | b399bc19e99a165914c236ab57c6a9d2fba6337f5f9f7d4aaebba6d5783af545 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjcwOjFCMTc2MDpEN0Y3RjoxMjdDREY6NkIwNEIxMDYiLCJ2aXNpdG9yX2lkIjoiMTM4ODczMjk1Nzc1NzU4MzYyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 88f6c77a62097fae6bba6f257749526ce98bc40819d0b8625a4a5fc66ce5e546 |
| hovercard-subject-tag | issue:1531926824 |
| 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/2693/issue_layout |
| twitter:image | https://opengraph.githubassets.com/25857524eb86de09d1f0fe6d98d0940215b283ba167fa4c66c987e827ba378cd/IfcOpenShell/IfcOpenShell/issues/2693 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/25857524eb86de09d1f0fe6d98d0940215b283ba167fa4c66c987e827ba378cd/IfcOpenShell/IfcOpenShell/issues/2693 |
| og:image:alt | We have a wonderful high level API, kudos to everybody involved. We were also all in agreement with the ifcopenshell.api.run("module.function", ...args) kind of approach. By centrally invoking all ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aothms |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1 |
| 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 | ffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b |
| 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