-
-
Notifications
You must be signed in to change notification settings - Fork 774
Adjust .gitignore to work better with pantsbuild #5726
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
Conversation
For more about BUILD files, see: https://www.pantsbuild.org/docs/targets#build-files Benjy Weinberger, one of the pants maintainers, pointed out why git was ignoring the BUILD files.
| *.egg | ||
| *.egg-info | ||
| dist | ||
| build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI you can name the files BUILD.pants! Many people prefer that for clarity. It allows you to avoid making this change also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting thought.
We don't have anything that creates build files or directories, so keeping it in .gitignore is kind of pointless.
But if we did change from BUILD to BUILD.pants, we would need this config in pants.toml:
[tailor]
build_file_name = "BUILD.pants"
https://www.pantsbuild.org/docs/reference-tailor#build_file_name
I thought we would also need to adjust [GLOBAL].build_patterns, but the default is ["BUILD", "BUILD.*"], so pants already recognizes BUILD.pants:
https://www.pantsbuild.org/docs/reference-global#build_patterns
I've done everything with BUILD files in my PoC. It'll be less work for me to keep using BUILD because that's less I have to change when I cherry-pick commits. If people would prefer BUILD.pants then that is possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Background
This is another part of introducing
pants, as discussed in the TSC Meetings on 12 July 2022, 02 Aug 2022 and 06 Sept 2022. Pants has fine-grained per-file caching of results for lint, fmt (like black), test, etc. It also has lockfiles that work well for monorepos that have multiple python packages. With these lockfiles CI should not break when any of our dependencies or our transitive dependencies release new versions, because CI will continue to use the locked version until we explicitly relock with updates.To keep PRs as manageable/reviewable as possible, introducing pants will take a series of PRs. I do not know yet how many PRs; I will break this up into logical steps with these goals:
pantsto the st2 repo, andpantsstep-by-step.Other pants PRs include:
Overview of this PR
This PR makes two adjustments to our
.gitignorefile.buildfrom .gitignorepants requires
BUILDfiles to describe metadata about our code (this directory has python and it has these dependencies that can't be inferred from the imports, etc)..gitignoreis not case sensitive, sobuildprevents addingBUILDfiles. This is required to use pants.For more about BUILD files, see: https://www.pantsbuild.org/docs/targets#build-files
The vim temp file patterns is not required for pants but it makes it nicer to work with it. If files change while pants is running a process, it can pause and re-run. When I use
vito look at a file while pants is running tests, or formatters, or whatever, then the tmp files keep triggering an inspection of the filesystem (pants needs to make sure it is including all required files in the given operation). But, pants ignores all files in.gitignore, so, adding thevimtemp files there prevents pants from getting false-positive filesystem changes. We might end up adding other temp files for people that use other editors to make their experience with pants nicer as well.