question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best practices for keeping `boto3-stubs` and `boto3` in sync?

See original GitHub issue

Some 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:open
  • Created 10 months ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
vemelcommented, Dec 7, 2022

@jfly good idea! I will add this functionality and test it. However, there is another caveat. Service supported methods and arguments actually depend on botocore version installed, not boto3 version. So I think it makes sense to depend on an exact version of boto3 and botocore.

0reactions
vemelcommented, Dec 22, 2022

@jfly did you have a chance to try it out? Please let me know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · youtype/mypy_boto3_builder - GitHub
Best practices for keeping boto3-stubs and boto3 in sync ? enhancement New feature or request response needed Awaiting response from a reporter.
Read more >
Mypy boto3
Type annotations for boto3 compatible with mypy, VSCode, PyCharm and other tools. ... To properly uninstall boto3-stubs , use these commands:
Read more >
boto3-stubs - PyPI
Add AWS Boto3 extension to your VSCode and run AWS boto3: Quick Start command. Click Auto-discover services and select services you use in...
Read more >
boto3 Sessions, and Why You Should Use Them | by Ben Kehoe
To start, let's talk about how boto3 works, and what a session is. ... It's good practice to take a --profile parameter, just...
Read more >
Boto3 - The Blue Book
Boto3 is the AWS SDK for Python to create, configure, and manage AWS services, such as Amazon Elastic Compute Cloud (Amazon EC2) and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found