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

Feature Request: Add .gitignore to build-dir #650

Open
augusew1 opened this issue Jul 21, 2024 · 3 comments
Open

Feature Request: Add .gitignore to build-dir #650

augusew1 opened this issue Jul 21, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@augusew1
Copy link

Hello,

This could be a misconfiguration on my part, but I am building a wheel file with

python3 -m build --wheel -Cbuild-dir=builddir

and unlike building with meson directly, I do not see a .gitignore ( or .hgignore) file in builddir. Specifically I see this building with

  • meson 1.5.0
  • meson-python 1.16.0
  • build 1.2.1

I'm interested in keeping a semi-permanent build directory around because build times on Windows are exceedingly large, and the .gitignore file that meson usually puts in the build directory is a nice quality of life. For now I've added builddir to the project's .gitignore file but this doesn't scale very well since we use this on multiple platforms and multiple python versions.

I can reproduce this by building one of the listed examples on:

  • mingw64 (unsupported python)
  • Windows (official python)
  • RHEL9
@rgommers
Copy link
Contributor

Hi @augusew1, good question. meson-python does write out a .gitignore file for editable installs:

directory.joinpath('.gitignore').write_text(textwrap.dedent('''

I believe our understanding so far has been that users either build a wheel for a one-off install/distribution, which by default happens in a tempdir created by pip/build, or they're using one of two development methods:

  1. Using meson setup, either directly or via a CLI like spin.
  2. Using an editable install (pip install -e . --no-build-isolation).

In both cases a .gitignore gets generated.

I'm interested in keeping a semi-permanent build directory around because build times on Windows are exceedingly large,

That makes sense to me.

For now I've added builddir to the project's .gitignore file but this doesn't scale very well since we use this on multiple platforms and multiple python versions.

That shouldn't matter, right? It's called builddir everywhere, there's no platform or Python version dependence here. A one-line entry in your projects' .gitignore is all you should need.

@augusew1
Copy link
Author

Interesting about editable installs, I'll read up on that.

That shouldn't matter, right? It's called builddir everywhere, there's no platform or Python version dependence here. A one-line entry in your projects' .gitignore is all you should need.

It's called builddir everywhere if people do -Cbuild-dir=builddir every time. We certainly encourage that but it's not guaranteed, unfortunately.

That being said I recognize there are better ways to do this and that this is very much a skill isuse on my end. If you would like to close this feel free.

@rgommers
Copy link
Contributor

rgommers commented Aug 2, 2024

I think it'd be fine to add this feature actually, so I'll leave this issue open for now.

Note that the selected build directory is allowed to be non-empty. That's the case for meson setup as well - and a .gitignore/.hgignore is only written if the directory is empty.

@rgommers rgommers added the enhancement New feature or request label Aug 2, 2024
dnicolodi added a commit to dnicolodi/meson-python that referenced this issue Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants