Q19: When I run `./pants run src/ai/backend/manage...
# general
r
Q19: When I run
./pants run src/ai/backend/manager:server
(a
pex_binary()
target which depends on
python_sources()
target) or
./pants run src/ai/backend/manager/server.py
, it says
importlib.metadata.PackageNotFoundError: No package metadata was found for backend.ai-manager
with the following
__init__.py
. How do I make the package version information available in this case?
1
The pex binary seems to have missing dependencies (reqs were not explicitly propagated?).. hmm
I'm currently workarounding this by
__version__ = "<http://0.0.0.dev|0.0.0.dev>"
which may break in my API implementation's version check routines...
w
is the version loaded from a resource/file? what are you expecting it to be computed from?
if it’s supposed to be a resource, then you need to make sure that your target has a (transitive) dependency on a
resources
target covering the file
👍 1
if it’s something that you’re expecting to be provided by a dist (i.e., you’re expecting a wheel to be built, and for it to have a version via setup.py/etc), then you’d need to depend on a
python_distribution
👍 1
r
hmm. When I try to refer the VERSION file in the repository root in
resources()
of pkg-specific BUILD files, it says
Exception: Absolute paths not supported: "//:version"
i've tried to create a symbolic link from
src/ai/backend/common/VERSION
to
VERSION
, but it seems not to be recognized by pants (in
./pants peek
and
./pants dependencies
)
ah, that's my mistake to put dependency in sources key.
using symlinks resolved the issue!
w
in many cases you can use multiple
resources
targets rather than symlinks, but yea: glad it’s working.