Switch to editable install

This commit is contained in:
object-Object 2023-06-27 10:01:18 -04:00
parent 549f9c4a08
commit 371d56033e
12 changed files with 52 additions and 19 deletions

View file

@ -13,11 +13,11 @@ python -m venv venv
.\venv\Scripts\activate # Windows
source venv/bin/activate # anything other than Windows
pip install -r requirements.txt
pip install -r requirements-dev.txt
```
## Usage
```sh
python src/main.py ../Common/src/main/resources hexcasting thehexbook template.html out.html
python -m hexcasting.scripts.main properties.toml -o out.html
```

View file

@ -1,3 +1,45 @@
# build
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "HexDoc" # TODO: i'm pretty sure i had funnier ideas than this
version = "0.1.0"
authors = [
{ name="Alwinfy" },
{ name="object-Object", email="object@objectobject.ca" },
]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
# better CLI argument parsing
"typed-argument-parser>=1.8.0",
# dict-to-dataclass (TODO: switch to Pydantic)
"dacite@git+https://github.com/mciszczon/dacite@f298260c6aedc1097c7567b1b0a61298a0ddf2a8",
]
[project.entry-points."tagged_unions.Page"]
patchouli = "patchouli.page.patchouli_pages"
hexcasting = "hexcasting.hex_pages"
[project.entry-points."tagged_unions.Recipe"]
patchouli = "minecraft.recipe.minecraft_recipes"
hexcasting = "hexcasting.hex_recipes"
[project.entry-points."tagged_unions.ItemIngredient"]
patchouli = "minecraft.recipe.ingredients"
hexcasting = "hexcasting.hex_recipes"
[tool.hatch.metadata]
allow-direct-references = true # TODO: remove when we switch to Pydantic
[tool.hatch.build]
packages = ["src/common", "src/hexcasting", "src/minecraft", "src/patchouli"]
# tests, formatting, and (TODO:) type checking
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib"
@ -7,7 +49,6 @@ markers = [
"file_contents: data for fixtures to write to files",
"fixture_data: other misc data",
]
pythonpath = ["src", "test"]
[tool.coverage.report]
include_namespace_packages = true

View file

@ -1,4 +1,4 @@
-r requirements.txt
-e . # install package locally as editable
black==22.10.0 # formatting
isort==5.12.0 # formatting 2
pytest==7.3.1 # testing framework

View file

@ -1,2 +0,0 @@
typed-argument-parser==1.8.0 # better argument parsing
git+https://github.com/mciszczon/dacite@f298260c6aedc1097c7567b1b0a61298a0ddf2a8 # book deserialization

View file

View file

@ -11,11 +11,12 @@ from pathlib import Path
from tap import Tap
from collate_data import generate_docs
from common.properties import Properties
from hexcasting.hex_state import HexBookState
from patchouli import Book
from .collate_data import generate_docs
if sys.version_info < (3, 11):
raise RuntimeError("Minimum Python version: 3.11")

View file

@ -5,7 +5,7 @@ __all__ = [
"MinecraftItemIdIngredient",
"ItemResult",
"Recipe",
"minecraft_recipes",
"recipes",
"CraftingRecipe",
"CraftingShapedRecipe",
"CraftingShapelessRecipe",
@ -17,8 +17,4 @@ from .ingredients import (
MinecraftItemIdIngredient,
MinecraftItemTagIngredient,
)
from .minecraft_recipes import (
CraftingRecipe,
CraftingShapedRecipe,
CraftingShapelessRecipe,
)
from .recipes import CraftingRecipe, CraftingShapedRecipe, CraftingShapelessRecipe

View file

@ -17,7 +17,7 @@ __all__ = [
]
from .abstract_pages import Page, PageWithCraftingRecipes, PageWithText, PageWithTitle
from .patchouli_pages import (
from .pages import (
CraftingPage,
EmptyPage,
EntityPage,

View file

@ -13,7 +13,7 @@ from syrupy.types import SerializedData
from common.properties import Properties
from common.types import LocalizedStr
from hexcasting.hex_state import HexBookState
from main import Args, main
from hexcasting.scripts.main import Args, main
from patchouli import Book, FormatTree
@ -33,10 +33,7 @@ class NoDiffSnapshotEx(AmberSnapshotExtension):
yield from ["no diff"]
_RUN = [
sys.executable,
"src/main.py",
]
_RUN = [sys.executable, "-m" "hexcasting.scripts.main"]
_ARGV = ["properties.toml", "-o"]
longrun = pytest.mark.skipif("not config.getoption('longrun')")