white-appointment-6770
06/01/2025, 5:31 PMgorgeous-winter-99296
06/01/2025, 7:55 PMsetup.py
, generating a setup.py
with pants, or pyproject.toml
?white-appointment-6770
06/02/2025, 1:38 PMgorgeous-winter-99296
06/02/2025, 1:46 PMwhite-appointment-6770
06/02/2025, 1:49 PMgorgeous-winter-99296
06/02/2025, 8:33 PM$ pants package ::
22:30:33.04 [INFO] Wrote dist/package-0.1.0-py3-none-any.whl
22:30:33.04 [INFO] Wrote dist/package-0.1.0.tar.gz
$ tar tvf dist/package-0.1.0.tar.gz
drwxr-xr-x ts/ts 0 2025-06-02 22:26 package-0.1.0/
-rw-r--r-- ts/ts 7 2025-06-02 22:26 package-0.1.0/LICENSE.txt
-rw-r--r-- ts/ts 12 2025-06-02 22:26 package-0.1.0/MANIFEST.in
-rw-r--r-- ts/ts 144 2025-06-02 22:26 package-0.1.0/PKG-INFO
-rw-r--r-- ts/ts 6 2025-06-02 22:26 package-0.1.0/README.md
-rw-r--r-- ts/ts 762 2025-06-02 22:26 package-0.1.0/backend_shim.py
drwxr-xr-x ts/ts 0 2025-06-02 22:26 package-0.1.0/mylib/
-rw-r--r-- ts/ts 0 2025-06-02 22:26 package-0.1.0/mylib/__init__.py
-rw-r--r-- ts/ts 0 2025-06-02 22:26 package-0.1.0/mylib/hello.py
drwxr-xr-x ts/ts 0 2025-06-02 22:26 package-0.1.0/package.egg-info/
-rw-r--r-- ts/ts 144 2025-06-02 22:26 package-0.1.0/package.egg-info/PKG-INFO
-rw-r--r-- ts/ts 255 2025-06-02 22:26 package-0.1.0/package.egg-info/SOURCES.txt
-rw-r--r-- ts/ts 1 2025-06-02 22:26 package-0.1.0/package.egg-info/dependency_links.txt
-rw-r--r-- ts/ts 1 2025-06-02 22:26 package-0.1.0/package.egg-info/namespace_packages.txt
-rw-r--r-- ts/ts 6 2025-06-02 22:26 package-0.1.0/package.egg-info/top_level.txt
-rw-r--r-- ts/ts 38 2025-06-02 22:26 package-0.1.0/setup.cfg
-rw-r--r-- ts/ts 423 2025-06-02 22:26 package-0.1.0/setup.py
$ zipinfo dist/package-0.1.0-py3-none-any.whl
Archive: dist/package-0.1.0-py3-none-any.whl
Zip file size: 1716 bytes, number of entries: 8
-rw-r--r-- 2.0 unx 0 b- defN 25-Jun-02 20:26 mylib/__init__.py
-rw-r--r-- 2.0 unx 0 b- defN 25-Jun-02 20:26 mylib/hello.py
-rw-r--r-- 2.0 unx 7 b- defN 25-Jun-02 20:26 package-0.1.0.dist-info/LICENSE.txt
-rw-r--r-- 2.0 unx 144 b- defN 25-Jun-02 20:26 package-0.1.0.dist-info/METADATA
-rw-r--r-- 2.0 unx 91 b- defN 25-Jun-02 20:26 package-0.1.0.dist-info/WHEEL
-rw-r--r-- 2.0 unx 1 b- defN 25-Jun-02 20:26 package-0.1.0.dist-info/namespace_packages.txt
-rw-r--r-- 2.0 unx 6 b- defN 25-Jun-02 20:26 package-0.1.0.dist-info/top_level.txt
-rw-rw-r-- 2.0 unx 624 b- defN 25-Jun-02 20:26 package-0.1.0.dist-info/RECORD
8 files, 873 bytes uncompressed, 606 bytes compressed: 30.6%
gorgeous-winter-99296
06/02/2025, 8:37 PMwhite-appointment-6770
06/02/2025, 10:25 PMwhite-appointment-6770
06/02/2025, 10:26 PMwhite-appointment-6770
06/02/2025, 10:36 PMlong_description_path="README.md"
pants blows up with an unmatched glob error. This is weird because when I
pants peek README.md
I get nice output suggesting all is well, and same for peek on the python_distribution target.
Relevant error message is:
Unmatched glob from the long_description_path field of python/server/v2_1/launchers:server: "README.md"
It is strange because that file is there and "peek" sees it.white-appointment-6770
06/02/2025, 10:36 PMwhite-appointment-6770
06/02/2025, 10:52 PMwhite-appointment-6770
06/02/2025, 11:51 PMpants package
doesn't use sandboxes for python_distribution targets? I've spent many hours since Friday trying to figure out this curious puzzle. I think it's time for me to admit defeat and simply repackage the tar ball with the necessary files by hand. My guess is that I have a repo structure that pants doesn't expect.
I forked your repo and made a few modifications to mirror how our repo is structured. If you run pants package ::
in the something/python/dist-license folder you'll see that the resulting tar.gz file does not include the LICENSE.txt or README.md files. You can find my fork here:
https://github.com/stormfish-sci/pants-repros/tree/maingorgeous-winter-99296
06/03/2025, 10:33 AM--no-local-cache
as well; and blow away all sandboxes between runs. Also helps to pkill pantsd... all-in-all, pkill pantsd; rm -rf /tmp/pants-sandbox-*; pants --keep-sandboxes=always --no-local-cache ...
. I found your issue as well, your root patterns are one level too far up; so during the sandbox generation we put the license.txt in a subdir.
/tmp/pants-sandbox-C0mr0p/chroot/dist-license
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/LICENSE.txt
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/README.md
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/src
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/src/py
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/src/py/mylib
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/src/py/mylib/__init__.py
/tmp/pants-sandbox-C0mr0p/chroot/dist-license/src/py/mylib/hello.py
Replacing python
root pattern with the actual root dir of the package;
/tmp/pants-sandbox-GET9Wn/chroot/LICENSE.txt
/tmp/pants-sandbox-GET9Wn/chroot/MANIFEST.in
/tmp/pants-sandbox-GET9Wn/chroot/README.md
<snip>
/tmp/pants-sandbox-GET9Wn/chroot/src
/tmp/pants-sandbox-GET9Wn/chroot/src/py
/tmp/pants-sandbox-GET9Wn/chroot/src/py/mylib
/tmp/pants-sandbox-GET9Wn/chroot/src/py/mylib/__init__.py
/tmp/pants-sandbox-GET9Wn/chroot/src/py/mylib/hello.py
/tmp/pants-sandbox-GET9Wn/chroot/src/py/mylib
/tmp/pants-sandbox-GET9Wn/chroot/src/py/mylib/__init__.py
/tmp/pants-sandbox-GET9Wn/chroot/src/py/mylib/hello.py
white-appointment-6770
06/03/2025, 2:44 PMgorgeous-winter-99296
06/03/2025, 3:03 PMgorgeous-winter-99296
06/03/2025, 3:06 PMgorgeous-winter-99296
06/03/2025, 3:07 PMwhite-appointment-6770
06/03/2025, 3:08 PMwhite-appointment-6770
06/03/2025, 4:47 PMgorgeous-winter-99296
06/03/2025, 4:48 PMwhite-appointment-6770
06/03/2025, 4:49 PMkeyproduct_1/python/keyproduct_1/server/v2
is where v2 of our commercial version lives with a proprietery license. v2_community_edition
would have an open source license.white-appointment-6770
06/03/2025, 5:06 PMgorgeous-winter-99296
06/03/2025, 8:02 PM# something/python/dist-license/BUILD
python_sources(name="src")
resources(name="package_data", sources=["README.md", "LICENSE.txt"])
python_distribution(
name="dist-license",
dependencies=[
":package_data",
":src",
],
provides=python_artifact(
name="package",
version="0.1.1",
long_description_content_type="markdown",
license_files=["dist-license/LICENSE.txt"],
),
generate_setup=True,
long_description_path="dist-license/README.md",
)
In the sdist this ends up keeping the README.md and LICENSE.txt in the dist-license dir, not in the root (hence - icky) but it does generate correct METADATA and LICENSE.txt entries in dist-info. It is a bit odd to specify the dir-name in the long-description-path and license-files, but it's necessary AFAICT to make both pants and setuptools happy. I think the other alternative would be to move the python_distribution
, as well as the license and readme up one level, but then you'd need one shared README/license for each top-level project.white-appointment-6770
06/03/2025, 8:12 PMgorgeous-winter-99296
06/03/2025, 8:43 PMdist-license
directory still existed in the root as well. The long_description_path
should be relative to build root; so I used the build_file_dir
helper to make it a bit more resilient.
The reason the pants.toml is in a subdir in is because I keep all my repros in one repository, one "project" per directory.white-appointment-6770
06/03/2025, 8:52 PMpants.toml
files. Does this prevent you from referencing across projects? I.e., if you updated code in a project used by others with different 'pants.toml' files, pants cannot test all projects dependent on it, right? I don't intend to suggest one is "right" vs "wrong" just hoping to grow my understanding of pros/cons of different approaches 🙂gorgeous-winter-99296
06/03/2025, 8:59 PMwhite-appointment-6770
06/03/2025, 8:59 PMwhite-appointment-6770
06/04/2025, 3:43 PM$ tar tzf ~/git/3rd-party/pants-repros/dist-license-mtlp/dist/dist_license-0.1.1.tar.gz
dist_license-0.1.1/
dist_license-0.1.1/MANIFEST.in
dist_license-0.1.1/PKG-INFO
dist_license-0.1.1/backend_shim.py
dist_license-0.1.1/dist-license/
dist_license-0.1.1/dist-license/LICENSE.txt
dist_license-0.1.1/dist-license/README.md
dist_license-0.1.1/dist-license/__init__.py
dist_license-0.1.1/dist-license/hello.py
dist_license-0.1.1/dist_license.egg-info/
dist_license-0.1.1/dist_license.egg-info/PKG-INFO
dist_license-0.1.1/dist_license.egg-info/SOURCES.txt
dist_license-0.1.1/dist_license.egg-info/dependency_links.txt
dist_license-0.1.1/dist_license.egg-info/namespace_packages.txt
dist_license-0.1.1/dist_license.egg-info/top_level.txt
dist_license-0.1.1/setup.cfg
dist_license-0.1.1/setup.py
Do you get this result or does yours include the LICENSE.txt and README.md at top level of tar ball?gorgeous-winter-99296
06/04/2025, 3:44 PMwhite-appointment-6770
06/04/2025, 3:45 PMgorgeous-winter-99296
06/04/2025, 3:46 PMwhite-appointment-6770
06/04/2025, 4:00 PMwhite-appointment-6770
06/04/2025, 4:07 PM