
Add cusy namespace

Merge request reports
Activity
assigned to @tim
5 5 from importlib import metadata 6 6 7 7 8 APP_NAME = "Polarizer" 8 APP_NAME = "cusy.polarizer" 9 9 APP_ID = APP_NAME.lower() 10 10 ENV_PREFIX = f"{APP_NAME.upper()}_" 11 VERSION = metadata.version("polarizer") 11 VERSION = metadata.version("cusy.polarizer") - Comment on lines -8 to +11
I can see that these constants are somewhat confusing.
APP_NAME
is supposed to be the human-readable name and is used in the user agent,--help
, and API docs.APP_ID
is currently only used as a prefix in the Prometheus metrics. I think both shouldn't have a namespace prefix, but they could definitely use some comments.How about this?
8 APP_NAME = "cusy.polarizer" 9 APP_ID = APP_NAME.lower() 10 ENV_PREFIX = f"{APP_NAME.upper()}_" 11 VERSION = metadata.version("cusy.polarizer") 8 # Name of the application, for humans to read. 9 APP_NAME = "Polarizer" 10 11 # Some identifier for the application, only letters and underscore. 12 # Will be used as Prometheus series prefix, for example. 13 APP_ID = APP_NAME.lower() 14 15 # Python identifier for the application, possibly namespaced. 16 APP_PKG = f"cusy.{APP_ID}" 17 18 # Prefix used for environment variables. Only letters and underscore. 19 ENV_PREFIX = f"{APP_NAME.upper()}_" 20 21 # Version of the application. 22 VERSION = metadata.version(APP_PKG)
3 3 # SPDX-License-Identifier: AGPL-3.0-only 4 4 5 5 [project] 6 name = "polarizer" 6 name = "cusy.polarizer" This will also rename the package, which means that users are going to have to install using
pip install cusy-polarizer
instead of justpip install polarizer
. And I think it's going to breakuvx
too, because the executable is no longer called the same as the package…? Is that really what you're suggesting?I have now uploaded the project to
test.pypi.org
: https://test.pypi.org/project/cusy.polarizer/. If all dependencies are already installed, you can install it from there withpython -m pip install -i https://test.pypi.org/simple/ cusy.polarizer
. You can then importcusy.polarizer
in Python and run it on the command line.Alternatively, the package can be installed with
uv add --index https://test.pypi.org/simple/ --index-strategy unsafe-best-match cusy.polarizer
.cusy.polarizer
can then also be imported into Python and called on the command line withcusy.polarizer
oruv run cusy.polarizer
. Onlyuvx
is currently still causing problems.