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

Fix PyPi Distribution Files #20

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

David-McKenna
Copy link
Contributor

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

Copy link

what-the-diff bot commented Apr 3, 2024

PR Summary

  • Introduction of "MANIFEST.in" file
    This PR introduces a new file named "MANIFEST.in". This file is essential for better packaging of the project as it includes references to "requirements*.txt" files. These files contain necessary software dependencies our project requires to work correctly.

  • Update in Project's Version
    The version of the project specified in the "setup.py" file has been updated from 1.5.1 to 1.5.2. This means that there is a minor improvement or bugfix in the project functionality which is deemed important but not significant enough to increment the second digit.

@telegraphic
Copy link
Owner

Thanks for this too -- I should update the README

@telegraphic telegraphic merged commit 20be97f into telegraphic:master Apr 3, 2024
1 check passed
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.

None yet

2 participants