How does pants handle dynamic imports with depende...
# general
g
How does pants handle dynamic imports with dependency inference? For example if we use a typing library which is bloated but we don't want that in the package for lambda deployment to minimise artefact size?
c
Regarding dynamic imports, there’s some options in this subsystem https://www.pantsbuild.org/docs/reference-python-infer Not sure if that answers your question though. Your example hints at excluding dependencies, that possibly where inferred. You can do that using
!
and
!!
in your dependencies field. See the note at the end of https://www.pantsbuild.org/docs/targets#dependencies-field
👍 1
g
Thanks! That partially solves it, would be good to be able to dynamically set the
!
based on a setting, will have a look around the docs
r
👍 1
c
If there’s a select few imports you don’t want to be inferred by the dependency engine, there’s also a pragma you can apply in code:
Copy code
... # pants: ignore-dep
👍 2
My bad, it is
# pants: no-infer-dep
. It was renamed.
@bitter-ability-32190 did this feature make it into the docs..?
b
Hmm maybe not?
🙈 1
FYI @hundreds-father-404 the wordsmith 😛