worried-salesclerk-37834
09/09/2021, 4:13 AMdataclasses
. Using 2.8.0.dev0
(trying to use the GCP stuff!) and current python version is 3.6.10.
I have a requirements file with this specified:
dataclasses==0.8; python_version < '3.7'
When I import as import dataclasses
the dependency is not included. But when I import as from dataclasses import asdict
, I'm able to pull in the dependency. Is this a bug, or some quirk that I just missed in the docs?hundreds-father-404
09/09/2021, 4:21 AMworried-salesclerk-37834
09/09/2021, 1:58 PMworried-salesclerk-37834
09/09/2021, 2:11 PMhundreds-father-404
09/09/2021, 2:15 PMhundreds-father-404
09/09/2021, 2:25 PM❯ hyperfine --warmup=1 --runs=100 './pants --no-remote-cache-{read,write} --no-pantsd dependencies ::'
Benchmark #1: ./pants --no-remote-cache-{read,write} --no-pantsd dependencies ::
Time (mean ± σ): 3.901 s ± 0.583 s [User: 3.332 s, System: 0.975 s]
Range (min … max): 3.620 s … 6.622 s 100 runs
After:
❯ hyperfine --warmup=1 --runs=100 './pants --no-remote-cache-{read,write} --no-pantsd dependencies ::'
Benchmark #1: ./pants --no-remote-cache-{read,write} --no-pantsd dependencies ::
Time (mean ± σ): 3.801 s ± 0.590 s [User: 3.335 s, System: 0.978 s]
Range (min … max): 3.613 s … 8.574 s 100 runs
But Hyperfine warns about statistical flukes, such as from noisy machine (I closed all apps at least). I'd be surprised if this actually makes things faster, but I suppose it's possible because we no longer have to do set(detected_imports) - set(stdlib)
. More likely is probably statistical noise
So I think the takeaway is this is safe to change performance wise 🙂 PR very much appreciated to fix this! And if you're able to get to it today, we still have time to cherry-pick into 2.7 before the stable releaseworried-salesclerk-37834
09/09/2021, 4:10 PMworried-salesclerk-37834
09/09/2021, 5:09 PM