ancient-vegetable-10556
08/11/2022, 9:34 PM__init__.py
file in the pants
namespace package to make resource loading work (per a deficiency in early versions of importlib.resources
. I’ve successfully made pants
an explicit namespace package, and removed the code from conftest
that checks that there is no __init__.py
file; I didn’t quite grok the consequences of there being an __init__.py
file present in both of our wheel distributions, but it looks like it’s fine if they’re identical. Are we OK to ship this particular package layout change? See conftest.py
(cc @enough-analyst-54434)happy-kitchen-89482
08/11/2022, 9:36 PMpants
remain a namespace package, which it was before thanks to PEP 420. So I think that as long as there is a pkgutil namespace package incantation in the new __init__.py
then everything should still work.happy-kitchen-89482
08/11/2022, 9:37 PMancient-vegetable-10556
08/11/2022, 9:37 PMhappy-kitchen-89482
08/11/2022, 9:38 PMhappy-kitchen-89482
08/11/2022, 9:39 PMpantsbuild.testutils
and pantsbuild.pants
wheels in a clean venv and making sure that you can import from bothancient-vegetable-10556
08/11/2022, 9:40 PMbitter-ability-32190
08/11/2022, 9:42 PMancient-vegetable-10556
08/11/2022, 9:45 PMLast login: Tue Aug 9 12:54:03 on ttys013
chrisjrn@chrisjrns-MacBook-Pro ~ % python3.9 -m venv ./venvs/pants-namespace-pac
kage-flobble
chrisjrn@chrisjrns-MacBook-Pro ~ % source ./venvs/pants-namespace-package-flobble/bin/activate
(pants-namespace-package-flobble) chrisjrn@chrisjrns-MacBook-Pro ~ % pip install
src/pants/dist/pantsbuild.pants-2.14.0.dev5-cp39-cp39-macosx_12_0_arm64.whl
Processing ./src/pants/dist/pantsbuild.pants-2.14.0.dev5-cp39-cp39-macosx_12_0_arm64.whl
Collecting setuptools<64.0,>=63.1.0
... [SNIP]
Using cached urllib3-1.26.11-py2.py3-none-any.whl (139 kB)
Installing collected packages: types-toml, types-setuptools, types-PyYAML, ijson, ansicolors, urllib3, ujson, typing-extensions, toml, six, setuptools, setproctitle, PyYAML, pyparsing, psutil, pex, idna, charset-normalizer, certifi, requests, python-lsp-jsonrpc, packaging, fasteners, humbug, pantsbuild.pants
Attempting uninstall: setuptools
Found existing installation: setuptools 62.3.2
Uninstalling setuptools-62.3.2:
Successfully uninstalled setuptools-62.3.2
Successfully installed PyYAML-6.0 ansicolors-1.1.8 certifi-2022.6.15 charset-normalizer-2.1.0 fasteners-0.16.3 humbug-0.2.7 idna-3.3 ijson-3.1.4 packaging-21.3 pantsbuild.pants-2.14.0.dev5 pex-2.1.103 psutil-5.9.0 pyparsing-3.0.9 python-lsp-jsonrpc-1.0.0 requests-2.28.1 setproctitle-1.2.2 setuptools-63.4.3 six-1.16.0 toml-0.10.2 types-PyYAML-6.0.3 types-setuptools-62.6.1 types-toml-0.10.8 typing-extensions-4.3.0 ujson-5.4.0 urllib3-1.26.11
WARNING: There was an error checking the latest version of pip.
(pants-namespace-package-flobble) chrisjrn@chrisjrns-MacBook-Pro ~ % pip install dist/pantsbuild.pants.testutil-2.14.0.dev5.tar.gz
WARNING: Requirement 'dist/pantsbuild.pants.testutil-2.14.0.dev5.tar.gz' looks like a filename, but the file does not exist
Processing ./dist/pantsbuild.pants.testutil-2.14.0.dev5.tar.gz
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/Users/chrisjrn/dist/pantsbuild.pants.testutil-2.14.0.dev5.tar.gz'
WARNING: There was an error checking the latest version of pip.
(pants-namespace-package-flobble) chrisjrn@chrisjrns-MacBook-Pro ~ % pip install src/pants/dist/pantsbuild.pants.testutil-2.14.0.dev5.tar.gz
Processing ./src/pants/dist/pantsbuild.pants.testutil-2.14.0.dev5.tar.gz
Preparing metadata (setup.py) ... done
Requirement already satisfied: pantsbuild.pants==2.14.0.dev5 in ./venvs/pants-namespace-package-flobble/lib/python3.9/site-packages (from pantsbuild.pants.testutil==2.14.0.dev5) (2.14.0.dev5)
... [SNIP]
Requirement already satisfied: charset-normalizer<3,>=2 in ./venvs/pants-namespace-package-flobble/lib/python3.9/site-packages (from requests->humbug==0.2.7->pantsbuild.pants==2.14.0.dev5->pantsbuild.pants.testutil==2.14.0.dev5) (2.1.0)
Using legacy 'setup.py install' for pantsbuild.pants.testutil, since package 'wheel' is not installed.
Installing collected packages: iniconfig, tomli, py, pluggy, attrs, pytest, pantsbuild.pants.testutil
Running setup.py install for pantsbuild.pants.testutil ... done
Successfully installed attrs-22.1.0 iniconfig-1.1.1 pantsbuild.pants.testutil-2.14.0.dev5 pluggy-1.0.0 py-1.11.0 pytest-7.0.1 tomli-2.0.1
WARNING: There was an error checking the latest version of pip.
(pants-namespace-package-flobble) chrisjrn@chrisjrns-MacBook-Pro ~ % python
Python 3.9.13 (main, May 24 2022, 21:13:54)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pants.testutil import pytest_util
>>> from pants import version
>>> from pants.bin import pants_loader
>>>
ancient-vegetable-10556
08/11/2022, 9:45 PMenough-analyst-54434
08/11/2022, 10:57 PMenough-analyst-54434
08/11/2022, 10:57 PMenough-analyst-54434
08/11/2022, 10:58 PMpex ./one.whell ./other.wheel
- that will drop you in a repl with each installed indivudally and added to sys,path individually.enough-analyst-54434
08/11/2022, 10:59 PM-v
to get the synthesized sys.path printed out before you drop in the repl to have confidence it's a good test.enough-analyst-54434
08/11/2022, 11:05 PMancient-vegetable-10556
08/12/2022, 5:27 PMsys.path
entries. Subpackages work fine, but modules and resources do not. I’ll be working on a minimal reproduction and filing a bug.enough-analyst-54434
08/12/2022, 5:28 PMancient-vegetable-10556
08/12/2022, 5:28 PMsite-packages
directory, and things look like a normal single root package tree.enough-analyst-54434
08/12/2022, 5:28 PMancient-vegetable-10556
08/12/2022, 5:29 PMancient-vegetable-10556
08/12/2022, 5:30 PMhappy-kitchen-89482
08/12/2022, 5:30 PMenough-analyst-54434
08/12/2022, 5:30 PMenough-analyst-54434
08/12/2022, 5:30 PMenough-analyst-54434
08/12/2022, 5:31 PMancient-vegetable-10556
08/12/2022, 5:31 PMhappy-kitchen-89482
08/12/2022, 5:31 PMsite-packages
ancient-vegetable-10556
08/12/2022, 5:31 PMancient-vegetable-10556
08/12/2022, 5:32 PMenough-analyst-54434
08/12/2022, 5:32 PMancient-vegetable-10556
08/12/2022, 5:32 PMancient-vegetable-10556
08/12/2022, 5:32 PMhappy-kitchen-89482
08/12/2022, 5:33 PMancient-vegetable-10556
08/12/2022, 5:36 PMancient-vegetable-10556
08/12/2022, 5:36 PMenough-analyst-54434
08/12/2022, 5:38 PMancient-vegetable-10556
08/12/2022, 5:38 PMpants/VERSION
into both wheelsenough-analyst-54434
08/12/2022, 5:38 PMancient-vegetable-10556
08/12/2022, 5:38 PMpants/VERSION
is hardcoded in the runner script, so moving it would inconvenience a lot of peopleancient-vegetable-10556
08/12/2022, 5:39 PMpants/VERSION
is hardcoded, that is)ancient-vegetable-10556
08/12/2022, 5:39 PMancient-vegetable-10556
08/12/2022, 5:40 PMhappy-kitchen-89482
08/12/2022, 6:51 PMpants
script only cares about the VERSION location when you use set PANTS_SHA, I think?happy-kitchen-89482
08/12/2022, 6:51 PMbitter-ability-32190
08/12/2022, 6:51 PMhappy-kitchen-89482
08/12/2022, 6:54 PMpants
script for as long as we need to roll out an update to that. And in any case, even if it breaks a few people, it’s only (AFAICT) if they set PANTS_SHA, which is rare, and we can tell them to upgrade the pants
script. Which we will be pushing people to do at some point anyway in order to consume the new pyoxidized pants binary…happy-kitchen-89482
08/12/2022, 6:55 PMpants
script appears to only care about the location of VERSION at a public github URL and even that only when using PANTS_SHA. So the blast radius of changing the canonical location of VERSION (so it can be loaded by importlib without resorting to funkiness) is way smaller than I thought.ancient-vegetable-10556
08/12/2022, 7:54 PMancient-vegetable-10556
08/12/2022, 7:54 PM