Metadata-Version: 2.1
Name: pdm-default-scripts
Version: 0.1.5
Summary: PDM plugin that adds default scripts after `pdm init`
Keywords: pdm,plugin,default scripts
Author-Email: tepek2 <dev@tepek2.com>
License: MIT
Requires-Python: >=3.9
Requires-Dist: pdm>=2.26.7
Description-Content-Type: text/markdown

![Github Actions](https://github.com/tepek2/pdm-default-scripts/actions/workflows/tests.yml/badge.svg)

# pdm-default-scripts

`pdm-default-scripts` is a PDM plugin that adds your predefined scripts to new projects right after `pdm init`.

## Installation

Install the plugin into your PDM environment:

```bash
pdm self add pdm-default-scripts
```

## Configure default scripts

Create a `default-scripts.toml` file in your user PDM config directory.

- Linux: `~/.config/pdm/default-scripts.toml`
- macOS: `~/Library/Application Support/pdm/default-scripts.toml`
- Windows: `%APPDATA%\\pdm\\default-scripts.toml`

### Example

```toml
[scripts]
test = "pytest"
lint = "ruff check ."
format = "ruff format ."

[scripts.cov]
cmd = "pytest --cov"
env = { PYTHONPATH = "src" }
```

## Usage

1. Configure `default-scripts.toml` once.
2. Run `pdm init` in any new project.
3. The plugin adds missing entries into `[tool.pdm.scripts]` in `pyproject.toml`.

Existing scripts are not overwritten.

## How it behaves

- Runs on the `post_init` PDM signal.
- Reads `[scripts]` from your `default-scripts.toml`.
- Writes scripts into `[tool.pdm.scripts]` only when a script name is not already present.
