agreeable-yacht-79448
01/08/2021, 7:58 PMfrom pants.backend.python.goals.setup_py import SetupKwargsRequest
from pants.engine.target import Target
from pants.engine.rules import collect_rules
from pants.engine.unions import UnionRule
from pants.backend.python.goals.setup_py import SetupKwargs
from pants.engine.rules import rule
class CustomSetupKwargsRequest(SetupKwargsRequest):
@classmethod
def is_applicable(cls, _: Target) -> bool:
return True
@rule
async def setup_kwargs_plugin(request: CustomSetupKwargsRequest) -> SetupKwargs:
return SetupKwargs(
{**request.explicit_kwargs, "version": "1.4"}, address=request.target.address
)
def rules():
return [
*collect_rules(),
UnionRule(SetupKwargsRequest, CustomSetupKwargsRequest),
]
And my BUILD file looks like this:
python_distribution(
.....
provides=setup_py(
name="testapp",
version="1.0.3",
),
setup_py_commands=["sdist", "bdist_wheel"]
)
If I try to remove the version="1.0.3" - it complains Missing a version
kwarg in the provides
Am I missing anything?hundreds-father-404
01/08/2021, 8:00 PMGLOBAL
section of your pants.toml
?agreeable-yacht-79448
01/08/2021, 8:02 PM[GLOBAL]
pythonpath = ["%(buildroot)s/pants-plugins"]
And directory structure for pants-plugins looks like this
• pants-plugins
--register.py - will above codehundreds-father-404
01/08/2021, 8:04 PMbackend_packages
path_<http://to.my|to.my>_plugin
?hundreds-father-404
01/08/2021, 8:05 PM<http://logger.info|logger.info>()
inside your @rule
to confirm the plugin is being loadedagreeable-yacht-79448
01/08/2021, 8:08 PM[GLOBAL]
pythonpath = ["%(buildroot)s/pants-plugins"]
pants_version = "2.1.0"
backend_packages = ["pants.backend.python"]
[source]
root_patterns = [
'./lib',
'./apps',
'./pkgs',
'/',
]
hundreds-father-404
01/08/2021, 8:11 PMbackend_packages
as wellwitty-crayon-22786
01/08/2021, 8:11 PMpythonpath
, and as Eric said, you need to mention it in backend_packages
agreeable-yacht-79448
01/08/2021, 8:18 PMagreeable-yacht-79448
01/08/2021, 8:18 PMhundreds-father-404
01/08/2021, 8:18 PMhundreds-father-404
01/13/2021, 4:40 PM