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

hatchling 1.19.0 - AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable' #1114

Closed
ystarikovich opened this issue Dec 11, 2023 · 3 comments

Comments

@ystarikovich
Copy link

ystarikovich commented Dec 11, 2023

Hey Guys, after upgrading to the version 1.19.0 we started to receive:

AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'

I was not able to track based on the commits and release notes what has been changed in this area on the hatchling.
We also use hatch-requirements-txt plugin to be able to use standard requirements.txt format and support some old codebases.

Would appreciate for the support.

Full stack trace

hatch --verbose --no-interactive env create
Creating environment: default
Installing project in development mode
Looking in indexes: https://aws:****@jumio-codeartifact-362231854019.d.codeartifact.eu-west-1.amazonaws.com/pypi/python-central/simple/, https://artifactory.int.jumio.com/artifactory/api/pypi/jumio-pypi/simple
Obtaining file:///Users/ystarikovich/work/aiml/aiml-deployment/endpoints/graph-risk-by-association
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      Traceback (most recent call last):
        File "/Users/ystarikovich/Library/Application Support/hatch/env/virtual/graph-risk-by-association/Ig4LGtcR/graph-risk-by-association/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 177, in prepare_metadata_for_build_editable
          hook = backend.prepare_metadata_for_build_editable
      AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/Users/ystarikovich/Library/Application Support/hatch/env/virtual/graph-risk-by-association/Ig4LGtcR/graph-risk-by-association/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/ystarikovich/Library/Application Support/hatch/env/virtual/graph-risk-by-association/Ig4LGtcR/graph-risk-by-association/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/ystarikovich/Library/Application Support/hatch/env/virtual/graph-risk-by-association/Ig4LGtcR/graph-risk-by-association/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 186, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/build.py", line 82, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 155, in build
          artifact = version_api[version](directory, **build_data)
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 423, in build_editable
          return self.build_editable_detection(directory, **build_data)
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 434, in build_editable_detection
          for included_file in self.recurse_selected_project_files():
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/plugin/interface.py", line 180, in recurse_selected_project_files
          if self.config.only_include:
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/config.py", line 774, in only_include
          only_include = only_include_config.get('only-include', self.default_only_include()) or self.packages
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 231, in default_only_include
          self.set_default_file_selection()
        File "/private/var/folders/cb/pfs9f6nn4pxcgfxn4rz6x5lh0000gn/T/pip-build-env-khs2w8mq/overlay/lib/python3.10/site-packages/hatchling/builders/wheel.py", line 209, in set_default_file_selection
          raise ValueError(message)
      ValueError: At least one file selection option must be defined, see: https://hatch.pypa.io/latest/config/build/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.
@ofek
Copy link
Collaborator

ofek commented Dec 11, 2023

Duplicate of #1113

@ofek ofek marked this as a duplicate of #1113 Dec 11, 2023
@ofek ofek closed this as completed Dec 11, 2023
@ofek
Copy link
Collaborator

ofek commented Dec 12, 2023

https://github.com/pypa/hatch/releases/tag/hatchling-v1.19.1

@mafrosis
Copy link

mafrosis commented Jun 6, 2024

[tool.hatch.metadata]
allow-direct-references = true

https://stackoverflow.com/a/73332363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants