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

Exclude test files from source/binary distributions #2956

Closed
seisman opened this issue Jan 5, 2024 · 6 comments · Fixed by #2957
Closed

Exclude test files from source/binary distributions #2956

seisman opened this issue Jan 5, 2024 · 6 comments · Fixed by #2957
Labels
maintenance Boring but important stuff for the core devs
Milestone

Comments

@seisman
Copy link
Member

seisman commented Jan 5, 2024

Running make package can create source and binary distributions. Here are the files/directories included in the source tarball:

$ tree -L 2
.
├── AUTHORSHIP.md
├── AUTHORS.md
├── CITATION.cff
├── CODE_OF_CONDUCT.md
├── LICENSE.txt
├── MANIFEST.in
├── PKG-INFO
├── pygmt
│   ├── accessors.py
│   ├── clib
│   ├── datasets
│   ├── exceptions.py
│   ├── figure.py
│   ├── helpers
│   ├── __init__.py
│   ├── io.py
│   ├── session_management.py
│   ├── sphinx_gallery.py
│   ├── src
│   └── tests
├── pygmt.egg-info
│   ├── dependency_links.txt
│   ├── PKG-INFO
│   ├── requires.txt
│   ├── SOURCES.txt
│   └── top_level.txt
├── pyproject.toml
├── README.rst
└── setup.cfg

8 directories, 22 files
  1. AUTHORSHIP.md is excluded in MANIFEST.in. Why is it still here?
  2. Exclude CODE_OF_CONDUCT.md from the tarball?
  3. Exclude the whole pygmt/tests directory? The reasons are (1): tests are 536 KB and others are 900 KB. (2) Users can't run these tests due to the missing DVC files.
@seisman seisman added maintenance Boring but important stuff for the core devs discussions Need more discussion before taking further actions labels Jan 5, 2024
@weiji14
Copy link
Member

weiji14 commented Jan 6, 2024

AUTHORSHIP.md is excluded in MANIFEST.in. Why is it still here?

Might be a case of pypa/setuptools#3260? We switched from setup.py to pyproject.toml in #1848 around Aug 2022, but most of the 'exclude' lines in MANIFEST.in was last modified in #999 around Mar 2021, and we might not have checked things properly. I tried for a bit with some settings, but couldn't figure out how to exclude those files...

@weiji14
Copy link
Member

weiji14 commented Jan 6, 2024

Yeah, I just tried downloading the sdist tar.gz files for PyGMT, and v0.4.1 (released 7 Aug 2021) was the last time when AUTHORSHIP.md was excluded. All the releases from v0.5.0 (released 29 Oct 2021) onwards to v0.10.0 contain AUTHORSHIP.md 😅 Might not be a setup.py/pyproject.toml thing, but some setuptools bug.

@seisman
Copy link
Member Author

seisman commented Jan 6, 2024

It's likely that AUTHORSHIP.md is a special name and is always included:

make package
python -m build
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=64, setuptools_scm[toml]>=6.2)
* Getting dependencies for sdist...
running egg_info
writing pygmt.egg-info/PKG-INFO
writing dependency_links to pygmt.egg-info/dependency_links.txt
writing requirements to pygmt.egg-info/requires.txt
writing top-level names to pygmt.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.txt'
adding license file 'AUTHORS.md'
adding license file 'AUTHORSHIP.md'
writing manifest file 'pygmt.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing pygmt.egg-info/PKG-INFO
writing dependency_links to pygmt.egg-info/dependency_links.txt
writing requirements to pygmt.egg-info/requires.txt
writing top-level names to pygmt.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.txt'
adding license file 'AUTHORS.md'
adding license file 'AUTHORSHIP.md'
writing manifest file 'pygmt.egg-info/SOURCES.txt'
running check
creating pygmt-0.10.1.dev203+g24e032439
creating pygmt-0.10.1.dev203+g24e032439/pygmt
creating pygmt-0.10.1.dev203+g24e032439/pygmt.egg-info
creating pygmt-0.10.1.dev203+g24e032439/pygmt/clib
creating pygmt-0.10.1.dev203+g24e032439/pygmt/datasets
creating pygmt-0.10.1.dev203+g24e032439/pygmt/helpers
creating pygmt-0.10.1.dev203+g24e032439/pygmt/src
creating pygmt-0.10.1.dev203+g24e032439/pygmt/tests
creating pygmt-0.10.1.dev203+g24e032439/pygmt/tests/data
copying files to pygmt-0.10.1.dev203+g24e032439...
copying AUTHORS.md -> pygmt-0.10.1.dev203+g24e032439
copying AUTHORSHIP.md -> pygmt-0.10.1.dev203+g24e032439
copying CITATION.cff -> pygmt-0.10.1.dev203+g24e032439
copying CODE_OF_CONDUCT.md -> pygmt-0.10.1.dev203+g24e032439
...

@seisman
Copy link
Member Author

seisman commented Jan 6, 2024

Making following changes to MANIFEST.in:

diff --git a/MANIFEST.in b/MANIFEST.in
index 88e203e94..da8835b2c 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,12 +3,13 @@ prune .github*
 prune ci
 prune doc*
 prune examples*
+prune pygmt/tests*
 exclude .dvcignore
 exclude .gitignore
 exclude .readthedocs.yaml
 exclude AUTHORSHIP.md
+exclude CODE_OF_CONDUCT.md
 exclude CONTRIBUTING.md
 exclude Makefile
 exclude environment.yml
 exclude requirements.txt
-exclude pygmt/tests/baseline/*.dvc

Then the source tarball contains following files/directories:

tree -a -L 2
.
├── AUTHORS.md
├── AUTHORSHIP.md
├── CITATION.cff
├── LICENSE.txt
├── MANIFEST.in
├── PKG-INFO
├── README.rst
├── pygmt
│   ├── __init__.py
│   ├── accessors.py
│   ├── clib
│   ├── datasets
│   ├── exceptions.py
│   ├── figure.py
│   ├── helpers
│   ├── io.py
│   ├── session_management.py
│   ├── sphinx_gallery.py
│   └── src
├── pygmt.egg-info
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   ├── dependency_links.txt
│   ├── requires.txt
│   └── top_level.txt
├── pyproject.toml
└── setup.cfg

The new source tarball is 178 KB, compared to 244 KB for the old source tarball.

@seisman
Copy link
Member Author

seisman commented Jan 6, 2024

AUTHORSHIP.md is excluded in MANIFEST.in. Why is it still here?

Might be a case of pypa/setuptools#3260? We switched from setup.py to pyproject.toml in #1848 around Aug 2022, but most of the 'exclude' lines in MANIFEST.in was last modified in #999 around Mar 2021, and we might not have checked things properly. I tried for a bit with some settings, but couldn't figure out how to exclude those files...

Likely related to https://github.com/pypa/setuptools/blob/85fd45b7d10441f006cbbdee2b718aa741db5246/NEWS.rst#breaking-changes-12.

@weiji14
Copy link
Member

weiji14 commented Jan 6, 2024

AUTHORSHIP.md is excluded in MANIFEST.in. Why is it still here?

Might be a case of pypa/setuptools#3260? We switched from setup.py to pyproject.toml in #1848 around Aug 2022, but most of the 'exclude' lines in MANIFEST.in was last modified in #999 around Mar 2021, and we might not have checked things properly. I tried for a bit with some settings, but couldn't figure out how to exclude those files...

Likely related to https://github.com/pypa/setuptools/blob/85fd45b7d10441f006cbbdee2b718aa741db5246/NEWS.rst#breaking-changes-12.

Ah nice, so need to add this to pyproject.toml:

[tool.setuptools]
platforms = ["Any"]
include-package-data = true
+license-files = ["LICENSE.txt"]

@seisman seisman removed the discussions Need more discussion before taking further actions label Jan 6, 2024
@seisman seisman added this to the 0.11.0 milestone Jan 6, 2024
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
2 participants