curved-shampoo-96935
11/14/2023, 5:58 PM> pip install boto3-stubs[ec2]
> pip freeze
boto3-stubs==1.28.85
botocore-stubs==1.31.85
mypy-boto3-ec2==1.28.85
types-awscrt==0.19.10
types-s3transfer==0.7.0
typing_extensions==4.8.0
In the pants world if I have a requirements.txt with just boto3-stubs[ec2], then I would get a warning that there’s no owner if I use the transitive import like:
from mypy_boto3_ec2 import Client as Ec2Client
My goals:
1. I would like to not get any warnings when running pants commands
2. I would like to have a simple way of adding new dependencies. e.g. just adding boto3-stubs[ec2] and not all the dependencies
It’s pretty bad developer experience if in order to pull a dependency, I have to first manually figure out the transitive dependencies and then merge it into the requirements.txt.
I’m curious how do people solve this problem here.curved-television-6568
11/14/2023, 6:55 PMgorgeous-winter-99296
11/14/2023, 7:49 PMIt’s pretty bad developer experience if in order to pull a dependency, I have to first manually figure out the transitive dependencies and then merge it into the requirements.txt.I think this is actually the other way around: it's a bad developer experience if a third-party library changing their dependencies suddenly removed it from your project. Terrible to debug, because just regenerating lockfiles without any code changes will suddenly make CI go red! This has happened a few times for us when using "simpler" solutions like PDM or Poetry, and much worse when we had our own custom system. Andreas does raise a valid point regarding collection-packages, but I think the extra pain in those situations is worth the stronger guarantees in other situations.
gorgeous-winter-99296
11/14/2023, 7:52 PMcurved-shampoo-96935
11/14/2023, 9:21 PMboto3-stubs is the pip package, but the main usage is via mypy-boto3-ec2 then it should be added directly into requirements.txt as well
I do think that the above is still pretty manual and puts a lot of onus on the developer. e.g. as a developer, when I put boto3-stubs in requirements.txt, I should generate lock file, and then when I start writing code and import ``mypy-boto3-ec2` which I know comes from boto3-stubs I need to go add it in requirements.txt and then generate the lock file again.
When I started this thread, I was very curious how people add dependencies. Do they do what I’ve just mentioned above, or is there some other workflow that people use which is more ergonomic.curved-television-6568
11/14/2023, 9:26 PMcurved-television-6568
11/14/2023, 9:28 PMso that pants make this a python_source target.this makes
python_requirement targets…curved-shampoo-96935
11/14/2023, 9:28 PMcurved-shampoo-96935
11/14/2023, 9:33 PMcurved-shampoo-96935
11/14/2023, 9:36 PMgo get <dep> (missing equivalent in pants/pip)
If <dep> has transitive dependencies <dep1>, <dep2>, then the go.mod (equivalent of requirements.txt) file will be updated to have 3 lines
dep // direct
dep1 // indirect
dep2 // indirect
Then pants should be able to parse this just fine.curved-television-6568
11/14/2023, 9:40 PMcurved-shampoo-96935
11/14/2023, 9:41 PMcurved-television-6568
11/14/2023, 9:41 PMgo get <dep> add to the list of deps. in go.mod?curved-television-6568
11/14/2023, 9:43 PMcurved-shampoo-96935
11/14/2023, 9:43 PMgo get foo
and foo depends on bar, and dep2 v2
Then I believe go.mod will become
dep // direct
dep1 // indirect
dep2 (v2 upgraded) // indirect
foo // direct (assume usage in real code)
bar // indirectcurved-television-6568
11/14/2023, 9:43 PM