Metadata-Version: 2.4
Name: pep440check
Version: 0.0.4
Summary: Check and normalize PEP 440 version strings in pyproject.toml
Keywords: pep440,python,version,pyproject,packaging,tool
Author: heiwa4126
Author-email: heiwa4126 <heiwa4126@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Dist: packaging
Requires-Python: >=3.10
Project-URL: Documentation, https://github.com/heiwa4126/pep440check#readme
Project-URL: Issues, https://github.com/heiwa4126/pep440check/issues
Project-URL: Source, https://github.com/heiwa4126/pep440check
Description-Content-Type: text/markdown

# pep440check

[![PyPI - Version](https://img.shields.io/pypi/v/pep440check.svg)](https://pypi.org/project/pep440check)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pep440check.svg)
![Last Commit](https://img.shields.io/github/last-commit/heiwa4126/pep440check)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A utility to check if version strings in pyproject.toml's project.version are [PEP 440](https://peps.python.org/pep-0440/) compliant and suggest normalized forms if they are not.
Optionally, it can rewrite the file with the normalized version.

## Basic usage

```sh
pep440check [-h] [-w] [-V] [path]
```

- `path`: path to pyproject.toml (defaults to current directory's pyproject.toml if omitted)
- `-w, --write`: write normalized version back to file
- `-h, --help`: show help message and exit
- `-V, --version`: show program's version number and exit

### Exit codes

- `0`: Version is already PEP 440 compliant (displays "OK")
- `1`: Version needs normalization or error occurred

### Output examples

**When version is already normalized:**

```
$ pep440check
Target: /path/to/pyproject.toml
OK: 0.0.1a1
```

**When version needs normalization:**

```
$ pep440check
Target: /path/to/pyproject.toml
Original version: 1.0.0-rc1
Suggested normalized version: 1.0.0rc1
```

**Writing normalized version:**

```
$ pep440check -w
Target: /path/to/pyproject.toml
Normalized version: 1.0.0-rc1 -> 1.0.0rc1
```

## Installation and Usage

```sh
uv add pep440check --dev
uv run pep440check [args]
```

or

```sh
uvx pep440check [args]
```

or

```sh
uv tool install pep440check
pep440check [args]
```

## Development

```sh
git clone https://github.com/heiwa4126/pep440check.git
cd pep440check
uv sync
```

Run tests:

```sh
uv run poe test
```

Run linter and formatter:

```sh
uv run poe check
```

Type checking:

```sh
uv run poe mypy
```

Build package:

```sh
uv run poe build
```
