cool-easter-32542
05/21/2024, 6:03 PMpackaging module. The resolve python_rasa has packaging<=21.3 in its requirements 3rdparty/requirements/python_rasa.txt and its lock-file "version": "20.9" for packaging.
The BUILD file in project's root folder overrides the resolve to `python_rasa`:
projects/chatbot/BUILD
__defaults__(
{
(python_sources, python_source, python_tests, pex_binaries, pex_binary): dict(
resolve="python_rasa"
)
}
)
resource(name="pyproject", source="pyproject.toml")
As a redundancy, I also pointed out the resolve for the test despite the BUILD in the project's root folder should be enough:
projects/chatbot/tests/BUILD
python_tests(
name="tests",
resolve="python_rasa"
)
Finally, the current test file is currently just printing the `packaging`version as pants run runs just fine and pants test fails due to a packaging version problem on the real test.
projects/chatbot/tests/test_packaging.py
import packaging
print("Packaging version:", packaging.__version__)
from rasa.shared.nlu.training_data.message import Message
def test_placebo():
assert 1 == 1
pants test projects/chatbot/tests/:: prints Packaging version: 23.0 failing with `ImportError: cannot import name 'LegacyVersion' from 'packaging.version'`; class that is deprecated after packaging 21.3. The logs show that pants test builds 3rdparty/lockfiles/python_rasa.lock, which are the correct ones with packaging version 20.9.
Curiously enough, pants run projects/chatbot/tests/test_packaging.py prints Packaging version: 20.9 passing the test.
`pants dependencies --transitive projects/chatbot/tests/test_packaging.py`would return:
3rdparty/lockfiles/python_rasa.lock:_python_rasa_lockfile
3rdparty/requirements/python_rasa.txt:../requirements_rasa
3rdparty:requirements_rasa#es-dep-news-trf
3rdparty:requirements_rasa#packaging
3rdparty:requirements_rasa#rasa
3rdparty:requirements_rasa#spacy
Any idea why is pants test is building packaging 23.0 instead of 20.9?
pantsbuild/pantscool-easter-32542
06/05/2024, 8:47 PM