2023-09-08 06:55:34 +02:00
# hexdoc
2023-06-06 14:13:56 +02:00
2023-09-08 06:55:34 +02:00
This is the Python docgen for Hex Casting.
2023-06-06 14:13:56 +02:00
2023-09-02 23:56:43 +02:00
## Version scheme
2023-09-08 06:55:34 +02:00
We use [hatch-gradle-version ](https://pypi.org/project/hatch-gradle-version ) to generate the version number based on whichever mod version the docgen was built with.
2023-09-02 23:56:43 +02:00
The version is in this format: `mod-version.python-version.mod-pre.python-dev.python-post`
2023-06-06 14:13:56 +02:00
2023-09-02 23:56:43 +02:00
For example:
* Mod version: `0.11.1-7`
* Python package version: `1.0.dev0`
* Full version: `0.11.1.1.0rc7.dev0`
2023-09-08 07:29:00 +02:00
## Creating a plugin / addon
WIP.
- Run these commands, then follow the prompts:
```sh
pip install cookiecutter
cookiecutter gh:object-Object/HexMod --directory doc
```
2023-09-08 07:37:31 +02:00
- Note: if you run this from within an existing mod repo, add the flag `-f` and leave `output_directory` blank.
- Fill in the TODOs in `doc/properties.toml` (mostly paths to files/folders in your mod so hexdoc can find the data it needs).
- Try running the docgen locally by following the instructions in `doc/README.md` .
- If it doesn't already exist, create an empty `gh-pages` branch and push it.
- On GitHub, under `Settings > Pages` , set the source to `Deploy from a branch` , the branch to `gh-pages` , and the folder to `docs/` .
- Commit and push the docgen, and see if the CI works.
- On GitHub, under `Settings > Environments` , create two new environments called `pypi` and `testpypi` .
2023-09-08 07:29:00 +02:00
- Follow these instructions for PyPI and TestPyPI: https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/
- TestPyPI is a duplicate of PyPI which can be used for testing package publishing without affecting the real index. The CI workflow includes a manual execution option to publish to TestPyPI.
2023-09-25 06:41:03 +02:00
- If you like to live dangerously, this step is optional - you can remove the `publish-testpypi` job and the `TestPyPI` release choice from your workflow without impacting the rest of the CI.
2023-09-08 07:29:00 +02:00
2023-09-02 23:56:43 +02:00
## Setup
2023-06-11 01:14:53 +02:00
2023-06-06 14:13:56 +02:00
```sh
python -m venv venv
.\venv\Scripts\activate # Windows
source venv/bin/activate # anything other than Windows
2023-08-28 07:41:53 +02:00
# run from the repo root, not doc/
pip install -e .[dev]
2023-06-06 14:13:56 +02:00
```
2023-06-07 04:41:06 +02:00
## Usage
2023-09-29 08:18:09 +02:00
For local testing, create a file called `.env` following this template:
```sh
GITHUB_REPOSITORY=gamma-delta/HexMod
GITHUB_SHA=main
GITHUB_PAGES_URL=https://gamma-delta.github.io/HexMod
```
Then run these commands to generate the book:
2023-06-07 04:41:06 +02:00
```sh
2023-09-08 06:55:34 +02:00
# run from the repo root, not doc/
2023-09-30 08:08:31 +02:00
hexdoc render doc/properties.toml _site/src/docs
hexdoc merge --src _site/src/docs --dst _site/dst/docs
```
Or, run this command to render the book and start a local web server:
```sh
hexdoc serve doc/properties.toml --src _site/src/docs --dst _site/dst/docs
2023-06-07 04:41:06 +02:00
```