Closed aurtzy closed 2 weeks ago
First of all thank you very much for this. The file conflicts are new because of my changes to fix the config file bug.
Are relative imports required when using this new directory structure?
No - absolute imports should be valid as well, like import keyboard_center.lib.hid
(keyboard_center
is now considered the top-level module).
I can change them to absolute if you'd prefer when I rebase these changes.
ok good, you can leave it as is relative imports are fine for now, but I do prefer absolute imports, because I then can reorganize modules without having to update all the imports again.
thank you very much for this, very appreciated!
ah and to answer your questions:
Fixes https://github.com/zocker-160/keyboard-center/issues/67.
This adds support for Python packaging build systems based on PEP 517.
The directory structure is reorganized to follow flat-layout, which is automatically recognized by setuptools: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#flat-layout
Move
main.py
to__init__.py
and turn its contents into a function that can be called from an entrypoint script.A
MANIFEST.in
file is added so keyboard-center assets are included in the expected installation directory.Use relative imports to import internal Python modules.
I added some basic information to
pyproject.toml
, but feel free to suggest additions/edits that I can include in this pull request. Python dependencies have been specified in this file, but I'm not sure how to declare dependencies providing.so
files like hidapi at the moment (if even possible).The
project.gui-scripts
field at the end ofpyproject.toml
should actually allow for packaging systems to manage this automatically, so I think the starter script that was mentioned in the linked issue could be removed entirely - this may depend on the packaging system used, though.These changes are not as well tested as I'd like. Guix is still limited to Python 3.10 at the moment unfortunately, so I had some issues on my end testing this and would appreciate feedback on that end since I don't use much of the featureset either.
...on the bright side, this means I also have working (and perhaps slightly more tested) changes for v1 that I wouldn't mind backporting as well if there's plans to continue maintenance on it :)
Are there any thoughts on adding documentation for installation/building/development? The Arch Wiki, for example, shows one way of installing that we could include in the README. The best method of installing (python) dependencies for development from
pyproject.toml
that I know of right now is to dopip install .; pip uninstall keyboard-center
- apparently that's still a WIP PEP or something.