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

namespace-packages option stopped working in a recent update #9579

Closed
gokay05 opened this issue Jan 19, 2024 · 8 comments · Fixed by #9603
Closed

namespace-packages option stopped working in a recent update #9579

gokay05 opened this issue Jan 19, 2024 · 8 comments · Fixed by #9603
Assignees
Labels
question Asking for support or clarification

Comments

@gokay05
Copy link

gokay05 commented Jan 19, 2024

When running Ruff with version 0.1.11, namespace-packages option excluded INP001 from being thrown. I recently updated Ruff to 0.1.13 and even though my ruff.toml hasnt changed, I am getting a bunch of INP001 from my test folders and such. I checked the website and I dont see anything change in terms of how the option works, so I think there might be a bug in the new version that effectively breaks namespace-packages.

@charliermarsh
Copy link
Member

Hmm, I don't think we changed anything there in this version range. Are you able to share an example, including the configuration? It's possible that your old setup was working due to caching, since the INP rules have a bug related to caching (and upgrading your Ruff version would clear the cache).

@charliermarsh charliermarsh added the question Asking for support or clarification label Jan 19, 2024
@gokay05
Copy link
Author

gokay05 commented Jan 21, 2024

Here is a small example that reproduces the issue: https://github.com/gokay05/namespace-test

When I run ruff check --config ruff.toml on this repo, I get the errors about the two folders that are in namespace-packages.

image

@charliermarsh
Copy link
Member

Thanks so much for putting together a repro! I'll take a look.

@charliermarsh charliermarsh self-assigned this Jan 21, 2024
@charliermarsh
Copy link
Member

Hm, something about specifying the config explicitly?

namespace-test on  main
❯ ruff check . -n
namespace-test on  main
❯ ruff check . --config ruff.toml -n
namespacepackages/namespacepackages/folder2/file2.py:1:1: INP001 File `namespacepackages/namespacepackages/folder2/file2.py` is part of an implicit namespace package. Add an `__init__.py`.
nonpackage/nonpackagefile.py:1:1: INP001 File `nonpackage/nonpackagefile.py` is part of an implicit namespace package. Add an `__init__.py`.
Found 2 errors.

@charliermarsh
Copy link
Member

Ah sorry, this is indeed a bug, my fault. Thank you so much for filing!

@charliermarsh
Copy link
Member

Fixed in #9603, will go out in the next release.

charliermarsh added a commit that referenced this issue Jan 22, 2024
## Summary

When determining whether _any_ settings have namespace packages, we need
to consider the global settings (as would be provided via `--config`).
This was a subtle fallout of a refactor.

Closes #9579.

## Test Plan

Tested locally by compiling Ruff and running against this
[namespace-test](https://github.com/gokay05/namespace-test) repo.
@gokay05
Copy link
Author

gokay05 commented Jan 22, 2024

Thanks so much!!

@charliermarsh
Copy link
Member

Thank you, I will always fix when there's a clear repro!

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

Successfully merging a pull request may close this issue.

2 participants