Zulip Chat Archive
Stream: general
Topic: all transitive imports
Jason Rute (Mar 30 2024 at 22:21):
Is there an easy way to see all the transitive imports for a given set of imports?
Yury G. Kudryashov (Mar 31 2024 at 00:47):
I run lake exe graph
, then sed
the output. Probably, there are better ways.
Mario Carneiro (Mar 31 2024 at 02:02):
you can get this pretty easily from lean metaprogramming, depending on what context you need it for
Mario Carneiro (Mar 31 2024 at 02:03):
it's already precalculated so you can just print out (<- getEnv).header.moduleNames
Jason Rute (Mar 31 2024 at 03:15):
@Mario Carneiro Could you give me a complete snippet? I’m not sure what monad I’m working in here.
Mario Carneiro (Mar 31 2024 at 03:21):
import Lean
open Lean
run_meta logInfo m!"{(← getEnv).header.moduleNames}"
Mario Carneiro (Mar 31 2024 at 03:22):
that will print out all the modules transitively used by the initial imports, i.e. import Init
+ import Lean
Adam Topaz (Mar 31 2024 at 03:35):
I guess if you use docs#CoreM.withImportModules you could specify the modules to import explicitly?
Last updated: May 02 2025 at 03:31 UTC