Closed fabi1cazenave closed 6 months ago
Re-opening. I need a proper way to test this locally.
Looks like we’re doing the most basic beginner mistake here by loading files relative to the source file.
This is becoming an epic failure. :-)
TIL: the idea of implementing kalamine create
by grabbing the user guide from docs/
and layout descriptors from layouts/
cannot work.
What I’ve learned so far :
kalamine/
subdirectory will be deployed ;docs/
and layouts/
by adding them to the wheel — that’s what we did before with MANIFEST.in
, and lately with the [tool.hatch.build.targets.wheel]
section in pyproject.coml
— but it results in installing these directories directly into the user’s site-packages
and I’m still surprised this can even be allowed by pip
;pathlib
to grab resources from the package is not OK, pkgutil
should be used instead.So what should we do now ?
KeyboardLayout
constructor uses a pathlib.Path
argument (e.g. layout.py
+ tests/
) ;pkgutil
approach to load anything within the kalamine/
subdirectory (e.g. data/
, tpl/
) ;kalamine
rather than importing it:
data/
and reused by kalamine create
;data/dead_keys.yaml
;tpl/
;make_user_guide.py
script could be stored in the root directory and called by make publish
;KeyboardLayout
instance without any YAML/TOML descriptor, possibly by grabbing stuff from the data/
subdirectory instead.This should probably done with several PRs.
kalamine create
expects to find layout templates in alayouts
subdirectory that is not published.