Title: Import statement unexpectedly executes functions in __init__.py · Issue #497 · apache/iceberg-python · GitHub
Open Graph Title: Import statement unexpectedly executes functions in __init__.py · Issue #497 · apache/iceberg-python
X Title: Import statement unexpectedly executes functions in __init__.py · Issue #497 · apache/iceberg-python
Description: Apache Iceberg version None Please describe the bug 🐞 When we import any functions that reside in __init__.py, it triggers the execution of the code instead of merely importing it. We must relocate the functions to a different file and m...
Open Graph Description: Apache Iceberg version None Please describe the bug 🐞 When we import any functions that reside in __init__.py, it triggers the execution of the code instead of merely importing it. We must relocate...
X Description: Apache Iceberg version None Please describe the bug 🐞 When we import any functions that reside in __init__.py, it triggers the execution of the code instead of merely importing it. We must relocate...
Opengraph URL: https://github.com/apache/iceberg-python/issues/497
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Import statement unexpectedly executes functions in __init__.py ","articleBody":"### Apache Iceberg version\r\n\r\nNone\r\n\r\n### Please describe the bug 🐞\r\n\r\nWhen we import any functions that reside in `__init__.py`, it triggers the execution of the code instead of merely importing it. We must relocate the functions to a different file and manage the imports in `__init__.py` using the `__all__` variable. This approach enables both star imports and specific imports without running the code upon import, thereby providing isolation between the internal and public API.\r\n\r\nExamples:\r\n\r\n[AWS SDK for Pandas](https://github.com/aws/aws-sdk-pandas/blob/main/awswrangler/catalog/__init__.py)\r\n[Pandas Arrays](https://github.com/pandas-dev/pandas/blob/main/pandas/arrays/__init__.py)\r\n[Scikit-Learn Datasets](https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/datasets/__init__.py)\r\n\r\nMore info:\r\n\r\n[Python.org: Packages](https://docs.python.org/3/tutorial/modules.html#packages)\r\n[Python.org: Importing from a Package](https://docs.python.org/3/tutorial/modules.html#importing-from-a-package)\r\n\r\nThis is causing me problems with the CLI I'm building as an internal tool. Can I be responsible for fixing this behavior?","author":{"url":"https://github.com/ndrluis","@type":"Person","name":"ndrluis"},"datePublished":"2024-03-04T21:53:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/497/iceberg-python/issues/497"}
| 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:2e45e1e3-ee95-dccc-413f-92f28cd77332 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDE2:C401D:4D66CE:63B0CB:6992886E |
| html-safe-nonce | 6b828d2ba92fb2cb90cd6375cd60953ae23754c18d5205b8e764474f2d220aea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREUyOkM0MDFEOjRENjZDRTo2M0IwQ0I6Njk5Mjg4NkUiLCJ2aXNpdG9yX2lkIjoiNTc1MzI4Mzk2Mzc4ODYyNjAzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b0dd321306e8b8b0e3e992589ed05f083532f304ba2b46426c98265c4057550b |
| hovercard-subject-tag | issue:2167841189 |
| 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/apache/iceberg-python/497/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d5187670b5709983e6ecd86be34432996eeeb8c5b6fa87125a803c235d6d58b7/apache/iceberg-python/issues/497 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d5187670b5709983e6ecd86be34432996eeeb8c5b6fa87125a803c235d6d58b7/apache/iceberg-python/issues/497 |
| og:image:alt | Apache Iceberg version None Please describe the bug 🐞 When we import any functions that reside in __init__.py, it triggers the execution of the code instead of merely importing it. We must relocate... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ndrluis |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/iceberg-python git https://github.com/apache/iceberg-python.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 677260606 |
| octolytics-dimension-repository_nwo | apache/iceberg-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 677260606 |
| octolytics-dimension-repository_network_root_nwo | apache/iceberg-python |
| 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 | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width