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

Incorrect requirement metadata in sdist package of flake8 #592

Closed
asottile opened this issue Apr 3, 2021 · 8 comments
Closed

Incorrect requirement metadata in sdist package of flake8 #592

asottile opened this issue Apr 3, 2021 · 8 comments

Comments

@asottile
Copy link
Member

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jun 19, 2017, 19:59

Please describe how you installed Flake8

Using a fresh virtualenv in ./venv directory:

$ ./venv/bin/pip install --no-binary :all: --download ./cache --index-url https://pypi.python.org/simple flake8==3.3.0

Please provide the exact, unmodified output of flake8 --bug-report

$ ./venv/bin/flake8 --bug-report
{
  "dependencies": [
    {
      "dependency": "setuptools",
      "version": "33.1.1"
    }
  ],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "2.7.13",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.3.1"
    },
    {
      "plugin": "pyflakes",
      "version": "1.5.0"
    }
  ],
  "version": "3.3.0"
}

Please describe the problem or feature

The dependencies necessary for Python 2 use of flake8 are missing: configparser and enum34.

If this is a bug report, please explain with examples (and example code) what you expected to happen and what actually happened.

Download flake8-3.3.0.tar.gz released on pypi.python.org.

The src/flake8.egg-info/require.txt metadata in the sdist package of flake8 has this info:

pyflakes >= 1.5.0, < 1.6.0
pycodestyle >= 2.0.0, < 2.4.0
mccabe >= 0.6.0, < 0.7.0

It should contain instead:

pyflakes >= 1.5.0, < 1.6.0
pycodestyle >= 2.0.0, < 2.4.0
mccabe >= 0.6.0, < 0.7.0

[:python_version<'3.2']
configparser

[:python_version<'3.4']
enum34

This happened because the setup.py uses conditional code, such as this:

if sys.version_info < (3, 4):
    requires.append("enum34")

If the sdist is built with Python 3, these conditions are skipped and the dependencies are not recorded in the package metadata at all. If the package were built with Python 2, the dependencies would have been recorded because the conditions would have been satisfied.

However, a better approach is to use extras_require to ensure the correct metadata is saved in the sdist regardless of the Python version used.

The correct metadata is crucial for build systems that need sdist to re-build packages (wheels) for the internal use in the environment guaranteed to be the same as the one where they will be deployed.

I prepared RB and will refer to this issue in it.

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jun 19, 2017, 20:01

mentioned in commit zvezdan/flake8@d8ab148b881f4e309474b9c1a84fae7f0fd807be

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jun 19, 2017, 20:03

mentioned in merge request !191

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jun 19, 2017, 20:07

The merge request was sent (!191).
It would be nice if we can make a release with this fix (3.3.1) so that we can use the updated version.

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jun 20, 2017, 02:42

mentioned in commit zvezdan/flake8@4b3c4f41bbceabbd8b2d1661772903cbc06c2bb5

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jun 23, 2017, 20:30

@sigmavirus24 I forgot to mention that I did test that the package gets released with correct metadata after the patch in !191 is applied.

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jul 10, 2017, 18:15

mentioned in commit zvezdan/flake8@8c5b1093631358d81b7b53cc23f9a4e353fe31e5

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @zvezdan on Jul 10, 2017, 18:23

mentioned in commit zvezdan/flake8@a7068ad374b01c3a6040d3f1e3f5ae4bde494e27

@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @sigmavirus24 on Jul 27, 2017, 16:49

closed

@asottile asottile closed this as completed Apr 3, 2021
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