I’m about to factor some code out of `backend/pyth...
# development
a
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
I actually have a need for this as well in a WIP PR: https://github.com/pantsbuild/pants/pull/14049#discussion_r777598319
👍 1
h
what's the functionality?
a
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
But it's also mushy. What about being more direct and backend/lockfiles.py ?
or backend/resolve/...
h
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
@enough-analyst-54434 currently
backend
has no python files
e
All the more room!
a
ha!
e
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
(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
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
Oh hey, check that out!
🙈 well I no longer have a horse in this race
a
For mine, I’m going to start
backend/common
for now, and I’ll revisit once I get around to review
h
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
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
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
@hundreds-father-404 wait until you hear about renaming dirs 😉
a
so I can’t tell you why
backend
exists, but I can tell you what hierarchy makes sense assuming what’s already there
h
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
Yeah I tend to agree, I think this is what util_rules is for?
1