-
-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transitive excludes on python requirements do not work for external libraries #11324
Comments
Moved this issue here from pex-tool/pex#1146 for @GLeurquin. |
Thanks @jsirois, indeed had the wrong tab opened (pex instead of pants). I'll add that the version of pants I'm using is: |
Hm, John, I think this is actually a Pex issue.
Not in the current form, no. The current transitive excludes code deals in the abstraction level of targets. You can say to ignore a But what another To support this, Pants would need to do something like |
I don't think so. The python community does not support requirement excludes in any tool I'm aware of or any relevant PEP. If Pants wants to extend its exclude mechanism for local code to remote code, it will need to work around ecosystems that do not support this for 3rdparty deps. So, for the jvm it can leverage maven excludes, for Python it cannot. Some relevant issues in the python community asking for this feature from dependency resolvers:
Pex should definitely not support this. |
+1, this then is really a pip issue.
Likewise, I don't think Pants should support this without Pex supporting it, which requires pip / Python ecosystem supporting it. I'm going to close as out of scope @GLeurquin. |
Reopening due to Pex support. |
Highlighted changelogs: * https://github.com/pex-tool/pex/releases/tag/v2.4.0 * https://github.com/pex-tool/pex/releases/tag/v2.4.1 * https://github.com/pex-tool/pex/releases/tag/v2.5.0 * https://github.com/pex-tool/pex/releases/tag/v2.6.0 * https://github.com/pex-tool/pex/releases/tag/v2.7.0 * https://github.com/pex-tool/pex/releases/tag/v2.8.0 * https://github.com/pex-tool/pex/releases/tag/v2.8.1 * https://github.com/pex-tool/pex/releases/tag/v2.9.0 * https://github.com/pex-tool/pex/releases/tag/v2.10.0 * https://github.com/pex-tool/pex/releases/tag/v2.10.1 * https://github.com/pex-tool/pex/releases/tag/v2.11.0 (!) ``` Lockfile diff: 3rdparty/python/user_reqs.lock [python-default] == Upgraded dependencies == certifi 2024.6.2 --> 2024.7.4 exceptiongroup 1.2.1 --> 1.2.2 pex 2.3.3 --> 2.11.0 pydantic 1.10.16 --> 1.10.17 ``` NOTE: This updates the scrupulously backwards compatible Pex, but does not use any new features yet. The minimum version is unchanged. Possibly relevant for: #15704 #21103 #20852 #15454 #21100 #11324 #19256 #19552 #19681
Transitive dependency excludes do not work for packages defined in external librarie's
requirements.txt
Given this in
3rdparty/python/BUILD
:where
somelib
'srequirements.txt
includessomeotherlib
as a requirement, i.e.:requirements.txt
of somelib:and this in
src/mylib/BUILD
and running
./pants package src/mylib:awslambda
, the resulting package still includessomeotherlib
(most likely becausesomelib
needs it in its ownrequirements.txt
, andpants
does not look like it's aware of that.).For my use case, I'm trying to use an external library which makes use of
boto3
andbotocore
:aws-secretsmanager-caching
, and I need the lambda package to not contain theboto3
andbotocore
packages, because they take too much space in the lambda package and the lambda runtime already includes them out of the box.The current workaround I have is to clone the
aws-secretsmanager-caching
library, convert it to a pants accepted build folder using BUILD files, and then the exclude works as expected, however this is not ideal since it copies source code from another library into my project.Any better way to do this ? Is this a feature that's supposed to be supported by pants ? Thanks for your feedback.
The text was updated successfully, but these errors were encountered: