rapid-bird-79300
05/02/2023, 5:34 PMVERSION = importlib.metadata.version("my_pkg")
When running with Pants environments we get
E importlib.metadata.PackageNotFoundError: my_pkg
I found some older thread that suggested to use python_distribution but it seems version
needs to be hardcoded there but we would prefer to leave version in the pyproject.toml
. Is there any other ways we can do that with pyproject.toml?enough-analyst-54434
05/02/2023, 5:41 PMenough-analyst-54434
05/02/2023, 5:46 PMrapid-bird-79300
05/02/2023, 5:48 PMenough-analyst-54434
05/02/2023, 5:52 PMpython_distribution
without repeating the version via: https://www.pantsbuild.org/docs/reference-python_distribution#codegenerate_setupcodeenough-analyst-54434
05/02/2023, 5:56 PMrapid-bird-79300
05/02/2023, 6:00 PMrapid-bird-79300
05/02/2023, 6:34 PMpants.backend.python.goals.setup_py.InvalidSetupPyArgs: Missing a `version` kwarg in the `provides` field for tools/python/my-pkg:dist. See <https://www.pantsbuild.org/v2.14/docs/python-distributions>.
rapid-bird-79300
05/02/2023, 6:35 PMrapid-bird-79300
05/02/2023, 6:38 PMpython_distribution(
name="dist",
provides=python_artifact(
name="my-pkg",
),
generate_setup=False,
)
and added the dependency on the targets that call importlib
but still seeing same error.rapid-bird-79300
05/02/2023, 6:39 PMpyproject.toml
lives in same directory as the BUILD file target aboveenough-analyst-54434
05/02/2023, 6:43 PM