thousands-plumber-33255
08/11/2023, 1:40 PM13:08:58.07 [WARN] /my_repo/dist/export/python/virtualenvs/default/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
When I run a test, the following occurs:
13:38:41.75 [WARN] /home/vscode/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/util/resources.py:28: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to <https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy> for migration advice.
return resources.read_binary(package, resource)
thousands-plumber-33255
08/11/2023, 1:51 PM13:47:39.45 [WARN] /home/vscode/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/init/options_initializer.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See <https://setuptools.pypa.io/en/latest/pkg_resources.html>
import pkg_resources
thousands-plumber-33255
08/14/2023, 8:28 AMbitter-ability-32190
08/14/2023, 11:06 AMhappy-kitchen-89482
08/14/2023, 3:00 PMthousands-plumber-33255
08/14/2023, 3:00 PMhappy-kitchen-89482
08/14/2023, 3:14 PMthousands-plumber-33255
08/15/2023, 8:50 AMthousands-plumber-33255
08/15/2023, 8:53 AMthousands-plumber-33255
08/15/2023, 10:01 AMpants export --resolve="['default', 'tools']"
thousands-plumber-33255
08/15/2023, 10:13 AM"/dist/"
is part of pants_ignore
happy-kitchen-89482
08/15/2023, 4:30 PMthousands-plumber-33255
08/16/2023, 6:37 AMactivate
script in the terminal. What I do is defining this symlinked path in my vscode settings file for PYTHONPATH, Pylance and tools (ruff, mypy, ...).thousands-plumber-33255
08/17/2023, 7:03 AMthousands-plumber-33255
08/17/2023, 7:56 AMthousands-plumber-33255
08/17/2023, 10:52 AMthousands-plumber-33255
08/18/2023, 7:12 AMbitter-ability-32190
08/18/2023, 11:27 AMenough-analyst-54434
08/18/2023, 2:17 PMthousands-plumber-33255
08/18/2023, 3:03 PMFile "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/bin/pants", line 8, in <module>
sys.exit(main())
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 123, in main
PantsLoader.main()
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 110, in main
cls.run_default_entrypoint()
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 92, in run_default_entrypoint
exit_code = runner.run(start_time)
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 93, in run
from pants.bin.local_pants_runner import LocalPantsRunner
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 31, in <module>
from pants.init.options_initializer import OptionsInitializer
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/init/options_initializer.py", line 12, in <module>
import pkg_resources
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/my_repo/dist/export/python/virtualenvs/default/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 132, in <module>
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
File "/home/vscode/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/warnings.py", line 109, in _showwarnmsg
sw(msg.message, msg.category, msg.filename, msg.lineno,
File "/my_repo/dist/export/python/virtualenvs/default/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 127, in warn_with_traceback
traceback.print_stack(file=log)
/my_repo/dist/export/python/virtualenvs/default/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py:132: DeprecationWarning: pkg_resources is deprecated as an API
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
thousands-plumber-33255
08/18/2023, 3:19 PMFile "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
res = rule.send(arg) if err is None else rule.throw(throw or err)
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/backend/python/dependency_inference/parse_python_dependencies.py", line 153, in general_parser_script
script_digest = await get_scripts_digest(_scripts_package, ["general_dependency_visitor.py"])
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/backend/python/dependency_inference/parse_python_dependencies.py", line 83, in get_scripts_digest
scripts = [read_resource(scripts_package, filename) for filename in filenames]
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/backend/python/dependency_inference/parse_python_dependencies.py", line 83, in <listcomp>
scripts = [read_resource(scripts_package, filename) for filename in filenames]
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/util/resources.py", line 38, in read_resource
return resources.read_binary(package, resource)
File "/nefino_li/dist/export/python/virtualenvs/default/3.8/lib/python3.8/site-packages/importlib_resources/_legacy.py", line 18, in wrapper
warnings.warn(
File "/home/vscode/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/warnings.py", line 109, in _showwarnmsg
sw(msg.message, msg.category, msg.filename, msg.lineno,
File "/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/util/resources.py", line 34, in warn_with_traceback
traceback.print_stack(file=log)
/home/vscode/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/util/resources.py:38: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to <https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy> for migration advice.
return resources.read_binary(package, resource)
thousands-plumber-33255
08/18/2023, 3:21 PMenough-analyst-54434
08/18/2023, 3:25 PMpkg_resources
and importlib
.enough-analyst-54434
08/18/2023, 3:26 PMthousands-plumber-33255
08/19/2023, 1:55 PMenough-analyst-54434
08/19/2023, 2:07 PM-E
, it will add PYTHONPATH entries, if present in the environment, to sys.path
. This is just how Python works. You'd have to be running code (like Pex) inside that Python interpreter that knew how to scrub such sys.path
entries to then get rid of them. The Pants installation runs in a normal venv without Pex intervening (at least through 2.17.x) and doing sys.path
scrubbing.enough-analyst-54434
08/19/2023, 2:08 PMenough-analyst-54434
08/19/2023, 2:14 PMPYTHONWARNINGS=...
Seems like a ~0 skin off your back solution if you'd rather not contribute Pants patches to fix this for everyone. Since you already are going through the effort to set PYTHONPATH=...
in your IDE, why not set one more env var?