Metadata-Version: 2.4
Name: uvedit
Version: 1.0.0
Summary: Tool to switch `uv` dependencies between local editable checkouts and remote git sources.
Author: Martijn de Milliano, Max Suurland
License-Expression: MIT
Project-URL: Repository, https://github.com/mjdemilliano/uvedit
Project-URL: Issues, https://github.com/mjdemilliano/uvedit/issues
Keywords: uv,uv-sources
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Developers
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tomlkit
Provides-Extra: extra
Requires-Dist: argcomplete; extra == "extra"
Dynamic: license-file

# uvedit

Switch `uv` dependencies between local editable checkouts and remote git sources.

Useful when you are a developer of a package that another project depends on via a git source, and you want to work on both simultaneously.

## Prerequisites

- [`uv`](https://docs.astral.sh/uv/) installed
- The package must already have a `git` entry in `[tool.uv.sources]` in `pyproject.toml`:

```toml
[tool.uv.sources]
my-lib = { git = "https://github.com/you/my-lib" }
```

## Usage

```bash
uvedit local <package> [--dir PATH]
uvedit restore <package>
```

### `local` — switch to a local editable checkout

```bash
uvedit local my-lib
uv sync
```

- Clones the git repository to `../my-lib` (relative to `pyproject.toml`) if it doesn't already exist
- Use `--dir PATH` to specify a different checkout location
- Saves the original git source to `.uvedit.toml` so it can be restored later
- Rewrites the `[tool.uv.sources]` entry to `{ path = "../my-lib", editable = true }`
- Adds `.uvedit.toml` to `.gitignore` if one exists

### `restore` — restore the remote git source

```bash
uvedit restore my-lib
uv sync
```

- Reads the original source from `.uvedit.toml`
- Rewrites the `[tool.uv.sources]` entry back to the original git source
- Removes the package entry from `.uvedit.toml` (deletes the file if empty)

## How it works

`uvedit` stores the original remote source in `.uvedit.toml` at the project root when switching to a local checkout. This file should not be committed (it is added to `.gitignore` automatically). The local checkout is not affected by `restore` — it stays on disk and will be reused if you run `local` again.

## Installation

Install using uv:

```console
uv tool install 'git+https://github.com/mjdemilliano/uvedit'
```

Install using pipx:

```console
pipx install 'git+https://github.com/mjdemilliano/uvedit'
```

Install using pip:

```console
pip install 'git+https://github.com/mjdemilliano/uvedit'
```
