Skip to content
Snippets Groups Projects

:truck: Add cusy namespace

Open Veit Schiele requested to merge namespace into main
3 unresolved threads

Merge request reports

Pipeline #8403 passed

Pipeline passed for de67bb32 on namespace

Ready to merge by members who can write to the target branch.
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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?

    Suggested change
    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)
  • Please register or sign in to reply
  • Tim Weber
    Tim Weber @tim started a thread on the diff
  • 14 14 ]
    15 15
    16 16 [project.scripts]
    17 polarizer = "polarizer.cli:cli"
    17 "cusy.polarizer" = "cusy.polarizer.cli:cli"
  • I have some remarks and questions about this. I've added most of them as review comments, but I'd appreciate if you could call me at your convenience to talk about it.

  • Tim Weber requested changes

    requested changes

  • Tim Weber
    Tim Weber @tim started a thread on the diff
  • 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 just pip install polarizer. And I think it's going to break uvx too, because the executable is no longer called the same as the package…? Is that really what you're suggesting?

    • Author Maintainer

      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 with python -m pip install -i https://test.pypi.org/simple/ cusy.polarizer. You can then import cusy.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 with cusy.polarizer or uv run cusy.polarizer. Only uvx is currently still causing problems.

    • Please register or sign in to reply
  • Tim Weber added 27m of time spent

    added 27m of time spent

  • Please register or sign in to reply
    Loading