terricain / aioboto3

Wrapper to use boto3 resources with the aiobotocore async backend
Apache License 2.0
732 stars 75 forks source link

Avoid installing Chalice as a dependency by default #242

Closed and-semakin closed 2 years ago

and-semakin commented 2 years ago

Description

As far as I can see, there is experimental support for Chalice now. I develop a traditional (I mean, not serverless) asynchronous ASGI web application. I don't need Chalice but aioboto3 still installs it and seems like there is no easy way to avoid it.

I see, that you've already defined chalice as an extra dependency but for some reason, it doesn't work.

See:

$ python -V
Python 3.9.7

$ pip -V
pip 21.2.3 from ./aioboto3_experiment/.venv/lib/python3.9/site-packages/pip (python 3.9)

$ pip install aioboto3
....

$ pip freeze
aioboto3==9.2.1
aiobotocore==1.4.2
aiohttp==3.7.4.post0
aioitertools==0.8.0
async-timeout==3.0.1
attrs==21.2.0
blessed==1.17.6
boto3==1.17.106
botocore==1.20.106
cffi==1.14.6
chalice==1.26.0
chardet==4.0.0
click==8.0.1
cryptography==35.0.0
idna==3.2
inquirer==2.7.0
jmespath==0.10.0
multidict==5.2.0
mypy-extensions==0.4.3
pycparser==2.20
python-dateutil==2.8.2
python-editor==1.0.4
PyYAML==5.4.1
readchar==2.0.1
s3transfer==0.4.2
six==1.16.0
typing-extensions==3.10.0.2
urllib3==1.26.7
wcwidth==0.2.5
wrapt==1.13.1
yarl==1.6.3

$ pip freeze | grep chalice
chalice==1.26.0

Note, I didn't request any extras but I still have chalice installed.

Thanks for your work by the way!

and-semakin commented 2 years ago

In the poetry docs, they have an example of using extras:

[tool.poetry.dependencies]
# These packages are mandatory and form the core of this package’s distribution.
mandatory = "^1.0"

# A list of all of the optional dependencies, some of which are included in the
# below `extras`. They can be opted into by apps.
psycopg2 = { version = "^2.7", optional = true }
mysqlclient = { version = "^1.3", optional = true }

[tool.poetry.extras]
mysql = ["mysqlclient"]
pgsql = ["psycopg2"]

And in aioboto3's pyproject.toml: https://github.com/terrycain/aioboto3/blob/13c56a6a5a1a87f79c1b998cc76b01ce72fddaef/pyproject.toml#L24-L32

The only difference I can see is that you specify the allowed version range again. I mean chalice>=1.24.0 instead of just chalice. Could it be the root of the issue?

and-semakin commented 2 years ago

Yes, I confirm, removing the version specifier should resolve the issue.

It's the original PKG-INFO we have at the moment (I extracted it from .tar.gz artifact produced by poetry build):

Provides-Extra: chalice
Provides-Extra: s3cse
Requires-Dist: aiobotocore[boto3] (==1.4.2)
Requires-Dist: chalice (>=1.24.0)
Requires-Dist: cryptography (>=2.3.1)

And this one is generated if we remove versions:

Provides-Extra: chalice
Provides-Extra: s3cse
Requires-Dist: aiobotocore[boto3] (==1.4.2)
Requires-Dist: chalice (>=1.24.0); extra == "chalice"
Requires-Dist: cryptography (>=2.3.1); extra == "s3cse"
terricain commented 2 years ago

Oh good spot. Yeah the version should not be in the extras section as that just specifies which dependencies it should pull in.

terricain commented 2 years ago

v9.2.2 is out :smile:

and-semakin commented 2 years ago

Thanks! Probably, it could make sense to yank release 9.2.1, so people don’t accidentally install it, as it is superseded by 9.2.2.

terricain commented 2 years ago

Yep good shout