Metadata-Version: 2.3
Name: bumpuv
Version: 0.0.1
Summary: Version bumping tool for Python projects using pyproject.toml, similar to npm version
Keywords: version,bump,pyproject,git,release,semver
Author: heiwa4126
Author-email: heiwa4126 <heiwa4126@gmail.com>
License: MIT License
         
         Copyright (c) 2025 heiwa4126@gmail.com
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Dist: gitpython>=3.1.0
Requires-Dist: packaging>=21.0
Requires-Dist: tomli>=2.0.0 ; python_full_version < '3.11'
Requires-Dist: tomli-w>=1.0.0
Requires-Dist: colorama>=0.4.0
Requires-Python: >=3.10
Project-URL: Documentation, https://github.com/heiwa4126/bumpuv#readme
Project-URL: Issues, https://github.com/heiwa4126/bumpuv/issues
Project-URL: Source, https://github.com/heiwa4126/bumpuv
Description-Content-Type: text/markdown

# bumpuv

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

English | [日本語](https://github.com/heiwa4126/bumpuv/blob/main/README-ja.md)

A CLI tool similar to `npm version` written in Python. Reference: [npm-version](https://docs.npmjs.com/cli/v11/commands/npm-version)

Performs `npm version`-like operations on pyproject.toml files for [Astral uv](https://docs.astral.sh/uv/) (and poetry, etc. PEP 621 compliant tools). Primarily used for triggering GitHub Actions.

## Installation and Usage

```sh
# Using uv
uv add bumpuv --dev
uv run bumpuv <options>

# Or
uvx bumpuv <options>

# Or
uv tool install bumpuv
bumpuv <options>

# Using pip
pip install bumpuv
bumpuv <options>

# Using poetry
poetry add --group dev bumpuv
poetry run bumpuv <options>
```

## Usage

```console
bumpuv [<newversion> | major | minor | patch | bump] [-n|--dry-run] [-h|--help]
```

### Version Update Types

- `major`: Increment major version by 1 (1.2.3 → 2.0.0)
- `minor`: Increment minor version by 1 (1.2.3 → 1.3.0)
- `patch`: Increment patch version by 1 (1.2.3 → 1.2.4)
- `bump`: Default. Same as patch for normal versions, increment number by 1 for pre-release versions (1.2.3a1 → 1.2.3a2)
- `<newversion>`: Explicit version specification (converted to PEP 440 compliant format)

### Options

- `-n, --dry-run`: Show what would be done without making changes. No prior commit required
- `-h, --help`: Show help message

## Examples

### Basic Usage

```sh
# Increment patch version (1.0.0 → 1.0.1)
bumpuv patch

# Increment minor version (1.0.1 → 1.1.0)
bumpuv minor

# Increment major version (1.1.0 → 2.0.0)
bumpuv major

# Default behavior (same as bump)
bumpuv
```

### Explicit Version Specification

```sh
# Set to specific version
bumpuv 1.5.0

# Set to pre-release version
bumpuv 2.0.0a1

# Release candidate
bumpuv 1.0.0rc1
```

### Pre-release Version Management

```sh
# Increment pre-release number (1.0.0a1 → 1.0.0a2)
bumpuv bump

# From pre-release to stable (explicit specification)
bumpuv 1.0.0
```

### Dry-run Mode

```sh
# Check changes (no actual changes made)
bumpuv patch -n
bumpuv minor --dry-run
```

### Output Examples

```console
$ bumpuv patch
Updated: /path/to/project/pyproject.toml
Version: 1.0.0 → 1.0.1
Commit: 1.0.1
Tag: v1.0.1

$ bumpuv 2.0.0a1
Updated: /path/to/project/pyproject.toml
Version: 1.0.1 → 2.0.0a1
Commit: 2.0.0a1
Tag: test-2.0.0a1
```

## Specification

### Basic Behavior

- Default is equivalent to `bumpuv bump`
- PEP 440 compliant version management
- Same version and downgrades are not allowed
  - Downgrade example: `1.0.0` > `1.0.0a1`
- Switching between pre-release and normal versions requires explicit version specification
  - Example: `1.0.0` → `1.1.0a1` requires `bumpuv 1.1.0a1`
  - Example: `1.0.0a1` → `1.0.0` requires `bumpuv 1.0.0`

### Git Integration

- **Important**: All changes must be committed beforehand
- After updating pyproject.toml in current directory, automatically commits and creates tags
  - Commit message: New version number
  - Tag: `v{version}` for normal versions, `test-{version}` for pre-release versions
- Does not perform `git push`. You must manually run `git push` and `git push --tags`

### Error Conditions

- pyproject.toml does not exist in current directory
- project.version does not exist or is not PEP 440 compliant
- Not a git repository
- Uncommitted changes exist (warning only in dry-run mode)

### Limitations

- Configuration files not supported
- Monorepo support not implemented

## Similar Tools

- [npm-version](https://docs.npmjs.com/cli/v11/commands/npm-version)
- [pybump](https://pypi.org/project/pybump/)
- [bump2version](https://pypi.org/project/bump2version/)
- [bump-my-version](https://pypi.org/project/bump-my-version/)
- [bumpver](https://pypi.org/project/bumpver/)

## Development

### Setup

```bash
uv sync
```

### Task Execution

```bash
# Run tests
poe test

# Lint
poe check

# Type check
poe mypy

# Run all checks & build & smoke test
poe build
```

### Development Requirements

- uv
- Python == 3.12, 3.10 (for test)

## License

MIT
