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

AttributeError: module 'flynt' has no attribute 'process' #541

Closed
hugovk opened this issue Feb 27, 2024 · 5 comments
Closed

AttributeError: module 'flynt' has no attribute 'process' #541

hugovk opened this issue Feb 27, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@hugovk
Copy link
Contributor

hugovk commented Feb 27, 2024

Describe the bug

I get AttributeError when running Darker.

To Reproduce
Steps to reproduce the behavior:

  1. pip install -U darker flynt
  2. Run Darker with darker .
  3. See error / wrong behavior
❯ ❯ darker --help
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/darker", line 5, in <module>
    from darker.__main__ import main_with_error_handling
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/darker/__main__.py", line 25, in <module>
    from darker.fstring import apply_flynt, flynt
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/darker/fstring.py", line 14, in <module>
    flynt_fstringify_code_by_line = flynt.process.fstringify_code_by_line
                                    ^^^^^^^^^^^^^
AttributeError: module 'flynt' has no attribute 'process'

Expected behavior

No AttributeError.

Environment (please complete the following information):

  • OS: macOS Sonoma 14.2.1
  • Python version 3.12.2
  • Git version 2.44.0
  • Darker version 1.7.3
  • Black version 24.1.1

Additional context

Started happening between 1.6.1 and 1.7.0.

git bisect points to f8f9e4c in PR #308.

f8f9e4c3f692917536603ccbb911777447748e30 is the first bad commit
commit f8f9e4c3f692917536603ccbb911777447748e30
Author: Antti Kaihola <[email protected]>
Date:   Mon Dec 26 17:55:21 2022 +0200

    Implement `flynt` support

 src/darker/__main__.py                             | 247 +++++++++++++++------
 src/darker/config.py                               |   2 +
 src/darker/diff.py                                 |   3 +
 src/darker/fstring.py                              |  75 +++++++
 src/darker/git.py                                  |   2 +
 src/darker/linting.py                              |  10 +
 src/darker/tests/test_command_line.py              |  14 +-
 src/darker/tests/test_fstring.py                   |  50 +++++
 src/darker/tests/test_main.py                      | 132 ++++++++---
 .../test_main_blacken_and_flynt_single_file.py     | 133 +++++++++++
 src/darker/tests/test_main_blacken_single_file.py  | 130 -----------
 11 files changed, 568 insertions(+), 230 deletions(-)
 create mode 100644 src/darker/fstring.py
 create mode 100644 src/darker/tests/test_fstring.py
 create mode 100644 src/darker/tests/test_main_blacken_and_flynt_single_file.py
 delete mode 100644 src/darker/tests/test_main_blacken_single_file.py
@akaihola
Copy link
Owner

Thanks @hugovk!

Which version of Flynt do you have? What if you downgrade it, can you find an earlier version which doesn't make Darker fail?

@akaihola akaihola added the bug Something isn't working label Feb 28, 2024
@akaihola
Copy link
Owner

Also, could you check whether #480 fixes this?

@hugovk
Copy link
Contributor Author

hugovk commented Feb 28, 2024

Reproducible with Flynt 1.0.0 and 1.0.1, not with 0.78.

And yes, #480 fixes it :)

@akaihola
Copy link
Owner

And yes, #480 fixes it :)

Ok, that's planned for version 2.1.0.

@akaihola
Copy link
Owner

Duplicate of #472.

@akaihola akaihola closed this as not planned Won't fix, can't repro, duplicate, stale Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants