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: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:52bd4a99-6826-3548-3f1e-32169ed66ad9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E308:DD6B:36BB8BE:49C8D4D:69707445 |
| html-safe-nonce | 1c125b7771ece2b2f0388623f3a95b33e5097c223d71a9e61e23b9dc299b7abd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzA4OkRENkI6MzZCQjhCRTo0OUM4RDREOjY5NzA3NDQ1IiwidmlzaXRvcl9pZCI6IjIyMDUzNjM4NTc0MTA1MjAxMzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9399df354e3a4516515eeca646d9ec479a3c43e2a3dd83697604761faaca7f58 |
| hovercard-subject-tag | pull_request:2768767824 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/files |
| 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 | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width