Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: isort

- repo: https://github.com/hakancelikdev/unimport
rev: 1.3.1
rev: 1.4.0
hooks:
- id: unimport

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
runs:
using: "composite"
steps:
- run: pip install --upgrade pip && python -m pip install unimport==1.3.1
- run: pip install --upgrade pip && python -m pip install unimport==1.4.0
shell: bash
- run: unimport --color auto --gitignore --ignore-init ${{ inputs.extra_args }}
shell: bash
Expand Down
13 changes: 13 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file.

## [1.4.0] - 2026-06-02

### Added

- Python 3.14 support added, including the new `except` clause syntax without
parentheses around exception tuples (PEP 758)
[#326](https://github.com/hakancelikdev/unimport/issues/326)

### Changed

- Raised libcst upper pin from `<=1.8.2` to `<=1.8.6` so the refactor pipeline
can parse and round-trip files using PEP 758 syntax

## [1.3.1] - 2026-02-18

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ process with Unimport.

- **Documentation** https://unimport.hakancelik.dev/
- **Issues** https://github.com/hakancelikdev/unimport/issues/
- **Changelog** https://unimport.hakancelik.dev/1.3.1/CHANGELOG/
- **Changelog** https://unimport.hakancelik.dev/1.4.0/CHANGELOG/
2 changes: 1 addition & 1 deletion docs/tutorial/use-with-github-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v3.5.3
- uses: actions/setup-python@v4.6.1
- name: Check unused imports
uses: hakancelikdev/unimport@1.3.1
uses: hakancelikdev/unimport@1.4.0
with:
extra_args: --include src/
```
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,24 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Environment :: Console",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.9,<3.14"
requires-python = ">=3.9,<3.15"
dependencies = [
"libcst>=0.4.10,<=1.8.2; python_version >= '3.11'",
"libcst>=0.3.7,<=1.8.2; python_version == '3.10'",
"libcst>=0.3.7,<=1.8.2; python_version == '3.9'",
"libcst>=0.4.10,<=1.8.6; python_version >= '3.11'",
"libcst>=0.3.7,<=1.8.6; python_version == '3.10'",
"libcst>=0.3.7,<=1.8.6; python_version == '3.9'",
"pathspec>=0.10.1,<1",
"toml>=0.9.0,<1",
]

[project.urls]
Documentation = "https://unimport.hakancelik.dev/"
Issues = "https://github.com/hakancelikdev/unimport/issues/"
Changelog = "https://unimport.hakancelik.dev/1.3.1/CHANGELOG/"
Changelog = "https://unimport.hakancelik.dev/1.4.0/CHANGELOG/"

[project.optional-dependencies]
docs = [
Expand Down
2 changes: 1 addition & 1 deletion src/unimport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.3.1"
__version__ = "1.4.0"
__description__ = "A linter, formatter for finding and removing unused import statements."
2 changes: 2 additions & 0 deletions src/unimport/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"PY310_PLUS",
"PY312_PLUS",
"PY313_PLUS",
"PY314_PLUS",
"STDLIB_PATH",
"SUBSCRIPT_TYPE_VARIABLE",
)
Expand All @@ -31,6 +32,7 @@
PY310_PLUS = sys.version_info >= (3, 10)
PY312_PLUS = sys.version_info >= (3, 12)
PY313_PLUS = sys.version_info >= (3, 13)
PY314_PLUS = sys.version_info >= (3, 14)

SUBSCRIPT_TYPE_VARIABLE = frozenset(
{
Expand Down
20 changes: 20 additions & 0 deletions tests/cases/analyzer/error/try_except_no_parens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import Union

from unimport.statement import Import, ImportFrom, Name

__all__ = ["NAMES", "IMPORTS", "UNUSED_IMPORTS"]


NAMES: list[Name] = [
Name(lineno=9, name="ValueError", is_all=False),
Name(lineno=9, name="TypeError", is_all=False),
Name(lineno=14, name="ValueError", is_all=False),
Name(lineno=14, name="TypeError", is_all=False),
Name(lineno=14, name="KeyError", is_all=False),
]
IMPORTS: list[Union[Import, ImportFrom]] = [
Import(lineno=5, column=1, name="os", package="os"),
]
UNUSED_IMPORTS: list[Union[Import, ImportFrom]] = [
Import(lineno=5, column=1, name="os", package="os"),
]
14 changes: 14 additions & 0 deletions tests/cases/refactor/error/try_except_no_parens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# pytest.mark.skipif(not PY314_PLUS, reason: "except without parens (PEP 758) is supported above python 3.14")

# https://github.com/hakancelikdev/unimport/issues/326


try:
pass
except ValueError, TypeError:
pass

try:
pass
except ValueError, TypeError, KeyError:
pass
15 changes: 15 additions & 0 deletions tests/cases/source/error/try_except_no_parens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# pytest.mark.skipif(not PY314_PLUS, reason: "except without parens (PEP 758) is supported above python 3.14")

# https://github.com/hakancelikdev/unimport/issues/326

import os

try:
pass
except ValueError, TypeError:
pass

try:
pass
except ValueError, TypeError, KeyError:
pass
4 changes: 2 additions & 2 deletions tests/cases/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

from unimport.analyzers import MainAnalyzer
from unimport.constants import PY310_PLUS, PY312_PLUS, PY313_PLUS # noqa using eval expression
from unimport.constants import PY310_PLUS, PY312_PLUS, PY313_PLUS, PY314_PLUS # noqa using eval expression
from unimport.refactor import refactor_string
from unimport.statement import Import, Name
from unimport.utils import list_paths
Expand Down Expand Up @@ -35,7 +35,7 @@ def test_cases(path: Path, logger):
if (
skip_if
and (condition := skip_if.group("condition"))
and condition in ("not PY310_PLUS", "not PY312_PLUS", "not PY313_PLUS")
and condition in ("not PY310_PLUS", "not PY312_PLUS", "not PY313_PLUS", "not PY314_PLUS")
):
reason = skip_if.group("reason")
pytest.mark.skipif(False, reason, allow_module_level=True)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = 3.9, 3.10, 3.11, 3.12, 3.13, pre-commit
envlist = 3.9, 3.10, 3.11, 3.12, 3.13, 3.14, pre-commit
isolated_build = true

[testenv]
Expand Down
Loading