client_python icon indicating copy to clipboard operation
client_python copied to clipboard

should the project/package name be `prometheus-client` rather than `prometheus_client`

Open calestyo opened this issue 9 months ago • 3 comments

Hey.

I stumbled over the question what to use when one specifies the Prometheus Client as a dependency= in pyproject.toml?

  • you guys seem to use prometheus_client (underscore) https://github.com/prometheus/client_python/blob/46eae7bae88f76951f7246d9f359f2dd5eeff110/pyproject.toml#L6C9-L6C26
  • PyPi seems to use prometheus-client (i.e. when one enters the URL with underscore, it forwards to the one with hyphen)

The actual package build/installation seems to work with both names.

For me the whole Python packaging standard are like big mess ^^... but, if I understand correctly the following possibly means:

The name should be lowercased with all runs of the characters ., -, or _ replaced with a single - character.

that the name should be with hypen.

So maybe that should be changed in pyproject.toml and many other places like e.g.:

  • https://github.com/prometheus/client_python/blob/46eae7bae88f76951f7246d9f359f2dd5eeff110/README.md?plain=1#L8
  • https://github.com/prometheus/client_python/blob/46eae7bae88f76951f7246d9f359f2dd5eeff110/pyproject.toml#L49
  • https://github.com/prometheus/client_python/blob/46eae7bae88f76951f7246d9f359f2dd5eeff110/README.md?plain=1#L20

and perhaps more in tox.ini and mypy.ini?

Cheers, Chris.

calestyo avatar Feb 21 '25 19:02 calestyo

As mentioned in Names and normalization:

This means that the following names are all equivalent:

  • friendly-bard (normalized form)
  • Friendly-Bard
  • FRIENDLY-BARD
  • friendly.bard
  • friendly_bard
  • friendly--bard
  • FrIeNdLy-._.-bArD (a terrible way to write a name, but it is valid)

Whether the project name is prometheus_client or even PrOmEtHeUs-._.-ClIeNt(a terrible way to write a name, but it is valid), it will be normalized as prometheus-client when built into a pypi package.

ethanschen avatar Mar 01 '25 07:03 ethanschen

Yes, but since it's anyway normalised and since the recommendation is to use -, I figured maybe it should be changed for clarity. :-)

calestyo avatar Mar 01 '25 18:03 calestyo

Yeah, as mentioned they are equivalent. I would be ok with updating pyproject.toml and other locations to use the normalized form if that helps reduce any confusion.

csmarchbanks avatar Mar 03 '25 16:03 csmarchbanks