diff --git a/copier.yml b/copier.yml deleted file mode 100644 index b05ecc576..000000000 --- a/copier.yml +++ /dev/null @@ -1,74 +0,0 @@ -# Copier settings (not prompted) - -_subdirectory: template - -# mod name and id - -modid: - type: str - -mod_display_name: "{{ modid|capitalize }}" - -book_id: "hexcasting:thehexbook" - -# hexdoc plugin - -package_name: "hexdoc-{{ modid|replace('_', '-')|lower }}" - -package_slug: "hexdoc_{{ modid|replace('-', '_')|lower }}" - -package_src: "doc/src/{{ package_slug }}" - -package_export_root: "{{ package_src }}/_export" - -hexdoc_plugin_classname: "{{ modid|capitalize }}Plugin" - -hexdoc_mod_plugin_classname: "{{ modid|capitalize }}ModPlugin" - -# mod structure - -multiloader: - type: bool - default: true - -gradle_mod_version_key: "modVersion" - -java_lang: - type: yaml - choices: - Java: - value: &java_lang_java - src: java - ext: java - Kotlin: - value: - src: kotlin - ext: kt - default: *java_lang_java - -java_package: "com/example/{{ modid }}" - -pattern_registry: "registry/{{ modid|capitalize }}PatternRegistry.{{ java_lang.ext }}" - -pattern_regex: - type: str - choices: - Hex Casting (1.20): - value: &pattern_regex_hex_1_20 'make\(\s*"(?P[a-zA-Z0-9_\/]+)",\s*(?:new )?(?:ActionRegistryEntry|OperationAction)\(\s*HexPattern\.fromAngles\(\s*"(?P[aqweds]+)",\s*HexDir.(?P\w+)\)' - Hex Casting (1.19): - value: 'HexPattern\.fromAngles\("(?P[qweasd]+)", HexDir\.(?P\w+)\),\s*modLoc\("(?P[^"]+)"\)[^;]+?(?:makeConstantOp|Op\w+|Widget\.\w+)(?:[^;]*(?Ptrue)\);)?' - Hexal (1.20): - value: 'make\(\s*"(?P[a-zA-Z0-9_\/]+)",\s*HexPattern\.fromAngles\(\s*"(?P[aqweds]+)",\s*HexDir.(?P\w+)\)' - Hexal (1.19): - value: (?s-m:HexPattern\.fromAngles\("(?P[qweasd]+)", HexDir\.(?P\w+)\),\s*modLoc\("(?P[^"]+)"\),[^,]+?(?:makeConstantOp|Op\w+).*?(?P\btrue)?\)(?:[^\)]+?\bval\b|(?:(?!\bval\b)(?:.))+$)) - default: *pattern_regex_hex_1_20 - -# GitHub - -github_repo: "{{ modid|capitalize }}" - -author: TODO - -default_branch: main - -pages_url: "https://{{ author|lower }}.github.io/{{ github_repo }}" diff --git a/template/.copier-answers.yml.jinja b/template/.copier-answers.yml.jinja deleted file mode 100644 index ab2e514a6..000000000 --- a/template/.copier-answers.yml.jinja +++ /dev/null @@ -1,3 +0,0 @@ -# Changes here will be overwritten by Copier. NEVER EDIT MANUALLY -# See: https://copier.readthedocs.io/en/stable/configuring/#the-copier-answersyml-file -{{ _copier_answers|to_nice_yaml -}} diff --git a/template/.github/workflows/build_docs.yml.jinja b/template/.github/workflows/build_docs.yml.jinja deleted file mode 100644 index 7f69fd9c0..000000000 --- a/template/.github/workflows/build_docs.yml.jinja +++ /dev/null @@ -1,99 +0,0 @@ -{% raw -%} -name: Build the web book - -on: - push: - branches: - - {% endraw %}{{ default_branch }}{%- raw %} - tags: "v*" - workflow_dispatch: - inputs: - release: - description: Release this version - type: boolean - default: false - publish: - description: Package index to publish to - type: choice - options: - - none - - PyPI (release) - # - TestPyPI - segment: - description: Version segment to bump with Hatch - type: string - required: false - -env: - PYPI_PACKAGE: {% endraw %}{{ package_name }}{%- raw %} - PYTHON_VERSION: '3.11' - -permissions: - contents: read - -jobs: - hexdoc: - uses: object-Object/hexdoc/.github/workflows/hexdoc.yml@v1!0.dev - permissions: - contents: write - pages: read - secrets: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - python-version: ${{ env.PYTHON_VERSION }} - release: |- - ${{ - github.event_name == 'workflow_dispatch' && inputs.release - || startsWith(github.event.head_commit.message, '[Release]') - || startsWith(github.ref, 'refs/tags') - }} - bump-version-segment: ${{ inputs.segment }} - - publish-pypi: - runs-on: ubuntu-latest - needs: [hexdoc] - if: |- - needs.hexdoc.outputs.release == 'true' && - (github.event_name != 'workflow_dispatch' || inputs.publish == 'PyPI (release)') - - environment: - name: pypi - url: https://pypi.org/p/${{ env.PYPI_PACKAGE }} - permissions: - id-token: write - - steps: - - name: Download package artifact - uses: actions/download-artifact@v3 - with: - name: hexdoc-build - path: dist - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - # Uncomment if you want to try publishing to TestPyPI before using the real index. - - # publish-testpypi: - # runs-on: ubuntu-latest - # needs: [hexdoc] - # if: github.event_name == 'workflow_dispatch' && inputs.publish == 'TestPyPI' - - # environment: - # name: testpypi - # url: https://test.pypi.org/p/${{ env.PYPI_PACKAGE }} - # permissions: - # id-token: write - - # steps: - # - name: Download package artifact - # uses: actions/download-artifact@v3 - # with: - # name: hexdoc-build - # path: dist - - # - name: Publish to TestPyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # repository-url: https://test.pypi.org/legacy/ -{% endraw -%} diff --git a/template/.gitignore b/template/.gitignore deleted file mode 100644 index 6d45f9d55..000000000 --- a/template/.gitignore +++ /dev/null @@ -1,190 +0,0 @@ -# hexdoc -_site/ -_checkout/ -__gradle_version__.py -.hexdoc*/ - -# eclipse -bin -*.launch -.settings -.metadata -.classpath -.project - -# idea -out -*.ipr -*.iws -*.iml -.idea - -# gradle -build -.gradle - -# other -eclipse -run - -# Files from Forge MDK -forge*changelog.txt - -Session.vim -plot/ - -# Python - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ diff --git a/template/.vscode/extensions.json b/template/.vscode/extensions.json deleted file mode 100644 index 6ce73458d..000000000 --- a/template/.vscode/extensions.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - // List of extensions which should be recommended for users of this workspace. - "recommendations": [ - "ms-python.vscode-pylance", - "charliermarsh.ruff", - "samuelcolvin.jinjahtml", - "noxiz.jinja-snippets", - ], -} diff --git a/template/.vscode/settings.json b/template/.vscode/settings.json deleted file mode 100644 index a88a7d371..000000000 --- a/template/.vscode/settings.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "[python]": { - "editor.defaultFormatter": "charliermarsh.ruff", - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports.ruff": true, - }, - "editor.rulers": [88], - }, - "[yaml][html][css][javascript][jinja-html][jinja-css][jinja-js]": { - "editor.tabSize": 2, - }, - "[html][jinja-html]": { - "editor.rulers": [120], - }, - "ruff.organizeImports": true, - "ruff.lint.args": [ - "--extend-ignore=I", // format on save is enabled, so don't show the squiggles - ], - "python.languageServer": "Pylance", - "python.analysis.diagnosticMode": "workspace", - "python.analysis.packageIndexDepths": [ - {"name": "hexdoc", "depth": 3}, - {"name": "pydantic", "depth": 2}, - ], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "files.associations": { - "*.js.jinja": "javascript", - "*.css.jinja": "css", - "*.jcss.jinja": "jinja-css", // for files with a lot of jinja stuff, where the linting isn't useful - "*.json5.jinja": "json5", - }, -} diff --git a/template/doc/README.md.jinja b/template/doc/README.md.jinja deleted file mode 100644 index bc0b6ef57..000000000 --- a/template/doc/README.md.jinja +++ /dev/null @@ -1,56 +0,0 @@ -# {{ package_name }} - -Python web book docgen and [hexdoc](https://pypi.org/project/hexdoc) plugin for {{ mod_display_name }}. - -## Version scheme - -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. - -The version is in this format: `mod-version.python-version.mod-pre.python-dev.python-post` - -For example: -* Mod version: `0.11.1-7` -* Python package version: `1.0.dev0` -* Full version: `0.11.1.1.0rc7.dev0` - -## Setup - -```sh -python3.11 -m venv venv - -.\venv\Scripts\activate # Windows -. venv/bin/activate.fish # fish -source venv/bin/activate # everything else - -# run from the repo root, not doc/ -pip install -e .[dev] -``` - -## Usage - -For local testing, create a file called `.env` in the repo root following this template: -```sh -GITHUB_REPOSITORY={{ author }}/{{ github_repo }} -GITHUB_SHA={{ default_branch }} -GITHUB_PAGES_URL={{ pages_url }} -``` - -Useful commands: -```sh -# show help -hexdoc -h - -# render and serve the web book in watch mode -nodemon --config doc/nodemon.json - -# render and serve the web book -hexdoc serve - -# export, render, and merge the web book -hexdoc export -hexdoc render -hexdoc merge - -# start the Python interpreter with some extra local variables -hexdoc repl -``` diff --git a/template/doc/hexdoc.toml.jinja b/template/doc/hexdoc.toml.jinja deleted file mode 100644 index 369a4d1e0..000000000 --- a/template/doc/hexdoc.toml.jinja +++ /dev/null @@ -1,58 +0,0 @@ -modid = "{{ modid }}" -book = "{{ book_id }}" -default_lang = "en_us" -default_branch = "{{ default_branch }}" - -resource_dirs = [ # top takes priority - "resources", - "{_common.src}/main/resources", - "{_common.src}/generated/resources", - {%- if multiloader %} - "{_fabric.src}/main/resources", - "{_fabric.src}/generated/resources", - "{_forge.src}/main/resources", - "{_forge.src}/generated/resources", - {%- endif %} - { modid="hexcasting" }, - { modid="minecraft" }, - { modid="hexdoc" }, -] -export_dir = "{{ package_export_root }}/generated" - -[template] -icon = "icon.png" -include = [ - "{{ modid }}", - "hexcasting", - "hexdoc", -] - -[template.args] -mod_name = "{{ mod_display_name }}" -author = "{{ author }}" -show_landing_text = false - -[extra.hexcasting] -# regexes for parsing pattern registry files - try running copier update and picking a different regex if your patterns aren't loading -# NOTE: "!Raw" means "don't apply variable interpolation to this value" -_pattern_regex = { "!Raw"='{{ pattern_regex }}' } - -[[extra.hexcasting.pattern_stubs]] -path = "{^^^_common.package}/{{ pattern_registry }}" -regex = "{^_pattern_regex}" - -# platforms - -[_common] -src = "../{{ 'common/src' if multiloader else 'src' }}" -package = "{src}/main/{{ java_lang.src }}/{{ java_package }}" -{%- if multiloader %} - -[_fabric] -src = "../fabric/src" -package = "{src}/main/{{ java_lang.src }}/{{ java_package }}/fabric" - -[_forge] -src = "../forge/src" -package = "{src}/main/{{ java_lang.src }}/{{ java_package }}/forge" -{%- endif -%} diff --git a/template/doc/icon.png b/template/doc/icon.png deleted file mode 100644 index 4f0d28d42..000000000 Binary files a/template/doc/icon.png and /dev/null differ diff --git a/template/doc/nodemon.json.jinja b/template/doc/nodemon.json.jinja deleted file mode 100644 index 80b7d1f90..000000000 --- a/template/doc/nodemon.json.jinja +++ /dev/null @@ -1,11 +0,0 @@ -{ - "watch": [ - "doc/src", - "doc/resources", - "doc/hexdoc.toml", - "{{ 'common/src' if multiloader else 'src' }}/main/resources/assets/*/lang" - ], - "ignore": ["**/generated/**"], - "ext": "jinja,html,css,js,ts,toml,json,json5,py", - "exec": "hexdoc serve --lang en_us --allow-missing" -} diff --git a/template/doc/resources/assets/hexcasting/lang/en_us.flatten.json5.jinja b/template/doc/resources/assets/hexcasting/lang/en_us.flatten.json5.jinja deleted file mode 100644 index 6401d49b2..000000000 --- a/template/doc/resources/assets/hexcasting/lang/en_us.flatten.json5.jinja +++ /dev/null @@ -1,8 +0,0 @@ -{ - hexdoc: { - "{{ modid }}": { - title: "{{ mod_display_name }} Book", - description: "The {{ mod_display_name }} Book, all in one place.", - }, - } -} diff --git a/template/doc/src/{{package_slug}}/__init__.py b/template/doc/src/{{package_slug}}/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/template/doc/src/{{package_slug}}/__version__.py b/template/doc/src/{{package_slug}}/__version__.py deleted file mode 100644 index e72c80491..000000000 --- a/template/doc/src/{{package_slug}}/__version__.py +++ /dev/null @@ -1,4 +0,0 @@ -# This file is auto-generated by hatch-gradle-version. -# Only the value of PY_VERSION is editable. Do not edit other values. - -PY_VERSION = "1.0.dev0" diff --git a/template/doc/src/{{package_slug}}/_export/.gitignore b/template/doc/src/{{package_slug}}/_export/.gitignore deleted file mode 100644 index fece6510a..000000000 --- a/template/doc/src/{{package_slug}}/_export/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -generated/* -!generated/__init__.py diff --git a/template/doc/src/{{package_slug}}/_export/__init__.py b/template/doc/src/{{package_slug}}/_export/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/template/doc/src/{{package_slug}}/_export/generated/__init__.py b/template/doc/src/{{package_slug}}/_export/generated/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/template/doc/src/{{package_slug}}/_hooks.py.jinja b/template/doc/src/{{package_slug}}/_hooks.py.jinja deleted file mode 100644 index 307a7e124..000000000 --- a/template/doc/src/{{package_slug}}/_hooks.py.jinja +++ /dev/null @@ -1,56 +0,0 @@ -from importlib.resources import Package -from typing_extensions import override - -from hexdoc.plugin import ( - HookReturn, - ModPlugin, - ModPluginImpl, - ModPluginWithBook, - hookimpl, -) - -import {{ package_slug }} - -from .__gradle_version__ import FULL_VERSION, GRADLE_VERSION -from .__version__ import PY_VERSION - - -class {{ hexdoc_plugin_classname }}(ModPluginImpl): - @staticmethod - @hookimpl - def hexdoc_mod_plugin(branch: str) -> ModPlugin: - return {{ hexdoc_mod_plugin_classname }}(branch=branch) - -class {{ hexdoc_mod_plugin_classname }}(ModPluginWithBook): - @property - @override - def modid(self) -> str: - return "{{ modid }}" - - @property - @override - def full_version(self) -> str: - return FULL_VERSION - - @property - @override - def mod_version(self) -> str: - return GRADLE_VERSION - - @property - @override - def plugin_version(self) -> str: - return PY_VERSION - - @override - def resource_dirs(self) -> HookReturn[Package]: - # lazy import because generated may not exist when this file is loaded - # eg. when generating the contents of generated - # so we only want to import it if we actually need it - from ._export import generated - - return generated - - @override - def jinja_template_root(self) -> tuple[Package, str]: - return {{ package_slug }}, "_templates" diff --git a/template/doc/src/{{package_slug}}/_templates/__init__.py b/template/doc/src/{{package_slug}}/_templates/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/template/doc/src/{{package_slug}}/py.typed b/template/doc/src/{{package_slug}}/py.typed deleted file mode 100644 index e69de29bb..000000000 diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja deleted file mode 100644 index fd2d36971..000000000 --- a/template/pyproject.toml.jinja +++ /dev/null @@ -1,118 +0,0 @@ -[build-system] -requires = [ - "hatchling", - "hatch-gradle-version>=0.8.0", -] -build-backend = "hatchling.build" - -# project metadata - -[project] -name = "{{ package_name }}" -description = "Python web book docgen and hexdoc plugin for {{ mod_display_name }}." -readme = "doc/README.md" -authors = [ - { name="{{ author }}" }, -] -keywords = ["hexdoc"] -requires-python = ">=3.11" -dynamic = ["version", "dependencies", "optional-dependencies"] - -[project.urls] -Homepage = "{{ pages_url }}" -Source = "https://github.com/{{ author }}/{{ github_repo }}" - -# Gradle version/deps - -[tool.hatch.version] -scheme = "gradle" -source = "gradle-properties" -py-path = "{{ package_src }}/__version__.py" -key = "{{ gradle_mod_version_key }}" - -[tool.hatch.metadata.hooks.gradle-properties] -dependencies = [ - { package="hexdoc-hexcasting", op="~=", py-version="1.0.dev20", key="hexcastingVersion" }, -] - -[tool.hatch.metadata.hooks.gradle-properties.optional-dependencies] -dev = [ - "ruff~=0.1.4", -] - -# directory inclusion - -[tool.hatch.build] -only-include = [ - "{{ package_src }}", - "gradle.properties", -] -artifacts = [ - "/{{ package_export_root }}/generated", - "/{{ package_src }}/__gradle_version__.py", -] - -[tool.hatch.build.targets.wheel] -sources = ["doc/src"] - -# hexdoc entry points - -[project.entry-points.hexdoc] -{{ modid }} = "{{ package_slug }}._hooks:{{ hexdoc_plugin_classname }}" - -# linting - -[tool.pyright] -pythonVersion = "3.11" -pythonPlatform = "All" - -include = ["doc/src"] -extraPaths = ["doc/src"] - -typeCheckingMode = "basic" - -strictDictionaryInference = true -strictListInference = true -strictSetInference = true - -reportAssertAlwaysTrue = "error" -reportConstantRedefinition = "error" -reportDeprecated = "error" -reportDuplicateImport = "error" -reportFunctionMemberAccess = "error" -reportIncompatibleMethodOverride = "error" -reportIncompatibleVariableOverride = "error" -reportIncompleteStub = "error" -reportInconsistentConstructor = "error" -reportInvalidStringEscapeSequence = "error" -reportInvalidStubStatement = "error" -reportInvalidTypeVarUse = "error" -reportMatchNotExhaustive = "error" -reportMissingParameterType = "error" -reportMissingTypeStubs = "error" -reportOverlappingOverload = "error" -reportSelfClsParameterName = "error" -reportTypeCommentUsage = "error" -reportUnknownParameterType = "error" -reportUnnecessaryCast = "error" -reportUnnecessaryContains = "error" -reportUnsupportedDunderAll = "error" -reportUntypedBaseClass = "error" -reportUntypedClassDecorator = "error" -reportUntypedFunctionDecorator = "error" -reportUntypedNamedTuple = "error" -reportWildcardImportFromLibrary = "error" - -reportMissingTypeArgument = "warning" -reportPrivateUsage = "warning" -reportUnknownArgumentType = "warning" -reportUnknownLambdaType = "warning" -reportUnknownMemberType = "warning" -reportUnknownVariableType = "warning" -reportUnnecessaryComparison = "warning" -reportUnnecessaryIsInstance = "warning" -reportUnusedClass = "warning" -reportUnusedExpression = "warning" -reportUnusedFunction = "warning" -reportUnusedImport = "warning" -reportUnusedVariable = "warning"