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

Explicitly exclude unnecessary files in source distributions #999

Merged
merged 6 commits into from
Mar 5, 2021
Merged

Conversation

seisman
Copy link
Member

@seisman seisman commented Mar 4, 2021

Description of proposed changes

In #695, we switched our version manager from versioneer to setuptools-scm.

When building source distributions (sdist), the default behavior was only including files as listed in Python packaging guide. However, setuptools_scm's behavior is to include all files tracked by git (see https://github.com/pypa/setuptools_scm#file-finders-hook-makes-most-of-manifestin-unnecessary), and it seems there is no way to disable it (pypa/setuptools-scm#516).

So, instead of listing files that should be included in the source distributions, now we need to explicitly exclude some files from the source distributions.

Here is the list of files in pygmt v0.2.1 (https://pypi.org/project/pygmt/0.2.1/#files):

AUTHORS.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE.txt
MANIFEST.in
PKG-INFO
README.rst
pygmt
pygmt.egg-info
setup.cfg
setup.py
versioneer.py

Here is the list of files using the MANIFEST.in file in this PR:

AUTHORS.md
CODE_OF_CONDUCT.md
LICENSE.txt
MANIFEST.in
PKG-INFO
README.rst
pygmt
pygmt.egg-info
pyproject.toml
setup.cfg
setup.py

You can run python setup.py sdist to build source distributions and check the tarball in the dist directory.

Fixes #904.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman added this to the 0.3.1 milestone Mar 4, 2021
@seisman seisman added the maintenance Boring but important stuff for the core devs label Mar 4, 2021
MANIFEST.in Show resolved Hide resolved
@seisman seisman marked this pull request as ready for review March 4, 2021 03:40
@seisman seisman requested a review from a team March 4, 2021 03:40
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Looks good. Really wish we could leave out the pygmt/tests/baseline folder full of PNGs to trim down on the package size, but that will come after resolving #963.

@seisman
Copy link
Member Author

seisman commented Mar 5, 2021

FYI, the tarball size can be reduced from 6.2 MB to 600 K if we can remove all baseline images. 😄

@seisman seisman merged commit 5846e88 into master Mar 5, 2021
@seisman seisman deleted the sdist branch March 5, 2021 02:15
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…MappingTools#999)

Running `python setup.py sdist` can generate source distributions.

When packaging, setuptools_scm includes all files tracked by git.

This PR explicitly excludes unnecessary files and directories 
from the source distributions.

Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecessary files in the source distribution?
2 participants