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

Presence of hidden files breaks editable installs #437

Open
vyasr opened this issue Jul 18, 2023 · 3 comments
Open

Presence of hidden files breaks editable installs #437

vyasr opened this issue Jul 18, 2023 · 3 comments

Comments

@vyasr
Copy link
Contributor

vyasr commented Jul 18, 2023

Git supports nested .gitignore files. The presence of such a file inside the project's source currently breaks editable installs with the following traceback:

...                                                                                                                                           
        File "scikit_build_core/build/__init__.py", line 54, in build_editable
          return _build_wheel_impl(
        File "scikit_build_core/build/wheel.py", line 254, in _build_wheel_impl
          modules = {
        File "scikit_build_core/build/wheel.py", line 255, in <dictcomp>
          path_to_module(Path(v).relative_to(wheel_dirs["platlib"])): str(
        File "scikit_build_core/build/_pathutil.py", line 26, in path_to_module
          path = path.with_name(path.name.split(".", 1)[0])
        File "/lib/python3.10/pathlib.py", line 762, in with_name
          raise ValueError("Invalid name %r" % (name))
      ValueError: Invalid name ''
      [end of output]

The problem is here because ".gitignore".split(".", 1)[0] == "", which is an invalid argument to path.with_name.

We could fix this specifically for .gitignore by adding it to the list of ignored files. However, that wouldn't fix the general case of adding an arbitrary hidden file (e.g. consider config files for linters like .flake8 or tools like .bumpversion). The current easiest workaround would be to add such files to sdist.exclude, but that wouldn't work if a hidden file was actually important for the functioning of a package (I'm less concerned with linter configs etc since nobody should be developing off an sdist).

@vyasr vyasr changed the title Exclude gitignore files from sdists Presence of hidden files breaks editable installs Jul 18, 2023
henryiii added a commit that referenced this issue Jul 30, 2023
Partial fix to #437. The other part is revisiting the ignore patterns,
probably using the default Python.gitignore, and having one for SDist
and another for Wheel (TBD).

Signed-off-by: Henry Schreiner <[email protected]>
@vyasr
Copy link
Contributor Author

vyasr commented Oct 20, 2023

#444 says it's only a partial solution, did the other bits get completed too somewhere?

@henryiii
Copy link
Collaborator

Two more things probably should be done: revisiting the default ignore, and we maybe should support nested gitignores. I guess I can keep this open, though one/two separate issues might be better.

@henryiii henryiii reopened this Oct 21, 2023
@vyasr
Copy link
Contributor Author

vyasr commented Oct 25, 2023

Feel free to track however you want, I just asked for the sake of clarification and my own edification.

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

2 participants