hi all. recently i was frustrated with either havi...
# general
g
hi all. recently i was frustrated with either having to add a bunch of
module_mappings
manually to a
python_requirements
and/or having to do a PR for every one that might belong in
DEFAULT_MODULE_MAPPING
. initially this problem is because
google.cloud.*
is mapped to a library/package called
google-cloud-*
. there are like 1 billion
google-cloud
services, and it would be cumbersome to add everyone and still require changes constantly. looks like
azure-mgmt
,
django-*
,
opentelemetry-instrumentation-*
,
python-*
,
oslo-*
, and
scikit-*
are already in the
DEFAULT_MODULE_MAPPING
and could all be dealt with a single regex/glob instead of many entries. Relevant Issue with a quick sample code.
👍 2
🙏 1
thanks for the feedback so far. here is a draft PR with one way to accomplish this. just finding testing it a bit hard. so far for testing i have a project locally that installs 1 package from the group above, a python file that imports and "accesses" the packages(usually just a
print(package)
)and then a
pants run ...
a pex for that file. if no errors, i call it a win. there is a test,
src/python/pants/backend/python/dependency_inference/module_mapper_test.py
that looks particularly applicable. but i'm unable to run it with a command like
pants test src/python/pants/backend/python/dependency_inference:tests
was able to figure out the tests and added a few. PR is out of draft status. looking for feedback. even if the feedback is, "nah bro. no good." 🙂