News for hackers. Stuff that matters.
Re:What I wish I knew before building a Shopify App by nirushiv on Friday March 19, 2021 @04:09PM (#26517710)
> `import shopify` makes an API request.

Especially for a company that prides itself on great API design, this is head scratching.

‘shopify.Init()’ seems like such an obvious solution

Re:What I wish I knew before building a Shopify App by yen223 on Friday March 19, 2021 @04:44PM (#26517988)
The fact that you can have side effects on imports, and that a lot of libraries relied on side effects on import, was one of my biggest sources of frustration with Python
Re:What I wish I knew before building a Shopify App by hn_acc_2 on Friday March 19, 2021 @07:22PM (#26519182)
What other packages have you seen abusing import side effects?

Shopify is the first one I've seen, so I don't think it's quite as common as you are implying, but I'm curious to know what other bad behavior you have found

Re:What I wish I knew before building a Shopify App by mikepurvis on Friday March 19, 2021 @10:26PM (#26520257)
Sometimes libraries do a switcheroo where they run interpreted code on startup to locate the "real" implementation in a shared object, and then load that and replace themselves with it. I'm not sure this is really idomatic, but here's an example of what it looks like from OpenCV:

https://github.com/opencv/opencv/blob/master/modules/python/...

Re:What I wish I knew before building a Shopify App by OJFord on Friday March 19, 2021 @08:12PM (#26519467)
Not GP but I've been bitten by plenty of first-party implicit side-effects, both intended (by not me not now) and not (by me or otherwise).
Re:What I wish I knew before building a Shopify App by xeromal on Friday March 19, 2021 @11:17PM (#26520554)
LaunchDarkly does. It does some querying behind the scenes and added a significant delay to the coldstarts of our lambda apis
Re:What I wish I knew before building a Shopify App by edoceo on Saturday March 20, 2021 @12:23AM (#26520798)
Their PHP one had a similar shell_exec after-affect (c2017), caused some odd things in our logs but we backed away from that solution
Re:What I wish I knew before building a Shopify App by jbay808 on Saturday March 20, 2021 @02:04AM (#26521123)
SKiDL (circuit design library) does this to a very large extent...

https://github.com/xesscorp/skidl

Re:What I wish I knew before building a Shopify App by ilovetux on Saturday March 20, 2021 @05:08PM (#26526080)
An example in the standard library is the antigravity package. While it is an inside joke it still requires a HTTP transaction similar to the shopify package import.
Re:What I wish I knew before building a Shopify App by PurpleFoxy on Friday March 19, 2021 @08:22PM (#26519550)
Can’t you do this with any interpreted language? On ruby your import could redefine anything.
Re:What I wish I knew before building a Shopify App by throwaway53453 on Friday March 19, 2021 @09:48PM (#26520037)
Is there any real way around that? The import keyword might as well be renamed to exec.
Re:What I wish I knew before building a Shopify App by JanisL on Friday March 19, 2021 @11:56PM (#26520704)
I think this depends on how brutal the workarounds you will accept are