Exporting only the used 3rd party dependencies of a given target #19147
Unanswered
james-hollingsworth
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We have a Python monorepo and use a single requirements.txt in order to prevent version drift between projects (I mention this as I realise using multiple lock files/resolves would be one way to solve what I'm asking..)
We would like to create a Python virtual env for one of / each of our monorepo projects/targets in order to carry out certain testing / debugging locally with confidence the dependencies used match those of the deployed target. Ideally we would like a way to include a few additional dev tool packages in the virtual env required for testing such as pytest, behave etc. I've found a way to do it with the
export
goal, but a warning message states my approach will be deprecated. Is there another approach I can use to achieve the same thing while keeping the single lock file? Or.. :) .. any chance the feature can not become deprecated?Thanks,
James
Some more detail:
We can create a virtual env containing only the 3rd party dependencies needed by the target by doing e.g.:
pants export projects/myproject:
Additionally we can get additional dev tool packages to be included in that env by specifying them as source dependencies in the project's
BUILD
, e.g.:However when I run pants export I see this warning:
[WARN] DEPRECATED: exporting resolves without using the --resolve option is scheduled to be removed in version 2.23.0.dev0.
If instead we export using resolves, then the virtual env contains the dependencies of all projects which is not what we want. Also, if we keep the tooling dependencies in a separate resolve - they end up in a separate virtual env which is not so good for IDE integration (though I note this is covered in another discussion).
Beta Was this translation helpful? Give feedback.
All reactions