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

Isort5 throws error when stdin used on Windows with deprecated args #1447

Closed
karrtikr opened this issue Sep 1, 2020 · 4 comments · Fixed by #1450
Closed

Isort5 throws error when stdin used on Windows with deprecated args #1447

karrtikr opened this issue Sep 1, 2020 · 4 comments · Fixed by #1450
Labels
bug Something isn't working integration
Milestone

Comments

@karrtikr
Copy link

karrtikr commented Sep 1, 2020

Running type before.py | isort - --diff -sp .isort.cfg prints the following traceback in case deprecated args is used,

Traceback (most recent call last):
  File "C:\Users\karraj\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\karraj\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\karraj\Desktop\imports\.isort5\Scripts\isort.exe\__main__.py", line 9, in <module>
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\main.py", line 828, in main
    api.sort_stream(
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\api.py", line 118, in sort_stream
    changed = sort_stream(
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\api.py", line 137, in sort_stream
    config = _config(path=file_path, config=config, **config_kwargs)
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\api.py", line 381, in _config
    config = Config(**config_kwargs)
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\settings.py", line 423, in __init__
    super().__init__(sources=tuple(sources), **combined_config)  # type: ignore
TypeError: __init__() got an unexpected keyword argument 'remapped_deprecated_args'

I was expecting it to print the same thing when isort --diff before.py -sp .isort.cfg is run,

--- C:\Users\karraj\Desktop\imports\before.py:before    2020-09-01 02:59:53.017777
+++ C:\Users\karraj\Desktop\imports\before.py:after     2020-09-01 04:00:37.012947
@@ -1,3 +1 @@
-from third_party import (lib1, lib2, lib3,
-                         lib4, lib5, lib6,
-                         lib7, lib8, lib9)
+from third_party import lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9
c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\main.py:901: UserWarning: W0502: The following deprecated single dash CLI flags were used and translated: -sp!
  warn(
c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\main.py:910: UserWarning: W0500: Please see the 5.0.0 Upgrade guide: https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/
  warn(

I planned to use the warning codes here but this is a blocker. cc @timothycrosley

@karrtikr
Copy link
Author

karrtikr commented Sep 1, 2020

Adding the following line here should fix the error,

remapped_deprecated_args: FrozenSet[str] = frozenset()

If you agree, will it be possible to make a release with the fix soon? I need it to show the prompt we discussed about.#1363 (comment)

@timothycrosley
Copy link
Member

@karrtikr, thanks for letting me know about this issue! I'll make sure to have a release out shortly (tonight or tomorrow morning) that resolves it.

~Timothy

@karrtikr
Copy link
Author

karrtikr commented Sep 3, 2020

Thanks!

@timothycrosley
Copy link
Member

This change has just been deployed to PyPI in version 5.5.0

Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants