Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: release aws-requests-auth as a wheel #54

Closed
kgaughan opened this issue May 17, 2020 · 1 comment
Closed

Request: release aws-requests-auth as a wheel #54

kgaughan opened this issue May 17, 2020 · 1 comment

Comments

@kgaughan
Copy link

Currently, the version of aws-requests-auth published on PyPI is a source tarball, but this poses issues if you're building a lambda that has binary dependencies, such as, say PyYAML or the cryptography library.

To give you an example, say you do your development of a Mac or Windows box: you might install all your libraries into a directory to be zipped up like so:

pip3 install \
    --ignore-installed \
    --compile \
    --platform linux_x86_64 \
    --only-binary :all: \
    --implementation cp \
    --requirement "$requirements" \
    --target .

The use of --only-binary :all: is unfortunately required if you're also using --platform to guarantee that any binary dependencies downloaded are for the correct target platform. Unfortunately, this means that pip won't bother downloading source tarballs if that's all that's available. Instead, you get an error like the following:

ERROR: Could not find a version that satisfies the requirement aws-requests-auth (from -r ../requirements.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for aws-requests-auth (from -r ../requirements.txt (line 1))

The likes of requests, boto3, &c., don't have this particular issue because they're packaged as wheels.

The additional flags are unavoidable, unfortunately, and there seems to be no way to tell pip that source distributions are OK as a fallback.

The fix is simple enough. Add this to setup.cfg:

[bdist_wheel]
universal = 1

That will mean the wheel will work with both Python 2 and Python 3 and indicates that the wheel will also work on any platform. Also, in setup.py, replace from distutils.core import setup with from setuptools import setup. This also fixes a bug as distutils doesn't actually support the install_requires distribution option, so it means the dependency on requests will now work properly.

Finally, rather than just doing python3 setup.py sdist bdist_wheel, ensure the wheel package is installed and do python3 setup.py sdist bdist_wheel instead.

You should end up with something like this:

$ ls dist
aws-requests-auth-0.4.2.tar.gz
aws_requests_auth-0.4.2-py2.py3-none-any.whl
DavidMuller added a commit that referenced this issue May 27, 2020
## What

This PR preps the repository for publishing a wheel as per @kgaughan 's recommendations in:

- `Request: release aws-requests-auth as a wheel` - #54
- `Basic wheel building support` - #55
@DavidMuller
Copy link
Owner

Thanks for the detailed writeup @kgaughan .

aws-requests-auth version 0.4.3 is now published and includes a wheel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants