PyCQA / PyCQA/isort

--sort-reexports results in isort not being able to parse file

Open
#2,286 1 comment 1 reaction 2 assignees View on GitHub

@DanielNoord is already working on this.

Since Mar 10, 2026.

Dominant language
Python
Stars
7k
Forks
687
Avg merge
4h 56m
Merged PRs (30d)
2

Description

Python version 3.12
isort version: 5.13.2

Test file test.py:

#!/usr/bin/env python
import importlib.metadata

__all__ = [
    "FooType",
    "BarType",
    "some_method",
]
__version__ = importlib.metadata.version("my-package")

Calling isort --srx test.py results in:

isort/main.py:105: UserWarning: Unable to parse file test.py due to too many values to unpack (expected 2)

The exception is actually triggered here - somehow, both assignments to __all__ and __version__ end up in code.

It works if an empty line between both assignments is introduced (or any other code, for that matter).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.