Metadata-Version: 2.5
Name: pyside-hatch-project
Version: 0.1.0
Summary: Hatchling build hook and CLI that compiles PySide6 .ui, .ts and .qrc files
Project-URL: Homepage, https://github.com/tkarabela/pyside-hatch-project
Project-URL: Issues, https://github.com/tkarabela/pyside-hatch-project/issues
Author-email: Tomas Karabela <tkarabela@seznam.cz>
License-Expression: MIT
License-File: LICENSE.txt
Keywords: hatch,hatchling,lrelease,lupdate,pyside6,qt,rcc,uic
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Hatch
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: hatchling>=1.12
Requires-Dist: pyside6-essentials>=6.6
Description-Content-Type: text/markdown

[![build master branch](https://img.shields.io/github/actions/workflow/status/tkarabela/pyside-hatch-project/ci.yml?branch=master)](https://github.com/tkarabela/pyside-hatch-project/actions)
[![test code coverage](https://img.shields.io/codecov/c/github/tkarabela/pyside-hatch-project)](https://app.codecov.io/github/tkarabela/pyside-hatch-project)
[![Static Badge](https://img.shields.io/badge/Pyrefly%20%26%20Ruff-checked-blue?style=flat)](https://github.com/tkarabela/pyside-hatch-project/actions)
[![PyPI - Version](https://img.shields.io/pypi/v/pyside-hatch-project.svg?style=flat)](https://pypi.org/project/pyside-hatch-project/)
[![PyPI - Status](https://img.shields.io/pypi/status/pyside-hatch-project.svg?style=flat)](https://pypi.org/project/pyside-hatch-project/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyside-hatch-project.svg?style=flat)](https://pypi.org/project/pyside-hatch-project/)
[![PyPI - License](https://img.shields.io/pypi/l/pyside-hatch-project.svg?style=flat)](LICENSE.txt)

# pyside-hatch-project

A Hatch-friendly alternative to `pyside6-project` for managing UI files, resource files and translations.
This library provides a Hatchling plugin as well as stand-alone CLI tool, both called `pyside-hatch-project`.
It reimplements a subset of `pyside6-project` functionality.

What this library gives you over `pyside6-project`:
- Compile `.ui`/`.ts`/`.qrc` as part of a standard Python build, no extra steps needed.
- Specify paths to `.ui`/`.ts`/`.qrc` using glob patterns in `pyproject.toml`.

If you'd rather just call `pyside6-project` from Hatchling, there is a similar project that does this:
[hatch-pyside](https://github.com/s-ball/hatch-pyside).

## Usage

Example `pyproject.toml`:

```toml
[project]
name = "example-project"

[dependency-groups]
dev = [
    "pyside-hatch-project",
]

[build-system]
requires = ["hatchling>=1.27", "pyside-hatch-project"]
build-backend = "hatchling.build"

[tool.hatch.build.hooks.pyside-hatch-project]
ui_files = ["src/**/*.ui"]
ts_files = ["src/**/*.ts"]
qrc_files = ["src/**/*.qrc"]

# -- If you don't want to use the Hatchling plugin:
# [tool.pyside-hatch-project]
# ui_files = ["src/**/*.ui"]
# ts_files = ["src/**/*.ts"]
# qrc_files = ["src/**/*.qrc"]

# -- If you want to use standard pyside6-project definitions:
# [tool.hatch.build.hooks.pyside-hatch-project]
#
# [tool.pyside6-project]
# files = [
#     "src/main.py",
#     "src/my_widget.ui",
#     "src/my_translation.ts",
#     "src/my_resource.qrc",
# ]
```

From the terminal, you can use `pyside6-project` compatible commands:

```shell
pyside-hatch-project build    # compile .ui/.ts/.qrc files
pyside-hatch-project lupdate  # extract strings from .py/.ui files into .ts files
pyside-hatch-project clean    # remove compilation outputs (ui_*.py, rc_*.py, *.qm)
```

The compiled files can be `.gitignore`d - the build hook will add them as artifacts explicitly.

## Development

```shell
uv sync
uv run pytest           # unit and integration tests
uv run pytest -m e2e    # end-to-end builds with pip and uv in fresh environments (slow, needs network)
uv run ruff check && uv run pyrefly check
```

## License

MIT – see [LICENSE.txt](./LICENSE.txt).
