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

Formatter incompatibility: ellipses are not inlined in .py files #7440

Closed
Tracked by #6935
charliermarsh opened this issue Sep 16, 2023 · 2 comments · Fixed by #8044
Closed
Tracked by #6935

Formatter incompatibility: ellipses are not inlined in .py files #7440

charliermarsh opened this issue Sep 16, 2023 · 2 comments · Fixed by #8044
Assignees
Labels
formatter Related to the formatter preview Related to preview mode features

Comments

@charliermarsh
Copy link
Member

Given:

def f(): ...

def f():
    ...

def f():
    """Docstring"""
    ...

Recent versions of Black format as:

def f(): ...


def f(): ...


def f():
    """Docstring"""
    ...

While Ruff formats as:

def f():
    ...


def f():
    ...


def f():
    """Docstring"""
    ...

This changed in Black 23.9.0 (psf/black#3796).

@charliermarsh charliermarsh added formatter Related to the formatter accepted Ready for implementation labels Sep 16, 2023
@charliermarsh
Copy link
Member Author

Ahh sorry, this in preview. I didn't realize Poetry was using preview style.

@charliermarsh charliermarsh removed the accepted Ready for implementation label Sep 16, 2023
@charliermarsh charliermarsh added this to the Formatter: Beta milestone Sep 16, 2023
@charliermarsh
Copy link
Member Author

@MichaReiser - Do we close? Or is there a separate milestone or tag for these?

@MichaReiser MichaReiser added the preview Related to preview mode features label Sep 16, 2023
@konstin konstin self-assigned this Oct 20, 2023
konstin added a commit that referenced this issue Oct 26, 2023
**Summary** Prepare for the black preview style becoming the black
stable style at the end of the year.

This adds a new test file to compare stable and preview on some relevant
preview options in black, and makes `format_dev` understand the black
preview flag. I've added poetry as a project that uses preview.

I've implemented one specific deviation (collapsing of stub
implementation in non-stub files) which showed up in poetry for testing.
This also improves poetry compatibility from 0.99891 to 0.99919.

Fixes #7440

New compatibility stats:
| project | similarity index | total files | changed files |

|----------------|------------------:|------------------:|------------------:|
| cpython | 0.75803 | 1799 | 1647 |
| django | 0.99983 | 2772 | 35 |
| home-assistant | 0.99953 | 10596 | 189 |
| poetry | 0.99919 | 317 | 12 |
| transformers | 0.99963 | 2657 | 332 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99978 | 3669 | 20 |
| warehouse | 0.99969 | 654 | 15 |
| zulip | 0.99970 | 1459 | 22 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants