skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.39k stars 209 forks source link

Add skyfield to pyinstaller-hooks-contrib #830

Closed pllim closed 1 year ago

pllim commented 1 year ago

Hello! Currently, astropy has this file so it can deploy on pyinstaller.

https://github.com/astropy/astropy/blob/main/.pyinstaller/hooks/hook-skyfield.py

# NOTE: this hook should be added to
# https://github.com/pyinstaller/pyinstaller-hooks-contrib
# once that repository is ready for pull requests
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files("skyfield")

Now that https://github.com/pyinstaller/pyinstaller-hooks-contrib appears to be taking contributions, are skyfield developers interested to submit hook for skyfield to that repo? Thanks!

brandon-rhodes commented 1 year ago

Interesting—I didn't know that AstroPy was used in projects that produce binary executables with PyInstaller. I remember, about ten years ago, trying out several of the tools for bundling Python applications as Windows EXE files, but I haven't worked with any of the tools like PyInstaller since then.

I don't know if I myself will have time in the near term to learn how to write and submit code to PyInstaller, and none of my own projects at the moment happen to need it. Maybe someone else, already familiar with their project, could submit the change?

Do you know what they build using PyInstaller, that requires Skyfield? Skyfield doesn't appear to be a dependency of AstroPy itself, so that can't be the reason. Do they maybe do performance or regression testing on different platforms using a built binary? I've heard that they sometimes compare results with other astronomy libraries.

pllim commented 1 year ago

Thanks for the quick response! @astrofrog originally added that hook in astropy in https://github.com/astropy/astropy/pull/8795 , so hopefully he can clarify.

brandon-rhodes commented 1 year ago

It looks like it does build a binary to run all of AstroPy's tests, and so Skyfield needs to be included. (I wonder why they run Skyfield over and over in their tests, giving the same answers every time, instead of just pasting Skyfield's output coordinates into the tests to compare against?)

I wonder why PyInstaller doesn't collect data files by default, since Python packages generally assume their presence.

brandon-rhodes commented 1 year ago

As none of the other Skyfield contributors have responded in the past couple of months, I'm going to conclude that none of us who contribute to Skyfield are currently interested in contributing to PyInstaller—we all have other commitments, alas. Either the PyInstaller community, or the AstroPy community, are welcome to contribute your install-hook on Skyfield's behalf if you have the time or inclination. Thanks for asking! And hopefully this issue will be found in the future by anyone trying to get things working with PyInstaller.