https://bugzilla.redhat.com/show_bug.cgi?id=1984419 --- Comment #4 from Miro Hrončok <mhroncok@xxxxxxxxxx> --- New Python packaging guidelines: Open questions: [?] Packages that primarily provide applications, services or any kind of executables SHOULD be named according to the general Fedora naming guidelines (e.g. ansible). I guess this is not primarily an application despite having one, right? Would users try to dnf install normalizer? The rest is fine: [x] Every package that uses Python (at runtime and/or build time) and/or installs Python modules MUST explicitly include BuildRequires: python3-devel in its .spec file, even if Python is not actually invoked during build time. [-] If the package uses an alternate Python interpreter instead of python3 (e.g. pypy, jython, python2.7), it MAY instead require the corresponding *-devel package. [x] The following macros MUST be used where applicable... [x] Fedora packages MUST NOT depend on other versions of the CPython interpreter than the current python3. [-] The character + in names of built (i.e. non-SRPM) packages that include .dist-info or .egg-info directories is reserved for Extras and MUST NOT be used for any other purpose. [x] A built (i.e. non-SRPM) package for a Python library MUST be named with the prefix python3-. A source package containing primarily a Python library MUST be named with the prefix python-. [x] The Fedora package’s name SHOULD contain the Canonical project name. If possible, the project name SHOULD be the same as the name of the main importable module, with underscores (_) replaced by dashes (-). [-] If the importable module name and the project name do not match, users frequently end up confused. In this case, packagers SHOULD ensure that upstream is aware of the problem and (especially for new packages where renaming is feasible) strive to get the package renamed. The Python SIG is available for assistance. [x] Packages MUST include the source file (*.py) AND the bytecode cache (*.pyc) for each pure-Python importable module. The source files MUST be included in the same package as the bytecode cache. [-] Scripts that are not importable (typically ones in %{_bindir} or %{_libexecdir}) SHOULD NOT be byte-compiled. [x] Each Python package MUST include Package Distribution Metadata conforming to PyPA specifications (specifically, Recording installed distributons). [x] The metadata SHOULD be included in the same subpackage as the main importable module, if there is one. [x] Packages MUST NOT own shared directories owned by Python itself, such as the top-level __pycache__ directories (%{python3_sitelib}/__pycache__, %{python3_sitearch}/__pycache__). [x] Packagers SHOULD NOT simply glob everything under a shared directory. [x] Every Python package in Fedora SHOULD also be available on the Python Package Index (PyPI). [x] The command pip install PROJECTNAME MUST install the same package (possibly in a different version), install nothing, or fail with a reasonable error message. [x] For any module intended to be used in Python 3 with import MODNAME, the package that includes it SHOULD provide python3-MODNAME, with underscores (_) replaced by dashes (-). [x] For any FOO, a package that provides python3-FOO SHOULD use %py_provides or an automatic generator to also provide python-FOO and python3.X-FOO, where X is the minor version of the interpreter. [x] Every Python package MUST provide python3dist(DISTNAME) and python3.Xdist(DISTNAME), where X is the minor version of the interpreter and DISTNAME is the Canonical project name corresponding to the Dist-info metadata. For example, python3-django would provide python3dist(django) and python3.9dist(django). [x] As mentioned above, each Python package MUST explicitly BuildRequire python3-devel. [x] Packages MUST NOT have dependencies (either build-time or runtime) with the unversioned prefix python- if the corresponding python3- dependency can be used instead. [x] Packages SHOULD NOT have explicit dependencies (either build-time or runtime) with a minor-version prefix such as python3.8- or python3.8dist(. Such dependencies SHOULD instead be automatically generated or a macro should be used to get the version. [x] Packages SHOULD NOT have an explicit runtime dependency on python3. [x] Packages MUST use the automatic Python run-time dependency generator. [x] Packages SHOULD use the opt-in build-dependency generator if possible. [x] The packager MUST inspect the generated requires for correctness. All dependencies MUST be resolvable within the targeted Fedora version. [-] Any necessary changes MUST be done by patches or modifying the source (e.g. with sed), rather than disabling the generator. The resulting change SHOULD be offered to upstream. As an exception, filtering MAY be used for temporary workarounds and bootstrapping. [x] Dependencies covered by the generators SHOULD NOT be repeated in the .spec file. (For example, if the generator finds a requests dependency, then Requires: python3-requests is redundant.) [x] Python packages SHOULD have Provides for all extras the upstream project specifies, except... The [unicode_backport] extra not possible, python-unicodedata2 not in Fedora. [-] A package that provides a Python extra MUST provide python3dist(DISTNAME[EXTRA]) and python3.Xdist(DISTNAME[EXTRA]), where X is the minor version of the interpreter, DISTNAME is the Canonical project name, and EXTRA is the name of a single extra. For example, python3.9dist(requests[security]). These requirements SHOULD be generated using the automatic dependency generator. [-] A package that provides a Python extra MUST require the extra’s main package with exact NEVR. [-] A subpackage that primarily provides one Python extra SHOULD be named by appending + and the extra name to the main package name. For example, python3-requests+security. [-] If an existing extra is removed from an upstream project, the Fedora maintainer SHOULD try to convince upstream to re-introduce it (with an empty list of dependencies). If that fails, the extra SHOULD be Obsoleted from either the main package or another extras subpackage. [x] Shebang lines to invoke Python MUST use %{python3} as the interpreter. The shebang is #! /usr/bin/python3 -s [x] Shebang lines to invoke Python SHOULD be #!%{python3} -%{py3_shebang_flags} and they MAY include extra flags. The shebang is #! /usr/bin/python3 -s [-] If the default flags from the %{py3_shebang_flags} macro are not desirable, packages SHOULD explicitly redefine the macro to remove them. [-] Every executable TOOL for which the current version of Python matters SHOULD also be invokable by python3 -m TOOL. If the software doesn’t provide this functionality, packagers SHOULD ask the upstream to add it. [-] Tightening the what-can-be-packaged..adoc#_pregenerated_code, packages MUST NOT use files pre-generated by Cython. These MUST be deleted in %prep and regenerated during the build. [x] If a test suite exists upstream, it SHOULD be run in the %check section. If that is not possible with reasonable effort, at least a basic smoke test (such as importing the packaged module) MUST be run in %check. [-] You MAY exclude specific failing tests. You MUST NOT disable the entire testsuite or ignore its result to solve a build failure. [-] As an exception, you MAY disable tests with an appropriate %if conditional (e.g. bcond) when bootstrapping. [x] In %check, packages SHOULD NOT run “linters”: code style checkers, test coverage checkers and other tools that check code quality rather than functionality. [-] However, packages SHOULD NOT use an archive that omits test suites, licenses and/or documentation present in other source archives. -- You are receiving this mail because: You are on the CC list for the bug. You are always notified about changes to this product and component _______________________________________________ package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure