proud-dentist-22844
07/11/2021, 9:42 AMfrom ... import *
imports.
This import: https://github.com/st2sandbox/st2/blob/pants/st2common/st2common/services/datastore.py#L22
from st2client.models import KeyValuePair
comes from this file (yes I have [python-infer].inits = true
in pants.toml):
https://github.com/st2sandbox/st2/blob/pants/st2client/st2client/models/__init__.py#L25
from st2client.models.keyvalue import * # noqa
which brings in the transitive dep:
https://github.com/st2sandbox/st2/blob/pants/st2client/st2client/models/keyvalue.py#L26
class KeyValuePair(core.Resource):
If I run the full suite with ./pants lint ::
, pylint succeeds (except for a known real failure somewhere else). But using a narrow target: ./pants lint ./st2common/st2common/services::
pylint fails with:
st2common/st2common/services/datastore.py:22:0: E0611: No name 'KeyValuePair' in module 'st2client.models' (no-name-in-module)
Inspecting the process-execution dir with --no-process-execution-local-cleanup
shows that st2client/st2client/models/keyvalue.py
is not included, which makes sense since it is not directly imported in st2common/st2common/services/datastore.py
.
Is there a way to get *
imports to count as direct imports when pants is putting thing together for pylint?hundreds-father-404
07/11/2021, 3:42 PMproud-dentist-22844
07/11/2021, 4:40 PMproud-dentist-22844
07/11/2021, 4:40 PMproud-dentist-22844
07/11/2021, 8:40 PM*
imports. That made it more consistent and predictable. Plus, now pylint passes on every directory when pants runs it 😄. That's been a long time coming!hundreds-father-404
07/11/2021, 9:40 PMproud-dentist-22844
07/11/2021, 9:48 PMhundreds-father-404
07/11/2021, 10:16 PM