Metadata-Version: 2.4
Name: makepatch
Version: 0.2.7
Summary: Hatch build hook to easily hard-fork packages with patches!
Project-URL: source, https://github.com/AlphaKR93/packages/tree/main/python/makepatch
Project-URL: issues, https://github.com/AlphaKR93/packages/issues
Project-URL: changelogs, https://github.com/AlphaKR93/packages/blob/main/python/makepatch/CHANGELOG.md
Author-email: Alpha <dev@alpha93.kr>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Environment :: Plugins
Classifier: Framework :: Hatch
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.10
Requires-Dist: hatchling>=1.29.0
Requires-Dist: pydantic>=2.13.0
Requires-Dist: typing-extensions>=4.15.0; python_version < '3.15'
Description-Content-Type: text/markdown

# makepatch

Hatchling build hook that helps developers freely modify and build Python
packages through patches, like [`pnpm patch`](https://pnpm.io/cli/patch).

> [!WARN]
> This package was developed for personal use and is still unstable and poorly
> developed. Only confirmed to work with `uv`. PRs are welcome.

## Usage

> [!IMPORTANT]
> Patching installed packages is not yet supported. To patch a package, you must
> create a separate project (recommend using workspace).

To include patched packages automatically during the build, you need to add
`makepatch` to `build-system` and register the hook as follows:
```toml pyproject.toml
[build-system]
requires = ["hatchling", "makepatch"]
build-backend = "hatchling.build"

[tool.hatch.build.hooks.makepatch.options]
# Add options here
```

- To initialize the patch development environment, run the following command: <br/>
  `uv run apply-patches` <br/>
  This will create a patched source in `work/patched`.
- To create a patch file with modifications to `work/patched`, run the following
  command: <br/>
  `uv run rebuild-patches`

### Configuration

```toml pyproject.toml
[tool.hatch.build.hooks.makepatch.options]
module-source = "path of the actual package relative to `work/sources` (e.g., `src/mcp`)"
excludes = [
    # Files to exclude within `module-source`
    # DO NOT delete files from `work/patched`, you must exclude it from there
]
dev-excludes = [
    # Files to exclude when copied from `work/sources` to `work/patched`
    # does not affect build results and only for reducing copy time and storage usage.
    # will be changed to only copy `module-source` in the future.
]
```
