From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, ...
Date: Fri, 22 Nov 2024 21:35:32 +0000 (UTC) [thread overview]
Message-ID: <1732311314.3deb50dd5394ef306a911fdd37a1bf92ae658adc.mgorny@gentoo> (raw)
commit: 3deb50dd5394ef306a911fdd37a1bf92ae658adc
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 22 15:07:02 2024 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Nov 22 21:35:14 2024 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=3deb50dd
python: Enforce a stricter PyPI package naming policy
Enforce a stricter package naming policy that requires using lowercase
names and hyphens over underscores. Once this change lands, I'll update
the Python Guide as well.
Previously, the policy was to permit either forcing lowercase, or to
follow upstream naming (and the name check, more liberally, was done
case-insensitively), with a note to enforce consistency across different
packages. This caused twofold problems.
Firstly, not all packages ended up following the policy for consistent
naming -- so we e.g. have flit-core but flit_scm, or flask but
Frozen-Flask. Part of the problem is that 1) PyPI packages themselves,
particularly third-party extensions, don't follow consistent naming
themselves, and 2) some PyPI packages actually get "renamed" with case
and/or hyphen changes.
Secondly, this policy makes naming less predictable. In particular,
with upstream name of "flit-scm", you don't immediately figure out it's
"flit_scm" in Gentoo, or with "PyGithub" you can't guess whether to look
for "PyGithub" or "pygithub".
The changed policy will require changes to 44 packages in Gentoo.
Closes: https://github.com/pkgcore/pkgcheck/pull/717
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
src/pkgcheck/checks/python.py | 4 ++--
.../PythonPackageNameCheck/PythonMismatchedPackageName/expected.json | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index bacbdb5a..392241b2 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -946,5 +946,5 @@ class PythonPackageNameCheck(Check):
return PROJECT_SYMBOL_NORMALIZE_RE.sub("-", project).lower()
pypi_name = pypi_remotes[0].name
- if normalize(pkg.package) != normalize(pypi_name):
- yield PythonMismatchedPackageName(pypi_name.replace(".", "-"), pkg=pkg)
+ if pkg.package != normalize(pypi_name):
+ yield PythonMismatchedPackageName(normalize(pypi_name), pkg=pkg)
diff --git a/testdata/data/repos/python/PythonPackageNameCheck/PythonMismatchedPackageName/expected.json b/testdata/data/repos/python/PythonPackageNameCheck/PythonMismatchedPackageName/expected.json
index 3c85ada5..5142f6a8 100644
--- a/testdata/data/repos/python/PythonPackageNameCheck/PythonMismatchedPackageName/expected.json
+++ b/testdata/data/repos/python/PythonPackageNameCheck/PythonMismatchedPackageName/expected.json
@@ -1 +1,2 @@
-{"__class__": "PythonMismatchedPackageName", "category": "dev-python", "package": "PythonMismatchedPackageName1", "recommended": "MismatchedPackageName1"}
+{"__class__": "PythonMismatchedPackageName", "category": "dev-python", "package": "PythonMismatchedPackageName0", "recommended": "pythonmismatchedpackagename0"}
+{"__class__": "PythonMismatchedPackageName", "category": "dev-python", "package": "PythonMismatchedPackageName1", "recommended": "mismatchedpackagename1"}
next reply other threads:[~2024-11-22 21:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 21:35 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-08-01 19:41 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, Arthur Zamarin
2023-09-23 15:10 Arthur Zamarin
2023-04-24 16:43 Arthur Zamarin
2023-02-03 13:03 Arthur Zamarin
2023-01-30 19:07 Arthur Zamarin
2023-01-18 5:19 Arthur Zamarin
2023-01-18 5:19 Arthur Zamarin
2023-01-14 20:29 Arthur Zamarin
2023-01-02 20:19 Arthur Zamarin
2022-10-30 18:04 Arthur Zamarin
2022-10-13 17:06 Arthur Zamarin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1732311314.3deb50dd5394ef306a911fdd37a1bf92ae658adc.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox