Title: refactor: delay import of pandas until needed by tlambert03 · Pull Request #87 · scijava/scyjava · GitHub
Open Graph Title: refactor: delay import of pandas until needed by tlambert03 · Pull Request #87 · scijava/scyjava
X Title: refactor: delay import of pandas until needed by tlambert03 · Pull Request #87 · scijava/scyjava
Description: While working on #86, I noticed that scyjava was greedily importing pandas, even when it wasn't being used. Pandas is somewhat large and can slow down startup; so it would be nice to delay that until we know we need it. The traditional pattern of try import just to know whether something is importable can be improved: if you want to know whether something is importable, you can use importlib.util.find_spec if you want to know whether someone has already imported something (e.g. to check whether some user object is an instance of some third-party type, without unnecessary import), you can look in sys.modules: sys.modules.get('pandas') this PR removes the _import_X(required=False) pattern in place of importlib.util.find_spec
Open Graph Description: While working on #86, I noticed that scyjava was greedily importing pandas, even when it wasn't being used. Pandas is somewhat large and can slow down startup; so it would be nice to delay tha...
X Description: While working on #86, I noticed that scyjava was greedily importing pandas, even when it wasn't being used. Pandas is somewhat large and can slow down startup; so it would be nice to delay...
Opengraph URL: https://github.com/scijava/scyjava/pull/87
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:36aea74f-73c1-f934-1bd4-8082ebbf86a3 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | B5BE:290B75:43D42F:59A62D:696B6B6D |
| html-safe-nonce | 82d8e91230fc5ea4099de323f2e4cd1b3fd7c6215713d174c88bc603a72c049d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUJFOjI5MEI3NTo0M0Q0MkY6NTlBNjJEOjY5NkI2QjZEIiwidmlzaXRvcl9pZCI6IjEzNzc0MjA4Njg1NzE1ODk0ODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 47f953f72602cc4302f67946c1fafca876d1fcfe88bd306c00a5a152c4a4ae37 |
| hovercard-subject-tag | pull_request:2768767824 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/scijava/scyjava/pull/87/checks |
| twitter:image | https://avatars.githubusercontent.com/u/1609449?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1609449?s=400&v=4 |
| og:image:alt | While working on #86, I noticed that scyjava was greedily importing pandas, even when it wasn't being used. Pandas is somewhat large and can slow down startup; so it would be nice to delay tha... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-cache |
| go-import | github.com/scijava/scyjava git https://github.com/scijava/scyjava.git |
| octolytics-dimension-user_id | 1262770 |
| octolytics-dimension-user_login | scijava |
| octolytics-dimension-repository_id | 113442144 |
| octolytics-dimension-repository_nwo | scijava/scyjava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113442144 |
| octolytics-dimension-repository_network_root_nwo | scijava/scyjava |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width