cold-soccer-63228
05/12/2022, 6:55 PMBUILD
files only in semi-top level folders, rather than in every directory? Something like the following?
my_project/
├── awesome_service/
│ ├── internals/
│ | ├── utils.py
│ | ├── constants.py
│ ├── client/
│ | ├── client.py
│ └── BUILD
└── another_awesome_service/
├── internals/
| ├── utils.py
| ├── constants.py
├── client/
| ├── client.py
└── BUILD
hundreds-father-404
05/12/2022, 6:56 PMwide-midnight-78598
05/12/2022, 6:59 PMtailor
I use 1 BUILD per service/project/larger unit of code - requires globbing though, so 🤷
https://github.com/sureshjoshi/pants-plugins/blob/main/hellocpp/BUILD.pantshundreds-father-404
05/12/2022, 7:00 PMoverrides
extensively? If so, how is that going?cold-soccer-63228
05/12/2022, 7:00 PMtailor
such that we specify path rules on where to generate BUILD
directories?hundreds-father-404
05/12/2022, 7:01 PMhundreds-father-404
05/12/2022, 7:01 PMIs there any way to provide arguments to tailor such that we specify path rules on where to generate BUILD directories?You can say
./pants dir
and it will only generate for dir
and everything below it.
(I've proposed changing that to only generate for dir
, and then you use dir::
for everything)wide-midnight-78598
05/12/2022, 7:03 PMinit.py
files everywhere. Makes searching for the specific one a pain, and just contributes to visual glut on the filesystem.cold-soccer-63228
05/12/2022, 7:03 PMmy_project/awesome_service
and my_project/another_awesome_service
, but not the subdirectories my_project/awesome_service/internals
, etc.?cold-soccer-63228
05/12/2022, 7:04 PMhundreds-father-404
05/12/2022, 7:06 PMtailor
to support non-1:1-1 mode: https://github.com/pantsbuild/pants/issues/new/choose
Also FYI I recently added options to disable every built-in tailor
implementation, which means that you can turn those off and replace them w/ your own plugincold-soccer-63228
05/12/2022, 7:10 PMhundreds-father-404
05/12/2022, 7:11 PMcold-soccer-63228
05/12/2022, 7:11 PMhundreds-father-404
05/12/2022, 7:11 PMpython_sources
+ python_tests
)hundreds-father-404
05/12/2022, 7:13 PMhundreds-father-404
05/12/2022, 7:13 PMwide-midnight-78598
05/12/2022, 7:15 PMCMakeFiles.txt
per directory, which caused massive ballooning and making it impossible to find the correct one in VSCode or other IDE search.
I'm willing to take compile-time/test-time cache misses vs keyboard-time usability any day of the weekcold-soccer-63228
05/12/2022, 7:19 PMcold-soccer-63228
05/12/2022, 7:19 PMwitty-crayon-22786
05/12/2022, 7:54 PMwhich caused massive ballooning and making it impossible to find the correct one in VSCode or other IDE search.i’d argue that it’s harder to find the right BUILD file to edit if they aren’t consistently next to the code that they apply to. you need to add metadata for a file, so which of the parent directories do you go looking in? having said that: where to put `python_distribution`s is still unanswered with 111.
witty-crayon-22786
05/12/2022, 7:56 PMDo you know what the timeline of being able to support something like this would be, i.e.:
• Is it difficult to do?
• Is it perhaps controversial?probably both… the big challenge is just: how do you describe where the metadata should live via config, if not “next to the relevant file”? i suppose that if there were a clear answer to that question, it wouldn’t be controversial. but there are a lot of assumptions baked in in various places around 111 being the happy path: you’ll have less boilerplate per-file of default globs, shorter addresses, etc
wide-midnight-78598
05/12/2022, 7:57 PMKConfig
files for embedded linux/u-boot - and those infuriate me to no end, because they're everywhere.flat-zoo-31952
05/12/2022, 8:01 PM--changed-dependees=transitive
to select tests, you're going to add every target defined by that build file to the dependent closure.witty-crayon-22786
05/12/2022, 8:02 PMSo, for micro-services, each service has 1 BUILD file. From a folder naming perspective, it’s pretty intuitive, because the other way I look at it...@wide-midnight-78598: where would a shared library live? and how would its metadata be nested?
wide-midnight-78598
05/12/2022, 8:04 PMwide-midnight-78598
05/12/2022, 8:05 PMpython_library(
name="libtransferrer",
sources=["**/*.py", "!*_test.py"],
dependencies=[
"//:protobuf",
"//:python-dotenv",
"//libs/core",
],
)
cold-soccer-63228
05/12/2022, 8:05 PMwide-midnight-78598
05/12/2022, 8:05 PMwide-midnight-78598
05/12/2022, 8:06 PMwitty-crayon-22786
05/12/2022, 8:07 PM@witty-crayon-22786 Just a top-level lib that gets pulled in as a 1st party depif the library is monolithic, and the entire thing depends on those dependencies, then that can work. but to actually have fine-grained metadata (i.e., another library which doesn’t need
protobuf
), you need new top-level directories, and can’t really use namespacingflat-zoo-31952
05/12/2022, 8:09 PMflat-zoo-31952
05/12/2022, 8:09 PMflat-zoo-31952
05/12/2022, 8:10 PMpython_sources()
or what have youwide-midnight-78598
05/12/2022, 8:10 PMflat-zoo-31952
05/12/2022, 8:11 PMcold-soccer-63228
05/12/2022, 8:12 PMwitty-crayon-22786
05/12/2022, 8:12 PMtailor
of what to do. i expect that that is challenging because the boundaries of projects are challenging to define in a monorepo… but if someone wants to take a swing at it, then by all means. just note that other UX biases toward 111, so creating the BUILD files is probably ~75% of the storywide-midnight-78598
05/12/2022, 8:12 PMflat-zoo-31952
05/12/2022, 8:13 PMbitter-ability-32190
05/12/2022, 8:14 PMwitty-crayon-22786
05/12/2022, 8:14 PMwide-midnight-78598
05/12/2022, 8:14 PMbitter-ability-32190
05/12/2022, 8:15 PMbitter-ability-32190
05/12/2022, 8:15 PMflat-zoo-31952
05/12/2022, 8:16 PMflat-zoo-31952
05/12/2022, 8:17 PMwide-midnight-78598
05/12/2022, 8:17 PMflat-zoo-31952
05/12/2022, 8:18 PM./pants tailor
won't create BUILD files for files that are already encompassed in some generator definitionwide-midnight-78598
05/12/2022, 8:19 PMflat-zoo-31952
05/12/2022, 8:19 PMflat-zoo-31952
05/12/2022, 8:22 PMpython_sources(
name="aiven",
sources=["aiven/**/*.py"],
overrides={
...
},
)
where
❯ ./pants count-loc //:aiven
──────────────────────────────────────────
Language Files Lines
──────────────────────────────────────────
Python 1693 409366
and ./pants tailor
doesn't add a single BUILD fileflat-zoo-31952
05/12/2022, 8:22 PMhundreds-father-404
05/12/2022, 8:28 PM./pants tailor won't create BUILD files for files that are already encompassed in some generator definitionYep, that is pretty crucial to
./pants tailor
workingwide-midnight-78598
05/12/2022, 8:32 PM./pants tailor
and it just created:
Created hellofib/hellofib/BUILD:
- Add pex_binary target main
pex_binary(
name="main",
entry_point="main.py",
)
flat-zoo-31952
05/12/2022, 8:33 PM[python]
tailor_pex_binary_targets = false
in my pants.toml
wide-midnight-78598
05/12/2022, 8:33 PMwide-midnight-78598
05/12/2022, 8:33 PMflat-zoo-31952
05/12/2022, 8:34 PMwide-midnight-78598
05/12/2022, 8:34 PMhundreds-father-404
05/12/2022, 8:35 PM[python].tailor_python_sources
hundreds-father-404
05/12/2022, 8:35 PMIt also just created a python_requirements that I already have, but this now makes more senseJust now? That's a bug
wide-midnight-78598
05/12/2022, 8:36 PM