Metadata-Version: 2.4
Name: wrc
Version: 1.9.0
Summary: Tool to build and perform checks on WCA Regulations and Guidelines
Author-email: Philippe Virouleau <philippe.44@gmail.com>, WCA Software Team <software@worldcubeassociation.org>
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://github.com/thewca/wca-regulations-compiler
Project-URL: Issues, https://github.com/thewca/wca-regulations-compiler/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: ply>=3.7
Requires-Dist: unidecode
Dynamic: license-file


# WCA Regulations Compiler

This is a tool to check, build, compare WCA Regulations and Guidelines and its translations.

## Install from PyPI

Install globally:

```shell
pip install wrc

# Run from the Python binary path:
wrc
wrc-states
```

If you use [`uv`](https://docs.astral.sh/uv/guides/tools/), you can also directly run the commands without installing:

```shell
uvx wrc
uvx --from wrc wrc-states
```

## External dependencies

If you want to build the pdf versions, you need the **patched qt** version of [wkhtmltopdf](http://wkhtmltopdf.org/) in your `$PATH`.
These stable standalone binaries are available [here](http://wkhtmltopdf.org/downloads.html) for several platforms.

For CJK translations you also need to install some packages providing CJK fonts. The official build uses "UnBatang" for Korean (package `fonts-unfonts-core` or alike), "WenQuanYi Micro Hei" for Chinese (package `fonts-wqy-microhei` or alike), and "IPAX0208PGothic" for Japanese (package `fonts-ipafont` or alike).

## Run the thing

Here are some sample invocations:

```shell
# To check the Regulations and Guidelines:
wrc path/to/wca-regulations --target=check
# To build the html to the `build` directory:
wrc path/to/wca-regulations --target=html --output=build
# To merge the Regulations and Guidelines into a single document (works with html, pdf and json targets):
wrc path/to/wca-regulations --target=html --output=build --merged
# When building translation it's necessary to provide the language (to choose the appropriate font/pdf names):
wrc path/to/wca-regulations-translations/french --language=french --target=pdf --output=build
# Check that a translation matches exactly the original rules:
wrc path/to/wca-regulations-translations/french --diff=path/to/wca-regulations
```

You can also take a look at the [workflow used in the translations repository](https://github.com/thewca/wca-regulations-translations/blob/892f85771a2e7bbcab08e0486e7a7892d1f93ece/.github/workflows/deploy-to-s3.yml#L59-L61).


## Running from the sources

The easiest way to develop locally is to use [`uv`](https://docs.astral.sh/uv/guides/tools/)

Run the compiler (outputs into `./build/` by default):

```shell
uv run wrc --target html -- ./test/samples/plus_n/wca-regulations.md
```

Process a states file (outputs into `./build/` by default):

```shell
uv run -- wrc-states ./test/samples/states/wca-states.md --target=json
```

## Publishing to PyPI

This is for maintainers in PyPI:

- Bump the version number in `pyproject-toml` using either `make version-bump-minor` or `make version-bump-patch`.
- Commit, tag, and push the version bump.
- Run: `make publish`
