Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
876b70a
Refactor item/block models to use the same BlockModel class, matching…
object-Object May 4, 2024
ed9e6e1
Refactor some functions from hexdoc.graphics.render into separate files
object-Object May 4, 2024
c75f93d
Refactor BlockModel parent resolution
object-Object May 4, 2024
754f550
Refactor rendering class in preparation for item model rendering
object-Object May 4, 2024
fd1ea48
Partially implement animated item rendering
object-Object May 5, 2024
3a5a42d
Implement texture interpolation
object-Object May 5, 2024
a41e406
Implement block/item size configuration, refactor ModelTexture.index …
object-Object May 5, 2024
ce3f1d6
Implement animated block rendering!!
object-Object May 5, 2024
faf7c7e
Fix output directory creation
object-Object May 5, 2024
fdef38b
Add progress bar to texture generation
object-Object May 5, 2024
e4f3384
Fix logging in tqdm bar
object-Object May 5, 2024
08e23e1
Implement animation length limit because of woke prismarine
object-Object May 5, 2024
421c94a
Change method of frame dropping to hopefully make less choppy animations
object-Object May 5, 2024
6015a50
Temporarily switch from GIF to APNG
object-Object May 5, 2024
b0d8f77
Shorten max animation length from 30 to 15 seconds
object-Object May 5, 2024
9946450
Update submodules
object-Object May 6, 2024
0ed382b
Reorder classes in core.properties
object-Object May 6, 2024
111d599
Add section in hexdoc.toml for configuring animated textures
object-Object May 6, 2024
3fe6723
Implement props.textures.large_items, use an enum for animation formats
object-Object May 6, 2024
a08886d
Set default env for all commands if not in CI
object-Object May 8, 2024
a6203e7
Allow using --no-install with docusaurus session
object-Object May 8, 2024
8ba7d61
Implement static:// URL scheme for linking to static pages without op…
object-Object May 9, 2024
3cc3624
Document model rendering precedence
object-Object May 9, 2024
5965d52
Rename all documentation .md files to .mdx, and format with Prettier
object-Object May 9, 2024
118381a
Add pre-commit hook to run Prettier
object-Object May 9, 2024
02f4f9e
Refactor minecraft module
object-Object May 12, 2024
dd54f03
Refactor Properties into several files for better maintainability
object-Object May 12, 2024
662a25c
Implement new model loading class
object-Object May 12, 2024
659bb1b
Simplify ModelLoader implementation, add render_texture method
object-Object May 12, 2024
3a03310
Only run pyright hook on push to reduce friction
object-Object May 12, 2024
183246a
Fix pre-push hook not running
object-Object May 12, 2024
f99d6d0
Don't run commit hooks on push
object-Object May 12, 2024
fd84f04
Revert "Don't run commit hooks on push"
object-Object May 12, 2024
1c0a94a
Move ModelLoader from minecraft to graphics
object-Object May 12, 2024
e024a5e
Actually use return value of ModelLoader._fail
object-Object May 12, 2024
9739050
Catch errors when loading models
object-Object May 14, 2024
49c64bf
Update render_model and render_models to use ModelLoader
object-Object May 14, 2024
db3f638
Fix broken override loading
object-Object May 14, 2024
6a24b5e
Change default output format to gif, default output dir to out/
object-Object May 14, 2024
ef92a55
Disable exception locals again
object-Object May 21, 2024
efc0306
Refactor code from TypeTaggedTemplate into TemplateModel
object-Object May 22, 2024
0acf8de
Allow explicitly inheriting template id from superclass
object-Object May 22, 2024
6d0d831
Refactor InternallyTaggedUnion resolution into UnionModel
object-Object May 22, 2024
1419658
Convert PluginManager to a dataclass
object-Object May 22, 2024
8860cff
Implement new HexdocImage types
object-Object May 22, 2024
adf001d
Rename ModelLoader to ImageLoader
object-Object May 22, 2024
c04f0b4
Add ImageLoader to validation context
object-Object May 23, 2024
114ce71
Fix import error
object-Object May 23, 2024
c281e4e
Fix URL constructor error
object-Object May 23, 2024
9585595
Fix images being written to the wrong location
object-Object May 23, 2024
8767da6
Only catch validation-related exceptions when resolving unions
object-Object May 23, 2024
49e16ed
Make hexdoc.cli.utils.init_context a contextmanager to set context fo…
object-Object May 23, 2024
0c6888b
Fix _from_renderer cache hit behaviour
object-Object May 23, 2024
0887744
Set textures.strict=false for dummy book
object-Object May 23, 2024
74eb04f
Fix moderngl context error caused by creating multiple BlockRenderer …
object-Object May 23, 2024
df0a82d
Implement image templates, return item type from ImageLoader to get p…
object-Object May 23, 2024
638fa0d
Explicitly export all blockstates/models/textures
object-Object May 23, 2024
d7a0301
Add better error message if validate_texture gets a value without a s…
object-Object May 23, 2024
3a6f394
Add ImageField annotation to properly/consistently handle missing tex…
object-Object May 23, 2024
2fab8f6
Add first_url property to HexdocImage
object-Object May 23, 2024
326ff5b
Implement __hexdoc_check_model_field__ and MustBeAnnotated
object-Object May 24, 2024
b4c7713
Attempt all model overrides if the base model fails, and show all cau…
object-Object May 24, 2024
a2dad47
Fix incorrect configdict import from copier
object-Object May 24, 2024
4f0b4bc
Un-genericify HexdocImage
object-Object May 24, 2024
fbf44e7
Remove hexdoc.minecraft.assets and replace all usages of the old text…
object-Object May 25, 2024
364e3ce
Move model definitions from minecraft to graphics
object-Object May 25, 2024
367e7bf
Move i18n to hexdoc.core
object-Object May 25, 2024
7057320
Avoid swallowing errors when delegating to MissingImage in strict mode
object-Object May 25, 2024
e619614
Truncate very long values in isinstance_or_raise
object-Object May 25, 2024
fb2b0bd
Fix type error when Jinja context is used as validation context
object-Object May 25, 2024
cedd608
Use init_context in Jinja filters
object-Object May 25, 2024
0d6653d
Set builtin parent as model attribute and only fail when actually ren…
object-Object May 25, 2024
704793d
Fix errors related to old texture system
object-Object May 25, 2024
ba03d90
Rename hexdoc_texture and hexdoc_item to hexdoc_texture_image and hex…
object-Object May 25, 2024
a7cc8e2
Merge branch 'main' into item-models
object-Object May 25, 2024
dd5c6a3
Fix new Pyright errors
object-Object May 29, 2024
16ae3b0
Fix pytest errors
object-Object May 29, 2024
62040de
Bump version to rc1.dev0 to support new hexdoc-minecraft in tests
object-Object May 29, 2024
be8e7dd
Add --no-clean-exports flag for hexdoc-minecraft
object-Object May 29, 2024
ffdca8f
Add missing whitespace control to image macros
object-Object May 29, 2024
018a94f
Update snapshots with new image rendering
object-Object May 29, 2024
daa3ebe
Use separate submodules for HexMod instead of dynamically checking ou…
object-Object May 29, 2024
d6d4a0d
Pass branch as envvar
object-Object May 29, 2024
7dcfad1
Remove _assets.py
object-Object May 29, 2024
7ff00f6
Parallelize CI tests
object-Object May 29, 2024
6497688
Fix test_copier
object-Object May 29, 2024
a7350da
augh
object-Object May 29, 2024
041d53f
ough
object-Object May 29, 2024
b2561f9
Improve test_copier parallelizability
object-Object May 29, 2024
d3dff72
Remove textures.html.jinja
object-Object May 29, 2024
57ce10e
Remove pyright from general test tag
object-Object May 29, 2024
90f026b
Update submodules and snapshots
object-Object May 29, 2024
7d6d792
Simplify ImageField implementation
object-Object May 29, 2024
a0e2fe2
Re-implement check for props.textures.missing
object-Object May 29, 2024
af5a259
Implement model/item override types for textures.overrides.models
object-Object May 29, 2024
18a8527
Simplify can_be_missing usage
object-Object May 29, 2024
0530abb
Fix render-model result message
object-Object Jul 5, 2024
e9f2c8f
Add workaround for invalid minecraft:block/heavy_core texture variabl…
object-Object Aug 26, 2024
f25e014
Fix pyright warning in CI
object-Object Aug 26, 2024
cff18a8
Merge branch 'main' into item-models
object-Object Oct 7, 2024
af2c5bf
Split plugin flatten into two functions to fix type issues
object-Object Nov 23, 2024
869074b
Update Pyright and Pillow, fix many type errors
object-Object Nov 28, 2024
8a78903
Implement basic caching for ModResourceLoader._load_path
object-Object Nov 28, 2024
2b86fc7
Check props.textures.can_be_missing in hexdoc render-models command t…
object-Object Dec 26, 2024
5c1221b
Move a few graphics log lines from debug to trace
object-Object Dec 26, 2024
5fa5102
Bump version to 0.2.0 instead of 0.1.0rc1, to make it more clear that…
object-Object Feb 13, 2025
4f548f7
Merge remote-tracking branch 'origin/main' into item-models
object-Object Feb 13, 2025
9316550
Merge branch 'main' into item-models
object-Object Dec 30, 2025
c8babf3
Resolve many type errors
object-Object Dec 30, 2025
234335e
Update Ruff and pre-commit hooks
object-Object Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,37 @@ jobs:
name: python-build
path: dist

pre-commit:
runs-on: ubuntu-latest
env:
HEXDOC_RELEASE: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: yezz123/setup-uv@v4

- name: Run pre-commit hooks
env:
SKIP: pyright
uses: pre-commit/action@v3.0.0

test:
runs-on: ubuntu-latest
env:
HEXDOC_RELEASE: false
strategy:
fail-fast: false
matrix:
nox-args:
- --tags test_fast
- --sessions test_build "test_hexcasting(branch='1.19')"
- --sessions test_build "test_hexcasting(branch='main')"
- --sessions test_build test_copier
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -71,20 +98,15 @@ jobs:
with:
packages: xvfb

- name: Run pre-commit hooks
env:
SKIP: pyright
uses: pre-commit/action@v3.0.0

- name: Install Nox
run: uv pip install --system nox

- name: Run Nox with display server
run: xvfb-run --auto-servernum nox
run: xvfb-run --auto-servernum nox ${{ matrix.nox-args }}

update-tags:
runs-on: ubuntu-latest
needs: [build, test]
needs: [build, pre-commit, test]
if: github.event_name == 'push' && needs.build.outputs.release == 'true'
permissions:
contents: write
Expand All @@ -108,7 +130,7 @@ jobs:

publish-pypi:
runs-on: ubuntu-latest
needs: [build, test]
needs: [build, pre-commit, test]
if: github.event_name == 'push' && needs.build.outputs.release == 'true'
environment:
name: pypi
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __gradle_version__.py
out/
.hexdoc*/
out.png
out.gif

node_modules/
package-lock.json
Expand Down
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "submodules/HexMod"]
path = submodules/HexMod
path = submodules/HexMod_main
url = https://github.com/object-Object/HexMod
[submodule "submodules/hexdoc-hexcasting-template"]
path = submodules/hexdoc-hexcasting-template
url = https://github.com/hexdoc-dev/hexdoc-hexcasting-template
[submodule "submodules/HexMod_1.19"]
path = submodules/HexMod_1.19
url = https://github.com/object-Object/HexMod
15 changes: 12 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
exclude: '__snapshots__|^vendor/'

default_install_hook_types:
- pre-commit
- pre-push
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
files: ^web/docusaurus/
types_or: [javascript, jsx, ts, tsx, mdx]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
rev: v0.14.10
hooks:
- name: ruff-fix
id: ruff
Expand All @@ -19,6 +27,7 @@ repos:
hooks:
- id: pyright
name: pyright
stages: [pre-push]
entry: nox -s pyright --
language: python
language_version: '3.11'
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"args": [
"build",
// "--props",
// "./submodules/HexMod/doc/hexdoc.toml",
// "./submodules/HexMod_main/doc/hexdoc.toml",
// "--release",
],
"console": "integratedTerminal",
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"editor.rulers": [120],
},
"ruff.organizeImports": true,
"ruff.lint.args": [
"--extend-ignore=I", // format on save is enabled, so don't show the squiggles
"ruff.lint.ignore": [
"I", // format on save is enabled, so don't show the squiggles
],
"python.languageServer": "Pylance",
"python.analysis.diagnosticMode": "workspace",
Expand Down
1 change: 1 addition & 0 deletions examples/model_rendering/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# hexdoc
out/
/renders/
.hexdoc*/
out.png

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"parent": "minecraft:block/stone"
"parent": "item/generated",
"textures": {
"layer0": "minecraft:block/command_block_front"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"src",
"resources",
"vendor",
"submodules/HexMod/doc/src",
"submodules/HexMod/doc/resources",
"submodules/HexMod/doc/hexdoc.toml",
"submodules/HexMod/Common/src/main/resources/assets/*/lang"
"submodules/HexMod_main/doc/src",
"submodules/HexMod_main/doc/resources",
"submodules/HexMod_main/doc/hexdoc.toml",
"submodules/HexMod_main/Common/src/main/resources/assets/*/lang"
],
"ignore": ["**/generated/**"],
"ext": "jinja,html,css,js,ts,toml,json,json5,py,png,mcmeta",
"exec": "hexdoc build && hexdoc --quiet-lang ru_ru --quiet-lang zh_cn serve --props submodules/HexMod/doc/hexdoc.toml"
"exec": "hexdoc build && hexdoc serve --props submodules/HexMod_main/doc/hexdoc.toml"
}
79 changes: 41 additions & 38 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# tests


@nox.session
@nox.session(tags=["test_fast"])
def pyright(session: nox.Session):
session.install("-e", ".[test]")

Expand All @@ -47,7 +47,7 @@ def pyright(session: nox.Session):
session.run("pyright", *args)


@nox.session(tags=["test"])
@nox.session(tags=["test", "test_fast"])
def test(session: nox.Session):
session.install("-e", ".[test]")

Expand All @@ -61,46 +61,45 @@ def test_build(session: nox.Session):
session.run("hexdoc", "build", "--branch=main", env=MOCK_ENV)


@nox.session(tags=["test", "post_build"])
@nox.parametrize(["branch"], ["1.19_old", "main_old"])
@nox.session(tags=["test"])
@nox.parametrize(["branch"], ["1.19", "main"])
def test_hexcasting(session: nox.Session, branch: str):
with session.cd("submodules/HexMod"):
original_branch = run_silent_external(
session, "git", "rev-parse", "--abbrev-ref", "HEAD"
)
if original_branch == "HEAD": # properly handle detached HEAD
original_branch = run_silent_external(session, "git", "rev-parse", "HEAD")
submodule = f"submodules/HexMod_{branch}"

session.run("git", "checkout", branch, external=True)
session.install("-e", ".[test]", "-e", f"./{submodule}")

try:
session.install("-e", ".[test]", "-e", "./submodules/HexMod")

session.run(
"hexdoc",
"--quiet-lang=ru_ru",
"--quiet-lang=zh_cn",
"build",
"--branch=main",
"--props=submodules/HexMod/doc/hexdoc.toml",
env=MOCK_ENV,
)
session.run(
"hexdoc",
"build",
"--branch=main",
f"--props={submodule}/doc/hexdoc.toml",
env=MOCK_ENV,
)

session.run(
"pytest",
"-m",
"hexcasting",
*session.posargs,
env={"MOCK_PLATFORM": "Windows"},
)
finally:
with session.cd("submodules/HexMod"):
session.run("git", "checkout", original_branch, external=True)
session.run(
"pytest",
"-m",
"hexcasting",
*session.posargs,
env={
"MOCK_PLATFORM": "Windows",
"TEST_SUBMODULE": submodule,
"TEST_BRANCH": branch,
},
)


@nox.session(tags=["test", "post_build"])
@nox.session(tags=["test"])
def test_copier(session: nox.Session):
session.install("pip", "-e", ".[test]", "-e", "./submodules/HexMod")
session.install("pip", "-e", ".[test]", "-e", "./submodules/HexMod_main")

session.run(
"hexdoc",
"build",
"--branch=main",
"--props=submodules/HexMod_main/doc/hexdoc.toml",
env=MOCK_ENV,
)

template_repo = Path("submodules/hexdoc-hexcasting-template")
rendered_template = template_repo / ".ctt" / "test_copier"
Expand Down Expand Up @@ -174,7 +173,8 @@ def pdoc(session: nox.Session):


# docs for the docs!
@nox.session(tags=["docs"], python=False)
# note: we can't use python=False because then --no-install doesn't work
@nox.session(tags=["docs"])
def docusaurus(session: nox.Session):
shutil.copytree("media", f"{STATIC_GENERATED}/img", dirs_exist_ok=True)

Expand Down Expand Up @@ -227,7 +227,7 @@ def tag(session: nox.Session):
def setup(session: nox.Session):
session.install("uv", "pre-commit")

if not Path("submodules/HexMod/pyproject.toml").exists():
if not Path("submodules/HexMod_main/pyproject.toml").exists():
session.run("git", "submodule", "update", "--init")

rmtree(session, "venv", onerror=on_rm_error)
Expand All @@ -237,7 +237,7 @@ def setup(session: nox.Session):
*("uv", "pip", "install"),
"--quiet",
"-e=.[dev]",
"-e=./submodules/HexMod",
"-e=./submodules/HexMod_main",
env={
"VIRTUAL_ENV": str(Path.cwd() / "venv"),
},
Expand Down Expand Up @@ -649,6 +649,9 @@ def dummy_setup(session: nox.Session):
"foo:baz" = false
"mod:foo" = false

[textures]
strict = false

[template]
icon = "icon.png"
include = [
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies = [
"pygithub~=2.1",
"pyjson5~=1.6",
"requests~=2.31",
"tqdm~=4.66",
"typer~=0.12",
"typing_extensions~=4.6",
"yarl~=1.9",
Expand All @@ -75,7 +76,7 @@ pdoc = [
"pdoc~=14.1",
]
test = [
"pyright==1.1.361",
"pyright==1.1.389",
"pytest~=7.4",
"pytest-dependency~=0.5",
"pytest-describe~=2.2",
Expand All @@ -85,7 +86,7 @@ test = [
]
dev = [
"hexdoc[pdoc,test]",
"ruff~=0.3.2",
"ruff~=0.14.10",
"pre-commit",
"nox[uv]",
]
Expand Down Expand Up @@ -193,6 +194,7 @@ include = [
]
extraPaths = [
"vendor",
"typings",
]
exclude = [
"noxfile.py",
Expand All @@ -205,7 +207,6 @@ exclude = [

typeCheckingMode = "basic"

enableExperimentalFeatures = true
strictDictionaryInference = true
strictListInference = true
strictSetInference = true
Expand Down
5 changes: 3 additions & 2 deletions src/_scripts/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

import rich
import typer
from pydantic import BaseModel, TypeAdapter
from typer import Argument, Option

from hexdoc.cli.utils import DefaultTyper
from hexdoc.cli.utils.args import parse_import_class
from hexdoc.core.compat import MinecraftVersion
from pydantic import BaseModel, TypeAdapter
from typer import Argument, Option

app = DefaultTyper()

Expand Down
2 changes: 1 addition & 1 deletion src/hexdoc/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1!0.1.0a35"
VERSION = "1!0.2.0rc1.dev0"
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@

when_clicked: "When clicked, would execute: {}",

any_block: "Any Block",

redirect: {
"category.title": "Category: {}",
"entry.title": "Entry: {}",
Expand All @@ -55,4 +53,6 @@
Minecraft content and materials are the intellectual property of their respective owners.$(br2)\
Made with ❤️ using $(l:https://pypi.org/project/hexdoc/)hexdoc/$."
},

"gui.hexdoc.any_block": "Any Block",
}
Loading
Loading