quick question. I am in need of producing a wheel ...
# general
b
quick question. I am in need of producing a wheel file that contains it's dependencies as python files and not as separate wheels. I still need to produce wheels of the target source files though. But I am running into and issue where the python_distributions cannot have two owners for the same source. I know that I can use a setup.py to get around this, but I'm looking for something that is a bit more elegant so I don't have to keep up with the dependencies for each of the libraries.
so we have the following A depends on B depends on C. I want A to contain both the code for A and B in the wheel. But I still need to have a separate wheel for B and C.
I may have found a way to do this with resolves and multiple python_sources directives:
Copy code
python_sources(
    name="core_libs_src",
    sources=["riithon_core/**/*.py"],
    resolve="core_libs"
)

#python_sources(
#    name="src",
#    sources=["riithon_core/**/*.py"],
#    resolve=parametrize("core_libs","event_detection")
#)

python_sources(
    name="event_detection_libs_src",
    sources=["riithon_core/**/*.py"],
    resolve="event_detection"
)

python_distribution(
    name = "dist1",
    dependencies = [":core_libs_src"],
    provides=python_artifact(
        name="riithon-core-corenlp-model",
        version="1.0.0"
    ),
    repositories = [ "@rii-dev" ]
)

python_distribution(
    name = "dist2",
    dependencies = [":event_detection_libs_src"],
    provides=python_artifact(
        name="riithon-core-corenlp-model2",
        version="1.0.0"
    ),
    repositories = [ "@rii-dev" ]
)
maybe not.
maybe so. ugly, but it appears you have to have a resolves per src field. Each of these in turn end up being different source targets.
c
ah, yea resolves may do it.. if you need to apply resolves to many targets,
__defaults__
could be useful for you to reduce boiler plate, unless you’re using macros or something like that already.. https://www.pantsbuild.org/docs/targets#field-default-values
b
yes, after testing this totally works. Maybe something can be added to a FAQ or document? I'd like to share, but I'm super swamped.
❤️ 1
I've used parametrize extensively for this particular problem. But the
__defaults__
look like a good solution too.
c
yea, you can combine the two, so you can parametrize the resolve by default, for instance.. 😉