Metadata-Version: 2.4
Name: pytomlcleaner
Version: 1.0.0
Summary: A utility to find and remove unused dependencies in pyproject.toml.
Author: Thien Tran
License: Apache-2.0
Keywords: toml,dependencies,cleanup,pyproject
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tomlkit>=0.12.0
Requires-Dist: tomli>=2.0.1; python_version < "3.11"
Requires-Dist: stdlib-list>=0.10.0
Requires-Dist: black>=25.11.0
Requires-Dist: mypy>=1.19.1
Provides-Extra: dev
Requires-Dist: mypy>=1.8.0; extra == "dev"
Requires-Dist: pytest>=7.4.0; extra == "dev"
Dynamic: license-file

# 🧹 pytomlcleaner

A command-line utility for identifying and optionally removing unused dependencies in your `pyproject.toml` file by statically analyzing your Python codebase. Keep your project dependencies lean and maintainable!

## ✨ Features

* **Static Code Analysis:** Scans your Python source files (`.py`) using the Abstract Syntax Tree (AST) to accurately detect imports.
* **TOML Support:** Correctly parses dependencies specified in `pyproject.toml` (supporting both PEP 621 `[project.dependencies]` and Poetry/Hatch `[tool.*.dependencies]`).
* **Safe Modification:** Uses `tomlkit` to modify the `pyproject.toml` file, preserving existing comments, formatting, and indentation.
* **Python Compatibility:** Supports Python **3.9+**.
* **Standard Library Filtering:** Uses `stdlib-list` to accurately ignore built-in Python modules.

## 📥 Installation

`pytomlcleaner` is available on PyPI.

```bash
pip install pytomlcleaner

```

```bash
uv add pytomlcleaner

```



## 🚀 Usage

To use `pytomlcleaner`, simply run the following command in your terminal:

```bash
pytomlcleaner 
pytomlcleaner --fix
```

