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

Include "Requires-Python" in source distributions #106

Open
ddluke opened this issue May 17, 2022 · 0 comments
Open

Include "Requires-Python" in source distributions #106

ddluke opened this issue May 17, 2022 · 0 comments

Comments

@ddluke
Copy link

ddluke commented May 17, 2022

Describe the bug

The sagemaker inference toolkit sagemaker_inference is only being tested against Python 2.7, 3.6 and 3.7, yet installers like pip, poetry etc. would gladly attempt to install the toolkit in any other python version (potentially up to 3.10, depending on transitive dependencies and their metadata specs) since the package lacks the metadata entry Requires-Python.

Inspecting the sdist archives of the toolkit indicates that a version of setuptools is used which supports Metadata Version 2.1. Support for Metadata Version 2.1 was added to setuptools in 38.6.0. Support for Requires-Python was however already added to setuptools in 24.2.0

In return, it should be an easy change to add a python_requires parameter to the setup call inside the setup.py.

To reproduce

Just build the following docker file:

FROM python:3.8.13-slim

RUN python -m pip install --upgrade pip==22.1
RUN python -m pip install sagemaker_inference

It will install just fine without any issues, albeit sagemaker_inference has never been tested against 3.8.

Expected behavior

Installers like pip, poetry etc. should reject to install the sagemaker_inference package against a python version the toolkit has never been tested against.

Screenshots or logs

docker build logs (docker build -t foo .):

Sending build context to Docker daemon  46.08kB
Step 1/3 : FROM python:3.8.13-slim
 ---> 09d1a78893d5
Step 2/3 : RUN python -m pip install --upgrade pip==22.1
 ---> Running in 47ec102cfcfb
Collecting pip==22.1
  Downloading pip-22.1-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 4.4 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.0.4
    Uninstalling pip-22.0.4:
      Successfully uninstalled pip-22.0.4
Successfully installed pip-22.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container 47ec102cfcfb
 ---> f582073bb4b0
Step 3/3 : RUN python -m pip install sagemaker_inference
 ---> Running in f0f9f41b53a4
Collecting sagemaker_inference
  Downloading sagemaker_inference-1.6.1.tar.gz (21 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting numpy
  Downloading numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.8/16.8 MB 5.7 MB/s eta 0:00:00
Collecting six
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting psutil
  Downloading psutil-5.9.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (283 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 283.8/283.8 kB 4.6 MB/s eta 0:00:00
Collecting retrying==1.3.3
  Downloading retrying-1.3.3.tar.gz (10 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting scipy
  Downloading scipy-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (41.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.6/41.6 MB 7.5 MB/s eta 0:00:00
Building wheels for collected packages: sagemaker_inference, retrying
  Building wheel for sagemaker_inference (setup.py): started
  Building wheel for sagemaker_inference (setup.py): finished with status 'done'
  Created wheel for sagemaker_inference: filename=sagemaker_inference-1.6.1-py2.py3-none-any.whl size=27836 sha256=0617626f9f56cba60d256217b6a83421bb221c19646f5b3a540cb23816be4c03
  Stored in directory: /root/.cache/pip/wheels/47/27/bf/37ef3641057c337d5d7116f8b8ce87be599608a70c571115c8
  Building wheel for retrying (setup.py): started
  Building wheel for retrying (setup.py): finished with status 'done'
  Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=11447 sha256=38dbee0dcb07c7f2a723b1659fe06481fc6b97b63378889acdd141eeffebd6fa
  Stored in directory: /root/.cache/pip/wheels/c4/a7/48/0a434133f6d56e878ca511c0e6c38326907c0792f67b476e56
Successfully built sagemaker_inference retrying
Installing collected packages: six, psutil, numpy, scipy, retrying, sagemaker_inference
Successfully installed numpy-1.22.3 psutil-5.9.0 retrying-1.3.3 sagemaker_inference-1.6.1 scipy-1.8.0 six-1.16.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container f0f9f41b53a4
 ---> 6e235e79ade8
Successfully built 6e235e79ade8
Successfully tagged foo:latest

System information

None

Additional context

None

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

1 participant