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

PR: Add scripts and files necessary to create a macOS installer #13992

Merged
merged 16 commits into from
Oct 23, 2020

Conversation

mrclary
Copy link
Contributor

@mrclary mrclary commented Oct 16, 2020

Description of Changes

Added files for creating Spyder.app macOS standalone application.

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Included the necessary resources to build a standalone macOS application.
See spyder-ide/mac-application#3

Issue(s) Resolved

Fixes #13978

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:
mrclary

@pep8speaks
Copy link

pep8speaks commented Oct 16, 2020

Hello @mrclary! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 245:1: W293 blank line contains whitespace

Comment last updated at 2020-10-23 04:34:03 UTC

@mrclary mrclary changed the title * initial migration of mrclary/mac-application Migrate mac-application to this repo Oct 16, 2020
@mrclary mrclary changed the title Migrate mac-application to this repo WIP: Migrate mac-application to this repo Oct 16, 2020
@mrclary
Copy link
Contributor Author

mrclary commented Oct 16, 2020

Requires #12236 to be merged.

@ccordoba12 ccordoba12 added this to the v4.2.0 milestone Oct 16, 2020
@mrclary mrclary changed the base branch from master to 4.x October 16, 2020 16:06
@mrclary mrclary changed the title WIP: Migrate mac-application to this repo Migrate mac-application to this repo Oct 16, 2020
@ccordoba12 ccordoba12 changed the title Migrate mac-application to this repo PR: Add scripts and files necessary to create a macOS installer Oct 16, 2020
@mrclary
Copy link
Contributor Author

mrclary commented Oct 16, 2020

@ccordoba12, we should be good to incorporate into github actions, though I don't have any experience there...

@ccordoba12
Copy link
Member

@ccordoba12, we should be good to incorporate into github actions

Great! Please rebase to get the fix to our tests that was added by @dalthviz for the Windows installer in PR #13269.

though I don't have any experience there...

@dalthviz and I can give you a hand with that. Could you describe the steps necessary to build the dmg?

@dalthviz
Copy link
Member

@mrclary for the Github Action to build the installer maybe checking the workflow definition for the windows installer could useful. You can check it here: https://github.com/spyder-ide/spyder/blob/4.x/.github/workflows/installer-win.yml

Basically the workflow defines a series of the events that trigger the workflow (for example a pull request, a release, etc), then the environment where the workflow will run (OS, env variables, etc) and finally a series of steps (to install python, install dependencies, run a custom script, upload artifacts, etc).

Probably you can use the windows installer workflow to create a similar workflow for macOS but let us know if you have any question and we will check 👍

@mrclary
Copy link
Contributor Author

mrclary commented Oct 17, 2020

@ccordoba12 @dalthviz ,
Okay, here is a first crack at it. Is there a way to test it?

@mrclary
Copy link
Contributor Author

mrclary commented Oct 17, 2020

It seems to have trouble installing dependencies...

@ccordoba12
Copy link
Member

ccordoba12 commented Oct 18, 2020

There seems to be a syntax error in one of your scripts:

File "setup.py", line 161
    _py_ver = f'python{py_ver[0]}.{py_ver[1]}'
                                             ^
SyntaxError: invalid syntax

@mrclary
Copy link
Contributor Author

mrclary commented Oct 18, 2020

There seems to be syntax error in one of your scripts:

File "setup.py", line 161
    _py_ver = f'python{py_ver[0]}.{py_ver[1]}'
                                             ^
SyntaxError: invalid syntax

I saw that, but it did not make sense because the script runs fine on my local machine. It looks suspiciously like Python 2.7 is being referenced. I think it may be related to the errors in the previous "Install dependencies" step.

ERROR: Could not find a version that satisfies the requirement pyqt5<5.13 (from spyder==4.2.0.dev0) (from versions: none)
ERROR: No matching distribution found for pyqt5<5.13 (from spyder==4.2.0.dev0)
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Skipping spyder as it is not installed.

Why can't it resolve pyqt5 requirement? Why is here a Python 2.7 deprecation?

@mrclary
Copy link
Contributor Author

mrclary commented Oct 18, 2020

Okay, found the issue. As I suspected, python and pip are referencing 2.7 versions. I'll have to use pip3 and python3 commands.

@mrclary
Copy link
Contributor Author

mrclary commented Oct 18, 2020

Success! Sort of...
It seems that the only issue left is that Python 3.8.5 was used for the build but Python 3.7.9 was installed for the Github action. How does that work? Maybe it was just a cache issue with cancelling/restarting in the middle of the job? Hmm...

But I have confirmed that the application works as expected from the downloaded artifact. :-)

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @mrclary! This looks pretty good!

.github/workflows/installer-macos.yml Outdated Show resolved Hide resolved
installers/macOS/Readme.md Show resolved Hide resolved
installers/macOS/Readme.md Show resolved Hide resolved
installers/macOS/Readme.md Show resolved Hide resolved
installers/macOS/Readme.md Show resolved Hide resolved
installers/macOS/Readme.md Outdated Show resolved Hide resolved
installers/macOS/dmg_settings.py Outdated Show resolved Hide resolved
installers/macOS/setup.py Outdated Show resolved Hide resolved
installers/macOS/setup.py Outdated Show resolved Hide resolved
installers/macOS/setup.py Outdated Show resolved Hide resolved
@mrclary mrclary force-pushed the macos-app branch 5 times, most recently from 3b4142c to df95bd6 Compare October 20, 2020 00:36
@mrclary
Copy link
Contributor Author

mrclary commented Oct 20, 2020

@ccordoba12, I think this is ready now.

@steff456
Copy link
Member

Hi @mrclary!

I just tried the full installer and found a couple of things that are not working as expected,

  1. The autocompletion engine is not working
  2. Spyder opens in a project I didn't create, and the temp file is outside that project. I'm not sure if we want to start spyder on a "new" project
    image
  3. I have this traceback in the ipython console:
    image

@ccordoba12
Copy link
Member

I have this traceback in the ipython console:

This should be solved by adding Pillow to the app.

@steff456
Copy link
Member

The Spyder-lite installer is working perfectly 🎉

@mrclary
Copy link
Contributor Author

mrclary commented Oct 22, 2020

@steff456, thanks for the feedback.
Yeah, I noticed that Spyder starts up with a bogus project. I just deleted it from the Projects menu; it seems to happen only the first time Spyder starts up and doesn't return. I don't know why that is or how to reproduce it. I suspect that if I reset spyder preferences that wouldn't happen, but I'm not sure.

Can you tell me the following?

  1. Are you using the "Lite" version or the "Full", i.e. from Spyder-Lite.dmg or Spyder.dmg?
  2. Are you using the "Same as Spyder" interpreter or an external one? If external, can you provide a list of installed packages?

@ccordoba12, I'll check on including Pillow with the full version.

@steff456
Copy link
Member

The errors I found appeared when using the "full" version dmg, the spyder-lite.dmg is working as a charm 🤩. I reset my Spyder configuration before running the installed spyder, so the changes I've been working on doesn't affect the behavior of the installer. So, everything is running with the default interpreter.

@ccordoba12
Copy link
Member

The autocompletion engine is not working

I think this is also failing because Pillow is not part of the installer. That's because the PyLS imports several modules during initialization to speed up completions. But if some of them fail to be imported, the server dies completely.

That error was fixed by @dalthviz in palantir/python-language-server#873. I'll update our subrepo with it.

Spyder opens in a project I didn't create

This is worrisome. I'll try to give you a hand with that problem during the weekend.

Ryan Clary added 16 commits October 22, 2020 20:12
* modify setup.py to accommdate github action
* don't bother with setup-python since we can only use default Python for now
* revise task names
* attempt to bypass DMGError('Unable to detach device cleanly'). Note: the dmg is always detached, even if by force.
I don't know why this is occurring. It seemed that using '-l' bash flag in installer-macos.yml avoided this error, but apparently it is intermittent. What are the consequences of a forced detach? Is there a process that hasn't completed, preventing a clean detach?
* simplify command line parsing
* distribution directory is now input
@mrclary
Copy link
Contributor Author

mrclary commented Oct 23, 2020

@steff456 @ccordoba12, the latest commit should fix the issue with PIL. I did not see any completion issues, though. Screen shot of a local build shows from PIL import Image and command completion of math.. Please check that the artifact from my last commit gives you the same result.

FYI, on this local build, when first launching, I did not get a bogus project. I think it may be related to related to launching a newly downloaded Spyder application for the first time (you know how you get the warning message about an unknown developer). It does not seem to be related to whether Spyder had an open project on the last session.

Screen Shot 2020-10-22 at 9 29 03 PM

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @mrclary for your contribution!

@juanis2112 tested the full installer generated by your last commit and found the issues reported by @steff456 are fixed now.

@ccordoba12 ccordoba12 merged commit f375fef into spyder-ide:4.x Oct 23, 2020
ccordoba12 added a commit that referenced this pull request Oct 23, 2020
@mrclary mrclary deleted the macos-app branch October 23, 2020 22:39
@mrclary
Copy link
Contributor Author

mrclary commented Oct 23, 2020

Thanks to all the core developers for their feedback! I'm glad I could contribute.

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

Successfully merging this pull request may close these issues.

Migrate mac-application repo to spyder repo
5 participants