tox-dev / tox-uv

Use https://github.com/astral-sh/uv with tox
MIT License
58 stars 14 forks source link

ModuleNotFoundError: No module named 'pathspec' #13

Closed hugovk closed 6 months ago

hugovk commented 6 months ago

Python 3.8-3.13, PyPy 3.10 Ubuntu, macOS, Windows

Failing to build a wheel for a project using Hatchling. Works with plain tox.

Example on CI: https://github.com/hugovk/tinytext/pull/184

To repro locally:

macOS Python 3.12.2 tox==4.13.0 tox-uv==1.2.0 uv==0.1.3

python -m pip install tox-uv
git clone https://github.com/hugovk/tinytext
cd tinytext
❯ python -m tox -e py312 -vvv -r
ROOT: 61 D setup logging to NOTSET on pid 31451 [tox/report.py:221]
py312: 94 W remove tox env folder /Users/hugo/github/tinytext/.tox/py312 [tox/tox_env/api.py:325]
.pkg: 98 W remove tox env folder /Users/hugo/github/tinytext/.tox/.pkg [tox/tox_env/api.py:325]
py312: 135 W venv> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv venv -p 3.12 /Users/hugo/github/tinytext/.tox/py312/.venv [tox/tox_env/api.py:427]
py312: 143 I exit 0 (0.01 seconds) /Users/hugo/github/tinytext> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv venv -p 3.12 /Users/hugo/github/tinytext/.tox/py312/.venv pid=31452 [tox/execute/api.py:280]
.pkg: 145 W venv> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv venv -p 3.12 /Users/hugo/github/tinytext/.tox/.pkg/.venv [tox/tox_env/api.py:427]
.pkg: 152 I exit 0 (0.01 seconds) /Users/hugo/github/tinytext> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv venv -p 3.12 /Users/hugo/github/tinytext/.tox/.pkg/.venv pid=31453 [tox/execute/api.py:280]
.pkg: 153 W install_requires> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv pip install hatch-vcs hatchling [tox/tox_env/api.py:427]
Resolved 10 packages in 4ms
Installed 10 packages in 6ms
 + editables==0.5
 + hatch-vcs==0.4.0
 + hatchling==1.21.1
 + packaging==23.2
 + pathspec==0.12.1
 + pluggy==1.4.0
 + setuptools==69.1.0
 + setuptools-scm==8.0.4
 + trove-classifiers==2024.1.31
 + typing-extensions==4.9.0
.pkg: 295 I exit 0 (0.14 seconds) /Users/hugo/github/tinytext> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv pip install hatch-vcs hatchling pid=31454 [tox/execute/api.py:280]
.pkg: 296 W _optional_hooks> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build [tox/tox_env/api.py:427]
Backend: run command _optional_hooks with args {}
Backend: Wrote response {'return': {'get_requires_for_build_sdist': True, 'prepare_metadata_for_build_wheel': True, 'get_requires_for_build_wheel': True, 'build_editable': True, 'get_requires_for_build_editable': True, 'prepare_metadata_for_build_editable': True}} to /var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/pep517__optional_hooks-5vpumj3p.json
.pkg: 325 I exit None (0.03 seconds) /Users/hugo/github/tinytext> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build pid=31455 [tox/execute/api.py:280]
.pkg: 325 W get_requires_for_build_sdist> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build [tox/tox_env/api.py:427]
Backend: run command get_requires_for_build_sdist with args {'config_settings': None}
Backend: Wrote response {'return': []} to /var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/pep517_get_requires_for_build_sdist-uv_5aq54.json
.pkg: 372 I exit None (0.05 seconds) /Users/hugo/github/tinytext> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build pid=31455 [tox/execute/api.py:280]
.pkg: 373 W build_sdist> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build [tox/tox_env/api.py:427]
Backend: run command build_sdist with args {'sdist_directory': '/Users/hugo/github/tinytext/.tox/.pkg/dist', 'config_settings': None}
Backend: Wrote response {'return': 'tinytext-3.6.1.dev64.tar.gz'} to /var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/pep517_build_sdist-5fckv4de.json
.pkg: 569 I exit None (0.20 seconds) /Users/hugo/github/tinytext> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build pid=31455 [tox/execute/api.py:280]
.pkg: 570 D package .tmp/package/45/tinytext-3.6.1.dev64.tar.gz links to .pkg/dist/tinytext-3.6.1.dev64.tar.gz (/Users/hugo/github/tinytext/.tox) [tox/util/file_view.py:39]
py312: 570 W install_package> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv pip install --reinstall --no-deps tinytext@/Users/hugo/github/tinytext/.tox/.tmp/package/45/tinytext-3.6.1.dev64.tar.gz [tox/tox_env/api.py:427]
error: Failed to build: tinytext @ file:///Users/hugo/github/tinytext/.tox/.tmp/package/45/tinytext-3.6.1.dev64.tar.gz
  Caused by: Failed to build: tinytext @ file:///Users/hugo/github/tinytext/.tox/.tmp/package/45/tinytext-3.6.1.dev64.tar.gz
  Caused by: Build backend failed to determine extra requires with `build_wheel()`:
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 10, in <module>
  File "/private/var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/.tmpfCgjJD/.venv/lib/python3.12/site-packages/hatchling/build.py", line 41, in get_requires_for_build_wheel
    from hatchling.builders.wheel import WheelBuilder
  File "/private/var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/.tmpfCgjJD/.venv/lib/python3.12/site-packages/hatchling/builders/wheel.py", line 15, in <module>
    from hatchling.builders.config import BuilderConfig
  File "/private/var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/.tmpfCgjJD/.venv/lib/python3.12/site-packages/hatchling/builders/config.py", line 7, in <module>
    import pathspec
ModuleNotFoundError: No module named 'pathspec'
---
py312: 758 C exit 2 (0.19 seconds) /Users/hugo/github/tinytext> /Library/Frameworks/Python.framework/Versions/3.12/bin/uv pip install --reinstall --no-deps tinytext@/Users/hugo/github/tinytext/.tox/.tmp/package/45/tinytext-3.6.1.dev64.tar.gz pid=31461 [tox/execute/api.py:280]
.pkg: 758 W _exit> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build [tox/tox_env/api.py:427]
Backend: run command _exit with args {}
Backend: Wrote response {'return': 0} to /var/folders/p6/lf2s1s5d4kb335g2n1td8z8c0000gn/T/pep517__exit-iv3mxyw_.json
.pkg: 760 I exit None (0.00 seconds) /Users/hugo/github/tinytext> python /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pyproject_api/_backend.py True hatchling.build pid=31455 [tox/execute/api.py:280]
.pkg: 770 D delete package /Users/hugo/github/tinytext/.tox/.tmp/package/45/tinytext-3.6.1.dev64.tar.gz [tox/tox_env/python/virtual_env/package/pyproject.py:207]
  py312: FAIL code 2 (0.68 seconds)
  evaluation failed :( (0.71 seconds)
hugovk commented 6 months ago

More likely an uv bug: https://github.com/astral-sh/uv/issues/1355