Comments (7)
I don't know if this works as any of the tailor stuff I run is pretty basic, but would something like this work for you?
I'm not entirely sure if fmt
necessarily runs after tailor
, but even if not, creating the new build files should tell fmt
that the filesystem has changed and kick it off anyways.
backend_packages = [
"pants.backend.build_files.fmt.buildifier",
...
pants tailor fmt ::
As a fallback, if that didn't work, then maybe something like pants tailor :: && pants fmt ::
https://www.pantsbuild.org/2.20/reference/subsystems/buildifier
from pants.
Yes, those work, and are a way to avoid manually running buildifier
, but in exchange you manually run pants tailor
. It seems reasonable that anything generated by pants should then be formatted by pants. In other words, it should be that this is something we shouldn't have to think about.
from pants.
I'll concede, I'm a bit confused as to your workflow now.
support running an auto-format binary after pants tailor
by default, pants tailor creates BUILD files that do not conform to this binary, so now users have to run pants tailor and then manually go and run buildifier.
How are you running pants tailor
if not manually? And what's the incremental effort to running pants tailor fmt
?
from pants.
Yes, we're running it manually. I'd prefer to just run one command, otherwise we need to mention to everyone the "proper" way to create new build files, which is not just to run pants tailor
but to do other things as well. This feature request would simplify that.
from pants.
So, in pants
it's pretty typical to chain goals as a single command:
pants fix fmt lint check ::
That's a very common paradigm, so pants tailor fmt ::
would be a single command running 2 goals against all targets.
If you wanted to "simplify" it, you could create an alias to do that for you (https://www.pantsbuild.org/2.20/reference/subsystems/cli#alias).
[cli.alias]
ftailor = "tailor fmt"
from pants.
Thanks, I agree that's better than I had originally come up with.
I still think, though, that automatically formatting (if Pants knows how) anything Pants generates would be a completely reasonable thing to implement, and would help simplify this. Ideally, Pants should get things right without workarounds, even simple ones.
from pants.
I agree with your point that this could be better: pants is writing new data to file that it (a) knows how to reformat, and (b) knows should be reformatted. Would be a nice quality-of-life improvement to do the reformatting automatically!
It looks like this is the rule that does the editing, including reading the existing contents:
pants/src/python/pants/core/goals/tailor.py
Lines 532 to 573 in 0d35991
I'm not exactly sure how we'd apply the appropriate build file formatting rules likely something involving rules from https://github.com/pantsbuild/pants/blob/0d35991d0814fa4f45ce504933d143525898e653/src/python/pants/core/goals/update_build_files.py
from pants.
Related Issues (20)
- `peek` output for target generators like `python_tests` do not include relevant `goals` HOT 3
- "Making subsystems exportable with their default lockfile" docs render funny
- Project specific env vars from host
- `export` goal `py_hermetic_scripts` option docs have misrendered list
- Plugin upgrade guide does not mention changes in 2.18 or later (e.g. `@rule_helper` removal) HOT 1
- pantsd not invalidating cache when file permission changes
- Consistent option hierarchy
- Add exit-non-zero-on-fix support for fix and fmt goals HOT 11
- Pants package command hangs for helm chart with dependency subcharts of the same name HOT 1
- Show Python tool versions in top-level help text and documentation
- Feature request: Allow disabling file handle limit warning HOT 2
- `__defaults__(all=...)` is a future-compatibility hazard for adding new field HOT 4
- Process 'Extract Pants' execution Python' failed with exit code 2, when running in GH actions HOT 3
- Overrides not working with parametrized default HOT 2
- GitHub-hosted `macos-11` runners are deprecated and will be removed on 2024-06-28
- Pants test using a different module version than it's assigned resolve HOT 5
- Values from `__defaults__` are not treated the same as builtin field defaults. HOT 4
- Lingering TODO about removing `parent_id` in `interface.rs`
- Regression: env vars no longer being parsed correctly in `pants.toml` as of Pants `2.22.0.dev2` HOT 5
- Possible Go dependency inference issue related to cgo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pants.