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/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:c66ad460-8aee-87c8-bfd6-76a4e8576ae0 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | E6E8:70438:18EA538:20EDEC3:69719A56 |
| html-safe-nonce | 0064d4f9d3cad1cbdf4699f046552b744bb7b70e190a6afe41347f2b442f7370 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkU4OjcwNDM4OjE4RUE1Mzg6MjBFREVDMzo2OTcxOUE1NiIsInZpc2l0b3JfaWQiOiI4ODgyMjAwNjI4NTY2MjY4NTAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | eb91205f6d54a929001646eb052a71f67a43158a09a54694ca0e3260e83402d6 |
| 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 | fdfdce9cd4f6ab85dca2b0d11264270829297c962dd5a79df449062d7822258f |
| 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 | 51c736e60b302bd039c9d5164573d176ceb24bb2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width