-
fix(python): include JAR and license files in sdist for conda-forge
发布于
2026-04-17 16:05:16 +00:00 Objective: conda-forge packagers must bundle Maven + OpenJDK as
build-time dependencies because PyPI only ships a wheel — there is
no sdist with the pre-compiled JAR they can build from. Attempting
to produce one silently fails: hatch drops gitignored files (JAR,
LICENSE, NOTICE, THIRD_PARTY) from the sdist even when they are
listed in 'include', yielding a 32KB tarball that installs but is
missing the CLI it wraps.Approach: Promote 'artifacts' to top-level [tool.hatch.build] so
both wheel and sdist force-include the gitignored build outputs.
Drop '--wheel' from build-python.sh so 'uv build' produces both
artifacts. Add verify-python-sdist.sh as a standalone check that
runs inside build-python.sh and can also be run locally — this
guards against silent regressions if .gitignore or hatch config
drifts in future. README.md is copied by build-python.sh before
'uv build' because hatchling validates [project.readme] during
metadata parsing, which runs before build hooks.Evidence: Built from a fresh clean checkout (no prior artifacts
in the package dir) and installed the resulting sdist in a fresh
venv.Scenario Expected Actual uv build on clean checkout sdist + wheel 21MB sdist + 21MB wheel sdist contains JAR yes yes (tar -tzf confirmed) sdist contains LICENSE/NOTICE/THIRD_PARTY yes yes verify-python-sdist.sh pass "OK: sdist contains all required files" verify-python-sdist.sh with multiple tarballs fail with list fails cleanly pip install from sdist no mvn call wheel built in ~1s, mvn not invoked JAR in site-packages yes 23MB at .../jar/opendataloader-pdf-cli.jar import opendataloader_pdf success success 下载附件