loud-laptop-17949
05/19/2022, 4:24 PM./pants lint --changed-since=master
...
src/util/celery.py:25:0: E0401: Unable to import 'raven.contrib.celery' (import-error)
But when running directly it works:
./pants lint src/util/celery.py
...
ā black succeeded.
ā isort succeeded.
ā pylint succeeded.
loud-laptop-17949
05/19/2022, 4:26 PM$ ./pants dependencies src/util/celery.py | grep raven
3rdparty#raven
src/django_projects/settings/raven.py
loud-laptop-17949
05/19/2022, 4:26 PMbitter-ability-32190
05/19/2022, 4:33 PM--no-process-cleanup
and then crack open the sandbox. From there invoke the python interpreter (there'll be a "shim" script which you run which is spiritually python
).
Then try to import the submodule.
Then do it again without --changed-since
bitter-ability-32190
05/19/2022, 4:35 PMpython
was able to import the submodule, but when accessing it as an attribute of the parent module it failed.
...only in some sandboxes though. SO not exactly the same issue.
How I sleep at night is assuming some other code imported the submodule and got linted first. Then sys.modules
or something equivalent was populated in such a way that the offending file could access the submodule correctly.
When being linted alone, that was no longer the case.bitter-ability-32190
05/19/2022, 4:36 PMmypy
, which I trust reasonably well to be authentic)loud-laptop-17949
05/19/2022, 4:36 PMloud-laptop-17949
05/19/2022, 4:36 PMbitter-ability-32190
05/19/2022, 4:37 PMipython
but you can use the python interpreter.
The __run.sh
script uses a shell file as it's "python". sniff at that run script to find itloud-laptop-17949
05/19/2022, 4:37 PMbitter-ability-32190
05/19/2022, 4:38 PM$'--python-executable=./requirements_venv.pex_bin_python_shim.sh'
bitter-ability-32190
05/19/2022, 4:38 PMloud-laptop-17949
05/19/2022, 4:46 PMloud-laptop-17949
05/19/2022, 4:47 PM$ ls
__plugins pylint.pex pylint_runner.pex_bin_python_shim.sh reports src
__run.sh pylint_runner.pex pylint_runner.pex_pex_shim.sh requirements.pex
bitter-ability-32190
05/19/2022, 4:47 PM__run.sh
is usingbitter-ability-32190
05/19/2022, 4:48 PMpylint_runner.pex_bin_python_shim.sh
loud-laptop-17949
05/19/2022, 4:48 PMpylint_runner.pex_pex_shim.sh
. I can run that an get an invocation of pylint
. trying to figure out how to tell it to give me python
insteadbitter-ability-32190
05/19/2022, 4:48 PMbitter-ability-32190
05/19/2022, 4:49 PMmypy
, which is being told a py executablebitter-ability-32190
05/19/2022, 4:49 PMwitty-crayon-22786
05/19/2022, 4:51 PMpylint
?witty-crayon-22786
05/19/2022, 4:51 PMloud-laptop-17949
05/19/2022, 4:51 PMloud-laptop-17949
05/19/2022, 4:51 PMloud-laptop-17949
05/19/2022, 4:55 PMbitter-ability-32190
05/19/2022, 4:55 PMloud-laptop-17949
05/19/2022, 5:03 PM>>> import raven.contrib.celery
>>>
loud-laptop-17949
05/19/2022, 5:03 PMloud-laptop-17949
05/19/2022, 5:04 PM>>> import src.util.celery
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/private/var/folders/77/r5wzbyf101vd27rfq9__chyc0000gq/T/process-executiong1J3XY/src/util/celery.py", line 21, in <module>
from color_django_extensions import honeycomb_utils
ModuleNotFoundError: No module named 'color_django_extensions'
bitter-ability-32190
05/19/2022, 5:04 PMpylint
uses astroid
for parsing files and handling imports and stuff, and there be lots of bugs there šloud-laptop-17949
05/19/2022, 5:05 PM./pants dependencies src/util/celery.py
3rdparty#celery
3rdparty#ddtrace
3rdparty#django
3rdparty#honeycomb-beeline
3rdparty#psutil
3rdparty#raven
3rdparty/internal:clrenv
src/__init__.py
src/color_django_extensions/honeycomb_utils.py
src/django_projects/settings/raven.py
src/util/__init__.py
src/util/common.py:common
src/util/sentry.py
src/util/tasks.py
bitter-ability-32190
05/19/2022, 5:06 PMModuleNotFoundError: No module named 'color_django_extensions'
probably due to source root stripping perhaps? š¤·āāļøloud-laptop-17949
05/19/2022, 5:06 PMloud-laptop-17949
05/19/2022, 5:13 PMpylint disable
. but I would like to leave a paper trail that I can link to? ok if I file a github issue?bitter-ability-32190
05/19/2022, 5:14 PMbitter-ability-32190
05/19/2022, 5:14 PMbitter-ability-32190
05/19/2022, 5:14 PMastroid
is to blame š
loud-laptop-17949
05/19/2022, 5:17 PMloud-laptop-17949
05/19/2022, 5:17 PMloud-laptop-17949
05/19/2022, 5:17 PMhappy-kitchen-89482
05/19/2022, 5:29 PMhappy-kitchen-89482
05/19/2022, 5:29 PMPEX_INTERPRETER=1 ./name_of_shim.sh
loud-laptop-17949
05/19/2022, 5:30 PM