flat-zoo-31952
01/14/2021, 4:04 PMhundreds-father-404
01/14/2021, 4:07 PMwill that change scale to other languages?Good question. I'll add a section sketching what Java might look like with this naming.
does it matter?Does which part matter?
flat-zoo-31952
01/14/2021, 4:09 PMpython_sources
vs java_library
or java_classgroup
or whatever the case may be therehundreds-father-404
01/14/2021, 4:18 PMprotobuf_library
matters too imo
A big insight I've had recently is a separation between targets describing 1) your own code, 2) third-party reqs, and 3) artifacts. We used to muddy that, like provides=setup_py()
being defined on a python_library
target, or pex_binary()
having a sources
field. Now, we have targets whose sole purpose is describing source files vs. targets for abstract metadata on how to build something
For that first category, I'm thinking lang_sources
and lang_tests
should scale wellflat-zoo-31952
01/14/2021, 4:51 PMjolly-midnight-72759
01/14/2021, 5:53 PMpython_sources
contains the meta data for a group of python files that form a coherent "thing" (now known as a library)?
I don't see how changing library to sources reduces the confusion. A python developer still needs to know that another target is needed for making a pex (pex_binary
) and a wheel/zip (python_distribution
).
Are you trying to create the dichotomy between sources and 3rd party requirements? Requirements come from the pip
ecosystem.
If you are going this route, why wouldn't you also use the name python_pex
instead of pex_binary
?jolly-midnight-72759
01/14/2021, 5:54 PMlang_TargetMeaningfulToThisLanguage
?hundreds-father-404
01/14/2021, 5:54 PMIs the idea that python_sources contains the meta data for a group of python files that form a coherent "thing" (now known as a library)That's the thing, there need not be any coherence at all. It could be a single source file, or all your source files, or 5 of them etc. All it is is metadata over n number of Python files, which all share the same explicit metadata like
interpreter_constraints
. Right now, we incorrectly suggest they must be coherentjolly-midnight-72759
01/14/2021, 5:55 PMjolly-midnight-72759
01/14/2021, 5:56 PMhundreds-father-404
01/14/2021, 5:56 PMjolly-midnight-72759
01/14/2021, 5:57 PMBUILD
files in this way, even with tooling to help.jolly-midnight-72759
01/14/2021, 5:58 PMBUILD
files through inference, then it won't matter as much.jolly-midnight-72759
01/14/2021, 5:59 PMpex_binary
? Does that make sense given it defines metadata for a python only target?hundreds-father-404
01/14/2021, 6:22 PMprovides=setup_py()
to live on a python_library()
. That became illegal to do once we added "file targets", it would break most the time. Which led to python_distribution
, which led to this insight that there's a distinction between "metadata describing first party code" vs. "metadata describing something you want to build"
--
FYI the major remaining churn we anticipate is wanting to solve the problem of it being hard to add explicit metadata to a granular part of your first party code, without needing lots of granular targets. A common pattern (now) is to have one python_library
target describing >20 files thanks to **
rglobs. When you add an explicit dep like a database that Pants can't infer, then now all 20 files get that even if only 1 file actually needs it.
111 mitigates this problem, but is extra boilerplate
We're envisioning a way where you can somehow merge metadata, like say "these 200 files use these interpreter constraints; these 5 files have a database dep". Without needing to have distinct targets for everything.
The trick is how do we do that in a way that isn't majorly disruptive... It's another big paradigm change we couldn't envision before dep inference because we were blinded by the way every monorepo Build Tool™️ has done things since the start.hundreds-father-404
01/14/2021, 6:24 PMWhat about pex_binary?Eh, yeah, possibly it should have been
python_pex
. But I think we're extremely unlikely to change it one more time. That's too disruptive.
I think python_awslambda
makes sense because there are multiple ways you can create an AWSLambda. Personally, I wish we called python_distribution
a setup_py_dist
or setup_py_binary
. But too late to changehappy-kitchen-89482
01/14/2021, 7:18 PMhappy-kitchen-89482
01/14/2021, 7:19 PMpython_requirement
is too confusing with the existing python_requirements
macro thoughhundreds-father-404
01/14/2021, 7:19 PMpython_dependency
? python_3rdparty
?happy-kitchen-89482
01/14/2021, 7:21 PMpython_requirement_library
can encompass multiple requirements.hundreds-father-404
01/14/2021, 7:24 PMMaybe python_dependency?This sounds the most natural to me, but it's confusing with our
dependencies
field meaning either 1st or 3rd party deps.
python_3rdparty_deps
could make sense. I think I'm not super concerned about verbosity for this target type because it's not used frequentlyflat-zoo-31952
01/14/2021, 8:05 PMflat-zoo-31952
01/14/2021, 8:06 PMhundreds-father-404
01/14/2021, 8:08 PM./pants help
and our docs being able to consistently use the new names. That's fine to have hidden names for the same thing.flat-zoo-31952
01/14/2021, 8:09 PMflat-zoo-31952
01/14/2021, 8:09 PMflat-zoo-31952
01/14/2021, 8:10 PMhundreds-father-404
01/14/2021, 8:12 PMthere's not a really good name for the concept you describe: "a set of source files that share some common metadata",Agreed, and that speaks to the bigger thing that we're realizing we want to do, but don't yet know how, particularly in a way that we don't screw over current users: somehow replace the idea of targets for first-party code with this merging-of-metadata idea Targets seem to work well when describing third party requirements + artifacts you want to build. They map very nicely 1-1 with the thing you're describing. Targets get really clunky when describing first party code, though.
flat-zoo-31952
01/14/2021, 8:13 PMpython_library
may be confusing for newbies, but i'd suggest that changing names doesn't universally solve that problem, since a newbie approaching an existing codebase that uses it (either due to people pinning their versions back or backward-compatible aliases) will still have to make the mapping between that confusing term and whatever new term you use in docs or in ./pants help
flat-zoo-31952
01/14/2021, 8:14 PM