Same program - different names - one builds - the other fails

I have two identical programs, except for their name: sfalmanac and skyalmanac (both in PyPI).

Historically, I once needed different program logic, which is no longer necessary.
For a while I will maintain the two, then retire sfalmanac.

Up to now I used setup.cfg and both builds worked flawlessly. I decided try the new method using only a pyproject.toml file. After a while I implemented a ‘src’ parent folder and figured the rest out.

Both programs are identical in logic and structure. I built sfalmanac first - with success. However the skyalmanac build ALWAYS excludes the data files in the ‘src/skyalmanac/lib/astro-data’ folder while ‘Building sdist…’ during python -m build. It has nothing to do with file/folder permissions. It’s on the same PC running Windows 11.

setuptools is 84.0.0; build is 1.6.0; wheel is 0.48.0.

I’ll try and log this error under setuptools - hoping that’s correct.
Does anyone have an explanation for this utterly confusing illogical behavior?

The build that works uses this:

[build-system]
requires = [
"setuptools >= 80.0.0",
"wheel"
]
build-backend = "setuptools.build_meta"

[project]
name = "sfalmanac"
version = "1.13.2"
description = "Creates the daily pages of a Nautical Almanac using Skyfield"
readme = "README.rst"
authors = [{ name = "<Firstname Lastname>", email = "<email>" }]
license = "GPL-3.0-or-later"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Operating System :: Microsoft :: Windows :: Windows 11",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Natural Language :: English",
"Intended Audience :: End Users/Desktop",
"Topic :: Scientific/Engineering :: Astronomy"
]
keywords = ["celestial-navigation", "navigation", "sailing", "sextant", "skyfield"]
dependencies = [
"scipy",
"Skyfield >=1.49",
]
requires-python = ">= 3.9"

[project.urls]
Repo = "<url>"

[tool.setuptools]
packages = ["sfalmanac", "sfalmanac.astro-data", "sfalmanac.data", "sfalmanac.docs", "sfalmanac.lib"]
package-dir = { "" = "src" }

[tool.setuptools.package-data]
sfalmanac = ["*.txt", "*.rst", "docs/*.pdf", "data/*.jpg", "data/*.png", "data/*.pdf", "astro-data/*.dat", "astro-data/*.bsp"]

Replace “sfalmanac” with “skyalmanac” for the build that always fails.
I have replaced text within angle brackets above.

P.S. Even the SOURCES.txt are identical too (except for the program name).

Could you also share the exact pyproject.toml file of a failing build? (Excluding private information)

Please don’t reconstruct it, just share the actual file used in a failing run.

[build-system]
requires = [
    "setuptools >= 80.0.0",
    "wheel"
]
build-backend = "setuptools.build_meta"

[project]
name = "skyalmanac"
version = "1.13.2"
description = "Creates the daily pages of a Nautical Almanac using Skyfield"
readme = "README.rst"
authors = [{ name = "Andrew Bauer", email = "aendie.bauer@gmail.com" }]
license = "GPL-3.0-or-later"
classifiers = [
	"Development Status :: 5 - Production/Stable",
	"Operating System :: Microsoft :: Windows :: Windows 11",
	"Operating System :: POSIX :: Linux",
	"Operating System :: MacOS",
    "Programming Language :: Python :: 3",
	"Natural Language :: English",
	"Intended Audience :: End Users/Desktop",
	"Topic :: Scientific/Engineering :: Astronomy"
]
keywords = ["celestial-navigation", "navigation", "sailing", "sextant", "skyfield"]
dependencies = [
    "scipy",
    "Skyfield >=1.49",
]
requires-python = ">= 3.9"

[project.urls]
Repo = "https://github.com/aendie/SkyAlmanac-Py3"

[tool.setuptools]
packages = ["skyalmanac", "skyalmanac.astro-data", "skyalmanac.data", "skyalmanac.docs", "skyalmanac.lib"]
package-dir = { "" = "src" }

[tool.setuptools.package-data]
sfalmanac = ["*.txt", "*.rst", "docs/*.pdf", "data/*.jpg", "data/*.png", "data/*.pdf", "astro-data/*.dat", "astro-data/*.bsp"]

Sorry, can’t upload - a *.toml or *.txt file is not authorized.

You forgot to replace the package name as the key in tool.setuptools.package-data

2 Likes

Brilliant!

My sincere apologies - I oversaw that.

Well done!!! Thanks !!!

1 Like