Hey folks, I’m looking for advice for how to confi...
# general
m
Hey folks, I’m looking for advice for how to configure pants to create
dist-info
for packages from within my monorepo when creating an AWS lambda. My code uses
importlib.metadata.version
to grab version details dynamically from my packages; it works beautifully locally (grabbing details from the
pyproject.toml
file), but without the
-dist-info
folders in my built lambda, my code has no version information to read. This is illustrated by the fact that
poetry run pytest
completes successfully, but
pants test ::
fails with:
importlib.metadata.PackageNotFoundError: No package metadata was found for my_package
Any pointers?
My current hack is to use
vcs_version
to create a
version.py
for each of the ~20 packages I want to read versions of, with a template like `__version__ = "{version}".split("+")[0]`; then have
__init__.py
import it. Then all I need to do is find a way to access
package.__version__
when I have the name of the module, but that feels doable. …but these packages are currently managed by other people, and I’d have to take partial ownership of them to ensure this boilerplate was present in all of them… which Id’ rather not do if I can avoid it! …and also, some of my tests don’t work, as I can’t make a different package’s tests dependent on the
vcs_version
goal in these packages. 😕