https://pantsbuild.org/ logo
#development
Title
# development
a

ancient-vegetable-10556

01/07/2022, 5:50 PM
I’m about to factor some code out of
backend/python
into something that will support code in both
backend/python
and
backend/jvm
— is there an OK place to put this? I see
util
, which seems logically far away. Would we be ok with a new
backend/common
directory?
👀 1
b

bitter-ability-32190

01/07/2022, 5:51 PM
I actually have a need for this as well in a WIP PR: https://github.com/pantsbuild/pants/pull/14049#discussion_r777598319
👍 1
h

hundreds-father-404

01/07/2022, 5:52 PM
what's the functionality?
a

ancient-vegetable-10556

01/07/2022, 5:52 PM
In my case, it’s the high-level code that generates lockfile invalidation headers
🙌 1
which currently lives in
backend/python/util_rules
backend/common
would make a whole lot more sense
definitely doesn’t feel broad enough to live in
util
e

enough-analyst-54434

01/07/2022, 5:54 PM
But it's also mushy. What about being more direct and backend/lockfiles.py ?
or backend/resolve/...
h

hundreds-father-404

01/07/2022, 5:54 PM
There is already
core/
. For example, right now I'm merging
coursier-resolve
and
generate-lockfiles
- I'm doing that in
core/goals/generate_lockfiles.py
You could consider
core/util_rules
a

ancient-vegetable-10556

01/07/2022, 5:55 PM
@enough-analyst-54434 currently
backend
has no python files
e

enough-analyst-54434

01/07/2022, 5:55 PM
All the more room!
a

ancient-vegetable-10556

01/07/2022, 5:55 PM
ha!
e

enough-analyst-54434

01/07/2022, 5:56 PM
This stuff is all totally arbitrary. A principle trumps opinions if we can have one of those that allows us to guess the answer.
b

bitter-ability-32190

01/07/2022, 5:56 PM
(My use-case is collecting all resource and file targets (much like collecting all Python targets for dep inference). I don't care where it lives, but inside
python
dir doesn't make sense 🙂 )
a

ancient-vegetable-10556

01/07/2022, 5:56 PM
Right, there’s always trying to balance sprawl over confusing nestedness
@bitter-ability-32190 Actually,
core/util_rules
seems to make sense for that stuff, now that @hundreds-father-404 has pointed it out
👍 2
your specific case, certainly
mine… has no rules
b

bitter-ability-32190

01/07/2022, 5:58 PM
Oh hey, check that out!
🙈 well I no longer have a horse in this race
a

ancient-vegetable-10556

01/07/2022, 5:59 PM
For mine, I’m going to start
backend/common
for now, and I’ll revisit once I get around to review
h

hundreds-father-404

01/07/2022, 6:02 PM
core/utils
perhaps? I don't know how to distinguish between what should go in
backend/common
vs
core/
, which raises a red flag to me
a

ancient-vegetable-10556

01/07/2022, 6:03 PM
I’ll raise you one — I don’t know what belongs in
backend
at all 🙂 But I can tell you that
backend/common
currently contains a thing that is only used by things in
backend
h

hundreds-father-404

01/07/2022, 6:03 PM
alternatively, put non-rule code in
util_rules/
- it's plausible the file will eventually gain some rules, so it would be already in the right place I wish I called the folder just
utils/
instead of
util_rules/
when I reorganized everything last year
b

bitter-ability-32190

01/07/2022, 6:03 PM
@hundreds-father-404 wait until you hear about renaming dirs 😉
a

ancient-vegetable-10556

01/07/2022, 6:03 PM
so I can’t tell you why
backend
exists, but I can tell you what hierarchy makes sense assuming what’s already there
h

hundreds-father-404

01/07/2022, 6:04 PM
I don’t know what belongs in backend at all
Currently,
backend/
is only where you put stuff corresponding to a particular
register.py
that users activate with
backend_packages
. (Related backends might import from other backends)
backend/common
smells wrong to me because we won't have a
backend/common/register.py
presumably
💯 1
2
h

happy-kitchen-89482

01/07/2022, 7:29 PM
Yeah I tend to agree, I think this is what util_rules is for?
1