proud-byte-81916
10/02/2023, 3:03 PMdependencies=["!!requirements.txt#mypy", "!!requirements.txt#sqlalchemy-stubs"]
in my python_awslambda
target, like:
python_awslambda(
name="lambda",
handler="app.py:lambda_handler",
complete_platforms=["3rdparty/platforms:aws_lambda_python_3_10"],
dependencies=["!!requirements.txt#mypy", "!!requirements.txt#sqlalchemy-stubs"]
)
This BUILD file is in projects/tag
and requirements.txt
in the repository root. Running pants package
gives the error:
`InvalidFieldException: projects/tag/BUILD24 Failed to get dependencies for projects/taglambda Addresses for generated first-party targets in the build root must include which target generator they come from, such as requirements.txt:original_target
. However, requirements.txt#mypy
from the dependencies
field from the target projects/tag:lambda did not have a target name.`
How can I link my requirements.txt
in the root to my BUILD file in projects/tag
? I would really appreciate the helps as always 🙏 thanks so much in advance!late-advantage-75311
10/02/2023, 3:11 PMpants list ::
?late-advantage-75311
10/02/2023, 3:13 PM:
in thereproud-byte-81916
10/02/2023, 3:14 PM//:reqs#ansicolors
//:reqs#apispec
//:reqs#aws-lambda-context
//:reqs#aws-lambda-powertools
//:reqs#chalice
//:reqs#chalice-spec
//:reqs#jmespath
//:reqs#langchain
//:reqs#matplotlib
//:reqs#numpy
//:reqs#openai
//:reqs#opencv-python-headless
//:reqs#pillow
//:reqs#pydantic
//:reqs#pyspellchecker
//:reqs#pytest
//:reqs#python-dotenv
//:reqs#replicate
//:reqs#requests
//:reqs#setuptools
//:reqs#types-setuptools
//:reqs#webcolors
the thing is that now mypy
doesn't appear here (because it's not an explicit dependency in my requirements.txt file) but I can see it in my .lock file (probably it is a transitory dependency) - and same for sqlalchemy-stubs
is there a way to exclude them without having them as explicit dependencies?late-advantage-75311
10/02/2023, 3:14 PMlate-advantage-75311
10/02/2023, 3:17 PMproud-byte-81916
10/02/2023, 3:18 PMlate-advantage-75311
10/02/2023, 3:20 PMproud-byte-81916
10/02/2023, 3:21 PMenough-analyst-54434
10/02/2023, 3:27 PMenough-analyst-54434
10/02/2023, 3:28 PMproud-byte-81916
10/02/2023, 3:29 PMproud-byte-81916
10/02/2023, 3:30 PMenough-analyst-54434
10/02/2023, 3:30 PMenough-analyst-54434
10/02/2023, 3:30 PMenough-analyst-54434
10/02/2023, 3:31 PMenough-analyst-54434
10/02/2023, 3:32 PMproud-byte-81916
10/02/2023, 3:34 PMenough-analyst-54434
10/02/2023, 3:34 PMenough-analyst-54434
10/02/2023, 3:35 PMlate-advantage-75311
10/02/2023, 3:35 PMenough-analyst-54434
10/02/2023, 3:36 PMenough-analyst-54434
10/02/2023, 3:37 PMlate-advantage-75311
10/02/2023, 3:37 PMjust curious - these two are very large libs that if you removed them would get you down below the 250 mb limit?
yep, i can see them in my unzipped lambda folder, and they would get me right below the limit
enough-analyst-54434
10/02/2023, 3:38 PMenough-analyst-54434
10/02/2023, 3:38 PMenough-analyst-54434
10/02/2023, 3:38 PMproud-byte-81916
10/02/2023, 3:38 PMsqlalchemy
SQLAlchemy-2.0.21.dist-info
that i believe are not neededenough-analyst-54434
10/02/2023, 3:39 PMproud-byte-81916
10/02/2023, 3:39 PMmypy_extensions-1.0.0.dist-info
, I thought was the same as the issue above but probably not as it's becoming clear from our conversationenough-analyst-54434
10/02/2023, 3:45 PMzip -d
deleting all .pyi
files to see if your size reduction effort will even work to bring the zip under the limit?enough-analyst-54434
10/02/2023, 3:46 PMproud-byte-81916
10/02/2023, 3:48 PMlate-advantage-75311
10/02/2023, 3:48 PMenough-analyst-54434
10/02/2023, 3:48 PMenough-analyst-54434
10/02/2023, 3:49 PMproud-byte-81916
10/02/2023, 3:49 PMpython_requirement(name="sql-alchemy", requirements=["SQLAlchemy==2.0.21"])
python_awslambda(
name="lambda",
handler="app.py:lambda_handler",
complete_platforms=["3rdparty/platforms:aws_lambda_python_3_10"],
dependencies=["!!:sql-alchemy"]
)
In my zip file, I still get the folder sqlalchemy
SQLAlchemy-2.0.21.dist-info
Is there something I am missing?enough-analyst-54434
10/02/2023, 3:49 PMenough-analyst-54434
10/02/2023, 3:50 PMproud-byte-81916
10/02/2023, 3:50 PMproud-byte-81916
10/02/2023, 3:50 PMlate-advantage-75311
10/02/2023, 3:52 PMmypy
python_requirement(name="mypy", requirements=["mypy"])
. Then exclude it from the awslambda dependencies.enough-analyst-54434
10/02/2023, 3:53 PMzip -d
I mention.enough-analyst-54434
10/02/2023, 3:54 PMenough-analyst-54434
10/02/2023, 3:56 PMproud-byte-81916
10/02/2023, 3:56 PMenough-analyst-54434
10/02/2023, 3:57 PMproud-byte-81916
10/02/2023, 3:58 PMproud-byte-81916
10/02/2023, 3:58 PMenough-analyst-54434
10/02/2023, 3:58 PMproud-byte-81916
10/02/2023, 3:59 PMproud-byte-81916
10/02/2023, 4:00 PMpython_requirement(name="sql-alchemy", requirements=["SQLAlchemy==2.0.21"])
python_awslambda(
name="lambda",
handler="app.py:lambda_handler",
complete_platforms=["3rdparty/platforms:aws_lambda_python_3_10"],
dependencies=["!!:sql-alchemy"]
)
proud-byte-81916
10/02/2023, 4:00 PMenough-analyst-54434
10/02/2023, 4:00 PMenough-analyst-54434
10/02/2023, 4:01 PMenough-analyst-54434
10/02/2023, 4:01 PMlate-advantage-75311
10/02/2023, 4:04 PMenough-analyst-54434
10/02/2023, 4:04 PMproud-byte-81916
10/02/2023, 4:05 PMproud-byte-81916
10/02/2023, 4:05 PM