ambitious-actor-36781
06/22/2021, 7:06 AMversion on setup.py for when you run pants package
But it's hardcoded and not entirely helpful. Is there an easy way to add a --version flag to the package goal?
oh ding, this is ez.
Create a new "subsystem" give it a "--version" option. Then in your rule that modifys your setup.py options use request your subsystem type (via typed dependency-injection) and 💥 ezpzhundreds-father-404
06/22/2021, 8:38 AMambitious-actor-36781
06/22/2021, 8:46 AMCommon mistake: requesting the type of target you want in the @goal_rule signature
Doesn't seem to be picking up my targets that are a type of CompanynamePythonDistribution(Target)hundreds-father-404
06/22/2021, 8:53 AMambitious-actor-36781
06/22/2021, 8:57 AMCompanynamePythonDistribution target subtypes (that overwrites the version number)
Run twine or whatev to upload it to pypiambitious-actor-36781
06/22/2021, 8:58 AM./pants package --company-version=1234.00 will spit out a file with that as the version numberambitious-actor-36781
06/22/2021, 8:59 AMclass InfloaiPublishPySubsystem(GoalSubsystem):
name = "company-publish-py"
help = "Publish company python packages"
class CompanyPublishPy(Goal):
subsystem_cls = CompanyPublishPySubsystem
async def _publish(console: Console, distribution: Target):
console.print_stdout("Publishing:", distribution)
@goal_rule
async def company_publish_py(console: Console, targets: Targets) -> CompanyPublishPy:
for target in targets:
console.print_stdout(f"X {target!r}")
if not target.has_field(CompanyPythonDistribution):
continue
await _publish(console, target)
return CompanyPublishPy(exit_code=1)
./pants company-publish ::
loops through all the targets, but doesn't pick up the targetsambitious-actor-36781
06/22/2021, 9:07 AMambitious-actor-36781
06/22/2021, 9:11 AMisinstance(target, CompanyPythonDistribution) is wrong?ambitious-actor-36781
06/22/2021, 9:21 AM