jupyterlab / hatch-jupyter-builder

A hatch plugin to help build Jupyter packages
https://hatch-jupyter-builder.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
38 stars 13 forks source link

Pre-commit installation errors out when used in git submodule #131

Open krassowski opened 11 months ago

krassowski commented 11 months ago

Description

I tried to setup a jupyterlab extension to install jupyterlab from a branch. To use portal in yarn I wanted to use submodule. Submodule has .git file which is not a folder so precommit hook fails. It would be good to have a way to ignore this failure as currently it just errors out installation

× Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      INFO:hatch_jupyter_builder.utils:Running jupyter-builder
      INFO:hatch_jupyter_builder.utils:Writing pre-commit hook
      Traceback (most recent call last):
        File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 167, 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 "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-vk89r8tu/overlay/lib/python3.11/site-packages/hatchling/build.py", line 78, in build_editable
          return os.path.basename(next(builder.build(wheel_directory, ['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-vk89r8tu/overlay/lib/python3.11/site-packages/hatchling/builders/plugin/interface.py", line 150, in build
          build_hook.initialize(version, build_data)
        File "/tmp/pip-build-env-vk89r8tu/normal/lib/python3.11/site-packages/hatch_jupyter_builder/plugin.py", line 59, in initialize
          install_pre_commit_hook()
        File "/tmp/pip-build-env-vk89r8tu/normal/lib/python3.11/site-packages/hatch_jupyter_builder/utils.py", line 265, in install_pre_commit_hook
          with open(path, "w") as fid:
               ^^^^^^^^^^^^^^^
      NotADirectoryError: [Errno 20] Not a directory: '.git/hooks/pre-commit'
      [end of output]
welcome[bot] commented 11 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: