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 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_setupcoderapid-bird-79300
05/02/2023, 6:00 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>.
python_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.pyproject.toml
lives in same directory as the BUILD file target aboveenough-analyst-54434
05/02/2023, 6:43 PM