:jigsaw: I'm seeing this in my test: ```E ...
# development
b
🧩 I'm seeing this in my test:
Copy code
E           ValueError: A target of type PexBinariesFromSourcesGeneratorTarget was proposed at address src/python/foo:pex_binaries with explicit sources main3.py, but this target type does not have a `sources` field.
But in
src/python/pants/backend/python/target_types.py
I have:
Copy code
class PexBinariesFromSourcesGeneratingSourcesField(PythonGeneratingSourcesBase):
    ...

class PexBinariesFromSourcesGeneratorTarget(Target):
    alias = "pex_binaries_from_sources"
    core_fields = (
        ...
        PexBinariesFromSourcesGeneratingSourcesField,
    )
It looks like
PythonGeneratingSourcesBase
should be providing
sources
, 🤔
h
Yeah that's weird. Do you have a WIP PR you can push?
Also see this issue. We will need to figure it out for this PR I think: https://github.com/pantsbuild/pants/issues/12953 A
pex_binary
and now
pex_binaries_from_sources
really does not own the source files. That is, it's not giving metadata for those source files. That's what
python_source
is for. It only is associated with those files
👀 1
b
(one sec, getting auth issues, then I'll push)
(jumping off for the day, I'll be on mobile though for messaging)
👋 1
FYI I think I'm going to re-write this as a macro. I'm thinking it might fall just outside the realm that
python_sources
and friends are in. Happy to hear thoughts though.
h
I think I lean that way. I've been doing a rewrite of https://www.pantsbuild.org/v2.8/docs/targets and it's already tricky enough for users imo to understand targets. Here, the explictiness might be worth the clarity
b
That and I think the impl gets cleaner as well 😂
👍 1
This also sidesteps the ownership issue in the link above 👍
1
h
Oh sorry, miscommunication! I didn't realize you meant the old CAOF API. We're trying to actively kill that - it's not engine safe and does not hook into the file watcher. It's one of our most common confusions I thought you meant you were going to write an internal macro like these https://www.pantsbuild.org/v2.8/docs/macros
but the downside of that would be no one benefits from your new feature, and others might like it
b
Oh man! There goes my work 😅
I don't think this macro needs to hook into the file watcher, right? It's completely inputs -> outputs, no special magic
Let's discuss in PR, trying to get it updated ASAP