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

Spyder.app fails with setuptools 61.0.0 #414

Closed
mrclary opened this issue Mar 25, 2022 · 13 comments
Closed

Spyder.app fails with setuptools 61.0.0 #414

mrclary opened this issue Mar 25, 2022 · 13 comments

Comments

@mrclary
Copy link

mrclary commented Mar 25, 2022

The latest release of setuptools 61.0.0 breaks the app bundle for Spyder .
See spyder-ide/spyder#17551.

Bundle creation works for setuptools 60.10.0

The observed symptoms are:

  • The application bundle is named "spyder.app" rather than "Spyder.app". Not sure why the case is not respected...
  • The application startup script is named "spyder.app/Contents/MacOS/spyder" rather than "Spyder.app/Contents/MacOS/Spyder". Again, not sure why the case is not respected...
  • For the application bundle, the spyder source code should be included outside the zip (using the packages directive), however now it is included in the zip directory as well (two locations).
@ronaldoussoren
Copy link
Owner

Hmmm, that's weird.

While debugging another problem using a venv containing the Spyder dependencies I noticed that the resulting app contains a lot of code that shouldn't have been included, that might explain the last item on your list. I haven't debugged yet why this happens.

@ronaldoussoren
Copy link
Owner

The issue I mentioned earlier is likely unrelated, the problem there is that PIL by way of numpy pulls in a lot of dependencies when those are present. That's not a problem for Spyder because it actually uses those dependencies.

@ronaldoussoren
Copy link
Owner

I fixed a related issue in the repository, the Qt5 recipe resulted in a duplicate copy of parts of PyQ5 when using the wheel on PyPI.

I haven't checked yet how this fix affects Spyder.

@ronaldoussoren
Copy link
Owner

A workaround for the lowercase name of the app is to include a name argument in the call to setup(), that is:

        setup(name="Spyder", app=[app_script_path.as_posix()], options={'py2app': OPTIONS})

For some reason in setuptools 61.0 the distutils.dist.Distribution name gets set to a value, even though the setup.py file does not contain a name. Setuptools 60.0 works as expected by py2app. Because of this change the default calculation of the app name based on the name of the script never kicks in, resulting in an incorrect name.

This is an explicit change in setuptools: pypa/setuptools#2894, which is one of the changes in setuptools 61.0.

This is something I cannot work around in py2app, by the time my code gets run the damage is already done.

A workaround for this: add an empty py_modules argument to the call to setup: setup(py_modules=[], ...). This will disable the autodiscovery code in setuptools (for now).

@mrclary
Copy link
Author

mrclary commented Apr 4, 2022

I'll give those a try and report back.

@ronaldoussoren
Copy link
Owner

I've filed pypa/setuptools#3248 about the auto discovery problem.

@mrclary
Copy link
Author

mrclary commented Apr 5, 2022

Using name= and py_modules= worked as you suggested for setuptools>60.10.0 including 62.0.0.

ronaldoussoren added a commit that referenced this issue Apr 7, 2022
This introduces a ``setuptools.finalize_distribution_options``
that sets the *name* and *py_modules* attributes of the
distribution in a way that is compatible with py2app's regular
calculation of these attributes.

This avoid problems with setuptools 61.0.0 or later that
use autodiscovery to set these attributes to values that may
not be compatible with py2app.

Issue #414
@ronaldoussoren
Copy link
Owner

The next release of py2app should work out of the box with these versions of setuptools.

@ronaldoussoren
Copy link
Owner

@mrclary Is the problem with duplication of code in the generated app bundle still present?

@mrclary
Copy link
Author

mrclary commented Apr 7, 2022

I'll verify, standby...

@ronaldoussoren
Copy link
Owner

On my machine the app bundle looks correct, no duplicate spider.

BTW. The Readme.md in installers/macOS appears to be out of date. The instruction for installing dependencies contains:

pip install -r req-build.txt -r req-extras.txt -c req-const.txt -e ../../

req-const.txt is not in the repository, but there are two other requirement files that appear to be required.

@mrclary
Copy link
Author

mrclary commented Apr 7, 2022

Looks good on my local machine as well. It works even without py_modules specified.

BTW. The Readme.md in installers/macOS appears to be out of date

Indeed. Thanks for reminding me 😄 .

@ronaldoussoren
Copy link
Owner

Great. I'll push out a new release over the weekend.

Specifying py_modules or name should no longer be necessary, I'm using a setuptools entrypoint to do this automatically.

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