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
Update to isort 5.7 #10287
Comments
Yes isort 5 came out last week and broke CI at my work, I am actually surprised we have not also seen CI issues. Those changes look good to me. |
Turns out this is not as simple as just changing diff --git a/tests/codebase/test_isort.py b/tests/codebase/test_isort.py
index d2aadb305..f3b26ee61 100644
--- a/tests/codebase/test_isort.py
+++ b/tests/codebase/test_isort.py
@@ -31,7 +31,7 @@ def test_isort() -> None:
'''
chdir(TOP_PATH)
- proc = run(["isort", "-df", "-rc", "-c", *ls_files("*.py")], capture_output=True)
+ proc = run(["isort", "--diff", "-c", *ls_files("*.py")], capture_output=True)
assert proc.returncode == 0, f"isort issues:\n{proc.stdout.decode('utf-8')}"
#----------------------------------------------------------------------------- as there are other major differences in how isort works. For example isort v5 will try to make the following changes: - from bokeh.models import Tabs, Panel
+ from bokeh.models import Panel, Tabs
...
-# Bokeh imports
-import bokeh.util.version as buv
from bokeh import __version__
from bokeh.models import Model
from bokeh.resources import _get_cdn_urls
+# Bokeh imports
+from bokeh.util import version as buv etc., so quite invasive. It is therefore probably not possible to support versions 4 and 5 side-by-side. |
@Anthchirp We definitely don't need to support both isort version 4 and version 5. If isort 5 is proposing lots of spurious changes, and can't be configured to behave like the old version, then I am fine just pinning the version to <5 in the conda env files at least for now. The environment files are what ensures everyone runs the expected versions of things for Bokeh dev. |
I would like to understand why CI is passing, and the pre-commit hook fails, because they both run literally the exact same |
The relevant ci test environment specifies bokeh/ci/environment-test-3.7.yml Lines 2 to 4 in bab7326
whereas the development environment says Lines 2 to 3 in bab7326
the conda-forge channel has isort 5.0.9, whereas default =pkgs/main/linux-64 is still with 4.3.21
|
Interesting, I think maybe the dev env file should be updated to match the CI one. As for isort: If there is a configuration for isort 5 that works without us having to change any current imports, I am 👍 to change the env files to specify Thoughts? |
Will have a look and see if I can get isort 5 to work 👍 |
I guess I should add: some small changes would be fine but there's currently alot of noise, e.g. adding import section header to imports inside functions. I have to believe there is a way to turn that off. FYI note we have an |
note that defaults finally picked up isort 5. I have pinned it <5 in #10308 for now |
PyCQA/isort#1604 was closed and is in isort 5.7 so we should be able to update now |
I followed the setup instructions, and the default pre-commit hook fails as follows:
This seems to be caused by isort 5 having changed its command line flags, and the test expecting isort v4.
I'd recommend the following changes
-df
--diff
--df
--diff
-df
to universally accepted--diff
-rc
--recursive
-rc
flag, looks like we pass individual files anyway.The text was updated successfully, but these errors were encountered: