telegraphic / pygdsm

Python interface to Global Diffuse Sky Models (GDSM) for the radio sky between 10 MHz - 5 THz
MIT License
30 stars 7 forks source link

Fix PyPi Distribution Files #20

Closed David-McKenna closed 8 months ago

David-McKenna commented 8 months ago

Hey Danny,

While the README does mention the intent that you should install the module from the git repo, I blindly tried to install it from pypi today and found that the install was broken, causing a FileNotFound error during the build as the setup.py file needs the requirements*.txt files to be present, but they weren't being copied to the distribution tar:

❯ pip install pygdsm
Collecting pygdsm
  Using cached pygdsm-1.5.1.tar.gz (20 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/8d/w_118rx95_74qx_pgrx679pw0000gp/T/pip-install-rogx4dy6/pygdsm_d5cbdaef9e2e4fa2a51b60049c174cf6/setup.py", line 16, in <module>
          with open("requirements.txt", 'r') as fh:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen codecs>", line 918, in open
      FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

This MR simply includes those files by adding a MANIFEST.in file (tried using data_files and package_data kwargs in the setup() call to no avail), and bumps the version so that the fix is ready to be uploaded after a tag.

I tested this on a fork that I pushed to the testpypi instance, you can verify that the fix has worked on a clean python install using that distribution if you wish (https://test.pypi.org/project/debug-dpypi-pygdsm/), though you may need to pre-install setuptools via pip (failed otherwise for me as there isn't an upload of setuptools on testpypi): pip install -i https://test.pypi.org/simple/ debug-dpypi-pygdsm

Cheers, David

what-the-diff[bot] commented 8 months ago

PR Summary

telegraphic commented 8 months ago

Thanks for this too -- I should update the README