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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local .pants.rc support #14142

Merged
merged 3 commits into from Jan 12, 2022
Merged

Add local .pants.rc support #14142

merged 3 commits into from Jan 12, 2022

Conversation

thejcannon
Copy link
Member

This allows developers to customize their Pants settings without dirtying any repo files. For instance, I like bumping the logging level up to warn 馃槈

@jsirois
Copy link
Member

jsirois commented Jan 11, 2022

Did you know about pantsrc? Search here for two related options and their defaults: https://www.pantsbuild.org/docs/reference-global

@thejcannon
Copy link
Member Author

Did you know about pantsrc? Search here for two related options and their defaults: https://www.pantsbuild.org/docs/reference-global

That's what I'm using here. Although now I'm wondering if my addition should actually be moved into the default list?

I understand I could use global rc files, but it'd be nice to have different settings for different repos.

@jsirois
Copy link
Member

jsirois commented Jan 11, 2022

Sounds good. Just wanted to make sure you knew about and rejected adding this to your ~/.pants.rc.

pants.toml Outdated
@@ -64,6 +64,9 @@ build_ignore.add = [
"testprojects/src/go/**",
]

# Developers can customize Pants settings by using a `pants.dev.toml` file (which is .gitignored)
pantsrc_files.add = ["pants.dev.toml"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I re-read the diff and now see you used pantsrc_files and not config_files. My only excuse is the wider context. IIUC the motivating issue was to silence some tools and the 1st attempt was to do that globally by changing Pants defaults in code. As such I'd think you'd actually want the ~/.pantsrc solution instead of having to do something like this in each Pants repo you work in. Is this change ~unrelated to the motivating case / or related in that that made you see this might be useful someday for some other setting Pants devs don't universally agree on that you only want to change in the Pants repo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, in the OP - you want to have the Pants repo only warn but other repos default to info?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nailed it. They're all related.

I'll probably put the --quiet arg addition in my global pants rc because I don't care about seeing that stuff in any repo.

But in local RC files I have things I want per-repo. E.g. I want to see stats logged for my work monorepo, but not for Pants. And I don't want to blast every dev with those logs either.
In the Pants repo, I'd like to define my own aliases (which will be different, because it uses different tools). Stuff like that.

But. in general, I want to customize options per-repo for my own sake but don't want to dirty the git-tracked files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. makes sense to me.

.gitignore Outdated Show resolved Hide resolved
@stuhood
Copy link
Sponsor Member

stuhood commented Jan 11, 2022

Although now I'm wondering if my addition should actually be moved into the default list?

I think that it could, yea. But rather than pants.dev.toml, probably something more like .pants.rc or .pantsrc, to continue the existing convention of it being a dotfile.

@thejcannon thejcannon changed the title Add pants.dev.toml support Add local .pantsrc support Jan 12, 2022
@thejcannon
Copy link
Member Author

Changed the PR title & contents

@kaos kaos merged commit a2346e5 into pantsbuild:main Jan 12, 2022
@kaos kaos changed the title Add local .pantsrc support Add local .pants.rc support Jan 12, 2022
@thejcannon thejcannon deleted the pantslocal branch August 17, 2022 18:40
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

Successfully merging this pull request may close these issues.

None yet

4 participants