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

[BUG] Setuptools 58+ breaks prospector #438

Closed
jorgenader opened this issue Sep 6, 2021 · 8 comments
Closed

[BUG] Setuptools 58+ breaks prospector #438

jorgenader opened this issue Sep 6, 2021 · 8 comments

Comments

@jorgenader
Copy link

jorgenader commented Sep 6, 2021

Describe the bug
Install latest setuptools. It seems automatic 2to3 has been removed which breaks setoptconf internally.

Related issue: pypa/setuptools#2086

As a workaround one can pin setuptools to 57.* mean while.

To Reproduce
Steps to reproduce the behavior:

  1. Call prospector with any options
Traceback (most recent call last):
  File "/usr/local/bin/prospector", line 5, in <module>
    from prospector.run import main
  File "/usr/local/lib/python3.8/site-packages/prospector/run.py", line 9, in <module>
    from prospector.config import ProspectorConfig
  File "/usr/local/lib/python3.8/site-packages/prospector/config/__init__.py", line 9, in <module>
    from prospector.config import configuration as cfg
  File "/usr/local/lib/python3.8/site-packages/prospector/config/configuration.py", line 3, in <module>
    import setoptconf as soc
  File "/usr/local/lib/python3.8/site-packages/setoptconf/__init__.py", line 4, in <module>
    from .config import *
  File "/usr/local/lib/python3.8/site-packages/setoptconf/config.py", line 2, in <module>
    from .util import UnicodeMixin
  File "/usr/local/lib/python3.8/site-packages/setoptconf/util.py", line 2, in <module>
    import StringIO
ModuleNotFoundError: No module named 'StringIO'

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Linux
  • Tool Any
  • Prospector version: 1.2.0+
  • Python version 3.6+

Additional context

@shaggyz
Copy link

shaggyz commented Sep 7, 2021

We solved it hardcoding setuptools==57.0.0 in our requirements file. It would be nice to change it since, eventually, this will be a bigger problem.

@carlio
Copy link
Member

carlio commented Sep 7, 2021

Bleh, this is going to be a pain. setoptconf hasn't been changed for 8 years!

Having said that I was considering removing it anyway but it'll take a while. Unfortunately for now, setuptools==57 as a workaround will have to do until I can do a proper fix :(

@pmav99
Copy link

pmav99 commented Sep 7, 2021

Hardcoding might cause problems to users. If there is a different dependency that requires setuptools > 57 then the dependency solvers (e.g. poetry) will start complaining.

Since setoptconf is not maintained , how about running 2to3 on it, upload it to pypi under a different name (e.g. setoptconf3) and depend on that instead? Would that solve the issue? We could make clear that setoptconf3 is not really maintained and that people should avoid it. This should give time enough time to remove it without any real pressure

@Pierre-Sassoulas
Copy link
Collaborator

I think the temporary hard coding should be setuptools<=57.0.0 for more flexibility with other packages.

@svenvanderburg
Copy link

This is breakout our CI pipeline in an indirect and hard to debug way, so I share this here:

During installation of prospector with the newest setuptools version I get:

 error in setoptconf setup command: use_2to3 is invalid.

This results in pip installing prospector==0.5.0, then when running prospector I get:

ImportError: cannot import name 'DEFAULT_CONFIG' from 'pep8' (/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/site-packages/pep8.py)

It would be great if this can be fixed properly!

carlio pushed a commit that referenced this issue Sep 8, 2021
… fork which is compatible with setuptools 58 and also fixes compatibility with python 3.6+ (and drops <3.6)
@carlio
Copy link
Member

carlio commented Sep 8, 2021

I have just released version 1.5.1b0. It's a pre-release so you'll need to add whatever flags to your install scripts to get it like pip install --pre .

I made a new package - https://github.com/carlio/setoptconf-tmp - which is just setoptconf but fixes compatibility with setuptools>=58 and also removes some unnecessary backwards-compatible code: it was supporting python versions 2.7-3.3 but now only 3.6+ :-)

If any of you could test that this pre-release version of prospector works in your CI pipeline, I will promote it to being a real release.

Thanks @pmav99 for the suggestion of the temporary setoptconf version. I'll get on with replacing it separately.

@MalteOlle
Copy link

Thanks @carlio ! I tested using 1.5.1b0, which uses your setoptconf-tmp and it solved the issue for my github CI for this project

@carlio
Copy link
Member

carlio commented Sep 17, 2021

Ok, I promoted it to a full release (1.5.1 is now on PyPI) so hopefully this fixes everything :)

if not I'm sure I'll be told soon enough...

@carlio carlio closed this as completed Sep 17, 2021
bansan85 added a commit to bansan85/jessica that referenced this issue Nov 13, 2021
+ fix requirements-linter.txt
landscapeio/prospector#438
bansan85 added a commit to bansan85/jessica that referenced this issue Nov 13, 2021
+ fix requirements-linter.txt
landscapeio/prospector#438
bansan85 added a commit to bansan85/jessica that referenced this issue Nov 13, 2021
+ fix requirements-linter.txt
landscapeio/prospector#438
ThorgateDeveloper pushed a commit to thorgate/django-project-template that referenced this issue Oct 27, 2022
- Remove setuptools version pinning as the prospector issue has been fixed:
  - landscapeio/prospector#438
- Fix webapp prod build on alpine
IncrePrior added a commit to IncrePrior/django-project-template that referenced this issue Nov 12, 2023
- Remove setuptools version pinning as the prospector issue has been fixed:
  - landscapeio/prospector#438
- Fix webapp prod build on alpine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants