anthropic-sdk-python
anthropic-sdk-python copied to clipboard
Source distribution tarballs on pypi do not contain README.md, causing hatch-fancy-pypi-readme plugin to fail
The source distributions published to pypi presently cannot be built; attempts fail with:
Processing /private/tmp/nix-build-python3.12-anthropic-0.25.7.drv-0/anthropic-0.25.7
Running command Preparing metadata (pyproject.toml)
Traceback (most recent call last):
File "/nix/store/brnl7k3jxym5gyla9yh05xz5c4vhn1rz-python3.12-pip-23.2.1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/nix/store/brnl7k3jxym5gyla9yh05xz5c4vhn1rz-python3.12-pip-23.2.1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/brnl7k3jxym5gyla9yh05xz5c4vhn1rz-python3.12-pip-23.2.1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/build.py", line 56, in build_wheel
return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 93, in build
self.metadata.validate_fields()
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 243, in validate_fields
_ = self.version
^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 128, in version
self._version = self._get_version()
^^^^^^^^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 222, in _get_version
core_metadata = self.core
^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 174, in core
metadata_hook.update(self.core_raw_metadata)
File "/nix/store/k3bq3xc58ajs29rlwcxyi1mi309wl3p7-python3.12-hatch-fancy-pypi-readme-23.1.0/lib/python3.12/site-packages/hatch_fancy_pypi_readme/hooks.py", line 24, in update
config = load_and_validate_config(self.config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/k3bq3xc58ajs29rlwcxyi1mi309wl3p7-python3.12-hatch-fancy-pypi-readme-23.1.0/lib/python3.12/site-packages/hatch_fancy_pypi_readme/_config.py", line 56, in load_and_validate_config
raise ConfigurationError(errs)
hatch_fancy_pypi_readme.exceptions.ConfigurationError: ["Fragment file 'README.md' not found."]
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
Inspecting the tarball to list non-.py content shows only:
$ tar -tzf anthropic-0.25.7.tar.gz | grep -v '[.]py'
anthropic-0.25.7/src/anthropic/py.typed
anthropic-0.25.7/src/anthropic/tokenizer.json
anthropic-0.25.7/src/anthropic/lib/.keep
anthropic-0.25.7/.gitignore
anthropic-0.25.7/LICENSE
anthropic-0.25.7/pyproject.toml
anthropic-0.25.7/PKG-INFO
Notably, there is indeed no README.md file present.
Can you share steps to reproduce? This seems to work for me in the root of this repo:
$ rye build
$ cd dist && tar -xzf anthropic-0.25.9.tar.gz
$ cd anthropic-0.25.9/
$ python -m build
successfully creates another tarball and a wheel file.
The error occurs while running python -m pip wheel, as is performed by poetry2nix:
$ PYTHONPATH="/nix/store/mdrqr099093h12bv8m6afn20n9n9lrcy-python3.12-editables-0.5/lib/python3.12/site-packages:/nix/store/j6cqjhy2hqj322zhjpgrdx4qb727rlps-python3.12-packaging-23.1/lib/python3.12/site-packages:/nix/store/2azi09mbs063426zqjfi557lqgvmxz37-python3.12-pathspec-0.11.2/lib/python3.12/site-packages:/nix/store/n2bd5v1fyz17qdfqpyczc36xir3lfbvy-python3.12-pluggy-1.3.0/lib/python3.12/site-packages:/nix/store/3b1kq35m6lvaxff6qbg8xm08mxmxln7m-python3.12-trove-classifiers-2023.8.7/lib/python3.12/site-packages:/nix/store/78qhs966g0z3ncrnsy0011l1d92wzbqr-python3-3.12.0/lib/python3.12/site-packages:/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages:/nix/store/k3bq3xc58ajs29rlwcxyi1mi309wl3p7-python3.12-hatch-fancy-pypi-readme-23.1.0/lib/python3.12/site-packages" python -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist .
Processing /Users/chaduffy/dev/anthropic-sdk-python/anthropic-0.30.0
Running command Preparing metadata (pyproject.toml)
Traceback (most recent call last):
File "/Users/chaduffy/dev/anthropic-sdk-python/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/chaduffy/dev/anthropic-sdk-python/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chaduffy/dev/anthropic-sdk-python/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/build.py", line 56, in build_wheel
return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 93, in build
self.metadata.validate_fields()
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 243, in validate_fields
_ = self.version
^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 128, in version
self._version = self._get_version()
^^^^^^^^^^^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 222, in _get_version
core_metadata = self.core
^^^^^^^^^
File "/nix/store/w6r9jmj192v8mwga0zll0wq0kw02xnvn-python3.12-hatchling-1.18.0/lib/python3.12/site-packages/hatchling/metadata/core.py", line 174, in core
metadata_hook.update(self.core_raw_metadata)
File "/nix/store/k3bq3xc58ajs29rlwcxyi1mi309wl3p7-python3.12-hatch-fancy-pypi-readme-23.1.0/lib/python3.12/site-packages/hatch_fancy_pypi_readme/hooks.py", line 24, in update
config = load_and_validate_config(self.config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/k3bq3xc58ajs29rlwcxyi1mi309wl3p7-python3.12-hatch-fancy-pypi-readme-23.1.0/lib/python3.12/site-packages/hatch_fancy_pypi_readme/_config.py", line 56, in load_and_validate_config
raise ConfigurationError(errs)
hatch_fancy_pypi_readme.exceptions.ConfigurationError: ["Fragment file 'README.md' not found."]
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /Users/chaduffy/dev/anthropic-sdk-python/test.venv/bin/python /Users/chaduffy/dev/anthropic-sdk-python/test.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/wk/5jrv3khs2l56wmzlj1dsljmh0000gn/T/tmpyeffbpsd
cwd: /Users/chaduffy/dev/anthropic-sdk-python/anthropic-0.30.0
Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
If you're willing to install Nix (or already use it), I'd be glad to build a reproducer as standalone flake (roughly, runnable build instructions that provide enough detail to precisely hash-address inputs and their outputs); let me know if that's the case.
@charles-dyfis-net to clarify, are the builds on PyPI missing the README.md or are builds run with your scripts failing to include it? Can you provide repro steps for the former (e.g., including downloading the package).
Sorry I forgot to post an update here, this should be fixed in the latest release :)