Best practices for keeping `boto3-stubs` and `boto3` in sync?
See original GitHub issueSome context
The README on pypi.org for boto3-stubs says:
boto3-stubs version is the same as related boto3 version and follows PEP 440 format.
It took me a while to find where this comes from. I believe it’s autogenerated by: https://github.com/youtype/mypy_boto3_builder/blob/aa37cb484d7d339b13ed20ad3a641c40b654938d/mypy_boto3_builder/templates/common/footer.md.jinja2#L36-L37
The problem
The version synchronicity between boto3 and boto3-stubs has made it easy for us to manually get boto3-stubs in sync with boto3 when things drift. However, it would be nice if we could keep these in sync without any human intervention. For the record, we use poetry, and we used to write our pyproject.toml to look something like this:
[tool.poetry.dependencies]
boto3 = "*"
boto3-stubs = {extras = ["essential", "sns"], version = "*"}
However, if someone runs a poetry update boto3 to pull in the latest version of boto3, this can cause drift with whatever version of boto3-stubs we happen to have. So, we’ve started either explicitly setting the exact same version for both boto3 and boto3-stubs, or just setting boto3-stubs to whatever version of boto3 poetry resolved to. Both of these approaches feel less than great: humans will keep having to get involved to keep the two in sync.
One idea
Have y’all considered specifying an install_requires on the exact version of boto3 that boto3-stubs was built for? Right now I don’t see boto3 listed at all: https://github.com/youtype/mypy_boto3_builder/blob/aa37cb484d7d339b13ed20ad3a641c40b654938d/mypy_boto3_builder/templates/boto3-stubs/setup.py.jinja2#L48-L52
That would give a tool like poetry enough information to know that it can’t upgrade boto3 without also upgrading boto3-stubs.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:2
- Comments:6

Top Related StackOverflow Question
@jfly good idea! I will add this functionality and test it. However, there is another caveat. Service supported methods and arguments actually depend on
botocoreversion installed, notboto3version. So I think it makes sense to depend on an exact version ofboto3andbotocore.@jfly did you have a chance to try it out? Please let me know.