Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest ruff 0.0.266 fails to import #4394

Closed
jaraco opened this issue May 12, 2023 · 13 comments
Closed

Latest ruff 0.0.266 fails to import #4394

jaraco opened this issue May 12, 2023 · 13 comments

Comments

@jaraco
Copy link
Contributor

jaraco commented May 12, 2023

I was working on jaraco/jaraco.packaging#11 when suddenly the tests started failing with ModuleNotFoundError. I traced it to the recent 0.0.266 release:

 ~ $ pip-run -v ruff -- -c "import ruff"
Collecting ruff
  Using cached ruff-0.0.266-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.1 MB)
Installing collected packages: ruff
Successfully installed ruff-0.0.266
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ruff'
@zanieb
Copy link
Member

zanieb commented May 12, 2023

Confirmed this reproduces on 0.0.266 with python -c "import ruff" but not on 0.0.265. @jaraco might be worth updating your title to note that just the Python import is broken. ruff runs fine.

@jaraco jaraco changed the title Latest ruff 0.0.266 is broken Latest ruff 0.0.266 fails to import May 12, 2023
@jaraco
Copy link
Contributor Author

jaraco commented May 12, 2023

I can see the binary there, but no library:

 ~ $ pip-run ruff
Python 3.11.3 (main, Apr  7 2023, 20:13:31) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-h27rhwxt', '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python311.zip', '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11', '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload', '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages']
>>> import pathlib
>>> libs = pathlib.Path(sys.path[1])
>>> list(libs.iterdir())
[PosixPath('/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-h27rhwxt/bin'), PosixPath('/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-h27rhwxt/__pycache__'), PosixPath('/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-h27rhwxt/sitecustomize.py'), PosixPath('/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-h27rhwxt/ruff-0.0.266.dist-info')]
>>> list(libs.joinpath('bin').iterdir())
[PosixPath('/var/folders/sx/n5gkrgfx6zd91ymxr2sr9wvw00n8zm/T/pip-run-h27rhwxt/bin/ruff')]

@jaraco
Copy link
Contributor Author

jaraco commented May 12, 2023

Can I expect a rapid mitigation (fix or yank) or should I invest in working around the issue?

@charliermarsh
Copy link
Member

I'm surprised that import ruff worked before, but I'm guessing this is related to our Maturin upgrade? Gimme a few mins to look into it. Worst-case I will revert the Maturin change and cut a new release.

@zanieb
Copy link
Member

zanieb commented May 12, 2023

@charliermarsh looks like the site-packages/ruff directory is missing.

@jaraco why do you use import ruff?

@edgarrmondragon
Copy link
Contributor

fwiw this is causing problems for nbqa-ruff too

@charliermarsh
Copy link
Member

Alright, I'll go ahead and revert while we figure this out.

python -m ruff file.py is also failing.

@charliermarsh
Copy link
Member

Yanked for now.

@charliermarsh
Copy link
Member

I'll have a new release out within the next hour.

@jaraco
Copy link
Contributor Author

jaraco commented May 12, 2023

Yanked for now.

Super helpful and unblocked my work. Thanks for the super-rapid response.

@charliermarsh
Copy link
Member

Thanks for raising the issue so quickly, and apologies for the churn.

I did do some manual testing of the wheels prior to cutting the release, since we upgraded Maturin, but I didn't test the use of Ruff-as-module, and it turns out we didn't have any automated testing for that either, which @madkinsz has already improved :)

@charliermarsh
Copy link
Member

Fixed in v0.0.267.

@jaraco
Copy link
Contributor Author

jaraco commented May 12, 2023

@jaraco why do you use import ruff?

I use pytest-ruff, which imports ruff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants