pkgcheck.checks.python module¶
- class pkgcheck.checks.python.DistutilsNonPEP517Build(pkg, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Ebuild uses the deprecated non-PEP517 build
- desc = 'uses deprecated non-PEP517 build mode, please switch to DISTUTILS_USE_PEP517=...'¶
- name = 'DistutilsNonPEP517Build'¶
- class pkgcheck.checks.python.MissingPythonEclass(eclass, dep_type, dep, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package depends on Python but does not use the eclasses.
All packages depending on Python are required to use one of the following python eclasses:
python-r1
,python-single-r1
, orpython-any-r1
. For documentation on choosing the correct eclass, please see the Gentoo Python Guide page on eclasses [1].- property desc¶
Result description.
- name = 'MissingPythonEclass'¶
- class pkgcheck.checks.python.PythonAnyMismatchedDepHasVersionCheck(dep_category, dep_atom, use_flags, location, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package has mismatch in dependencies between call to
python_gen_any_dep
andpython_has_version
.For every dependency used under
python_gen_any_dep
, a matching check for a matching python implementation inpython_has_version
should exist [2].[2] https://projects.gentoo.org/python/guide/any.html#dependencies
- property desc¶
Result description.
- name = 'PythonAnyMismatchedDepHasVersionCheck'¶
- class pkgcheck.checks.python.PythonAnyMismatchedUseHasVersionCheck(dep_category, dep_atom, use_flags, location, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package has mismatch in dependency’s use flags between call to
python_gen_any_dep
andpython_has_version
.For every dependency used under
python_gen_any_dep
, the check for a matching python implementation inpython_has_version
should match the exact use flags [3].[3] https://projects.gentoo.org/python/guide/any.html#dependencies
- property desc¶
Result description.
- name = 'PythonAnyMismatchedUseHasVersionCheck'¶
- class pkgcheck.checks.python.PythonCheck(options, **kwargs)[source]¶
Bases:
Check
Python eclass checks.
Check whether Python eclasses are used for Python packages, and whether they don’t suffer from common mistakes.
- check_pep517(pkg)[source]¶
Check Python ebuilds for whether PEP517 mode is used and missing optional dependencies.
The problematic case for us is
DISTUTILS_OPTIONAL
andDISTUTILS_USE_PEP517 != no
but${DISTUTILS_DEPS}
is not in the ebuild.
- eclass_any_dep_func = {'python-any-r1': 'python_gen_any_dep', 'python-r1': 'python_gen_any_dep', 'python-single-r1': 'python_gen_cond_dep'}¶
- has_version_default = {'has_version': 'DEPEND', 'python_has_version': 'BDEPEND'}¶
- has_version_known_flags = {'--host-root': 'BDEPEND', '-b': 'BDEPEND', '-d': 'DEPEND', '-r': 'RDEPEND'}¶
- known_results = frozenset({<class 'pkgcheck.checks.python.DistutilsNonPEP517Build'>, <class 'pkgcheck.checks.python.MissingPythonEclass'>, <class 'pkgcheck.checks.python.PythonAnyMismatchedDepHasVersionCheck'>, <class 'pkgcheck.checks.python.PythonAnyMismatchedUseHasVersionCheck'>, <class 'pkgcheck.checks.python.PythonEclassError'>, <class 'pkgcheck.checks.python.PythonHasVersionMissingPythonUseDep'>, <class 'pkgcheck.checks.python.PythonHasVersionUsage'>, <class 'pkgcheck.checks.python.PythonMissingDeps'>, <class 'pkgcheck.checks.python.PythonMissingRequiredUse'>, <class 'pkgcheck.checks.python.PythonMissingSCMDependency'>, <class 'pkgcheck.checks.python.PythonRuntimeDepInAnyR1'>})¶
- scope = <PackageScope desc='version' @0x7fc9bedc9290>¶
- setuptools_scm = frozenset({'dev-python/flit-scm', 'dev-python/flit_scm', 'dev-python/hatch-vcs', 'dev-python/setuptools-scm', 'dev-python/setuptools_scm'})¶
- class pkgcheck.checks.python.PythonCompatCheck(*args)[source]¶
Bases:
Check
Check python ebuilds for possible
PYTHON_COMPAT
updates.Supports ebuilds inheriting
python-r1
,python-single-r1
, andpython-any-r1
.- known_results = frozenset({<class 'pkgcheck.checks.python.PythonCompatUpdate'>})¶
- scope = <PackageScope desc='version' @0x7fc9bedc9290>¶
- whitelist_backports = frozenset({'dev-python/backports-tarfile', 'dev-python/exceptiongroup', 'dev-python/importlib-metadata', 'dev-python/taskgroup', 'dev-python/typing-extensions', 'dev-python/unittest-or-fail', 'dev-python/zipp'})¶
- class pkgcheck.checks.python.PythonCompatUpdate(updates, **kwargs)[source]¶
Bases:
VersionResult
,Info
PYTHON_COMPAT
can be updated to support newer python version(s).- property desc¶
Result description.
- name = 'PythonCompatUpdate'¶
- class pkgcheck.checks.python.PythonEclassError(msg, **kwargs)[source]¶
Bases:
VersionResult
,Error
Generic python eclass error.
- property desc¶
Result description.
- name = 'PythonEclassError'¶
- class pkgcheck.checks.python.PythonFetchableCheck(*args, use_addon)[source]¶
Bases:
Check
Perform Python-specific checks to fetchables.
- known_results = frozenset({<class 'pkgcheck.checks.python.PythonGHDistfileSuffix'>, <class 'pkgcheck.checks.python.PythonInlinePyPIURI'>})¶
- static normalize_distribution_name(name: str) str [source]¶
Normalize the distribution according to sdist/wheel spec
- required_addons = (<class 'pkgcheck.addons.UseAddon'>,)¶
- scope = <PackageScope desc='version' @0x7fc9bedc9290>¶
- class pkgcheck.checks.python.PythonGHDistfileSuffix(filename, uri, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Distfile from GitHub is missing “.gh.tar.gz” suffix.
Python ebuilds frequently prefer GitHub archives over sdist tarballs published on PyPI. Since both kinds of distfiles often have the same name, “.gh.tar.gz” suffix is often used for the former to avoid filename collisions with official archives published upstream.
To solve this warning, rename the distfile in
SRC_URI
to include the suffix. There is no need to contact upstream, as it is done simply by adding-> ${P}.gh.tar.gz
after the URI.- property desc¶
Result description.
- name = 'PythonGHDistfileSuffix'¶
- class pkgcheck.checks.python.PythonHasVersionMissingPythonUseDep(line, lineno, **kwargs)[source]¶
Bases:
LineResult
,Error
Package calls
python_has_version
orhas_version
without[${PYTHON_USEDEP}]
suffix.All calls to
python_has_version
orhas_version
insidepython_check_deps
should contain[${PYTHON_USEDEP}]
suffix for the dependency argument [4].[4] https://projects.gentoo.org/python/guide/any.html#dependencies
- property desc¶
Result description.
- name = 'PythonHasVersionMissingPythonUseDep'¶
- class pkgcheck.checks.python.PythonHasVersionUsage(lines, *args, **kwargs)[source]¶
Bases:
LinesResult
,Style
Package uses has_version inside
python_check_deps
.Ebuilds which declare the
python_check_deps
function (which tests Python implementations for matching dependencies) should use the specialpython_has_version
function (instead ofhas_version
) for enhanced log output and defaults [5].[5] https://projects.gentoo.org/python/guide/any.html#dependencies
- property desc¶
Result description.
- name = 'PythonHasVersionUsage'¶
- class pkgcheck.checks.python.PythonInlinePyPIURI(url: str, replacement: tuple[str, ...] | None = None, normalize: bool | None = None, append: bool | None = None, pypi_pn: str | None = None, **kwargs)[source]¶
Bases:
VersionResult
,Warning
PyPI URI used inline instead of via pypi.eclass
- name = 'PythonInlinePyPIURI'¶
- class pkgcheck.checks.python.PythonMismatchedPackageName(recommended: str, **kwargs)[source]¶
Bases:
PackageResult
,Info
Package name does not follow PyPI-based naming policy.
All packages in
dev-python/*
that are published on PyPI, must be named to match their respective PyPI names [6].[6] https://projects.gentoo.org/python/guide/package-maintenance.html#package-name-policy
- name = 'PythonMismatchedPackageName'¶
- class pkgcheck.checks.python.PythonMissingDeps(dep_type, dep_value='PYTHON_DEPS', **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package is missing
PYTHON_DEPS
.The
python-r1
andpython-single-r1
eclasses require the packages to explicitly reference${PYTHON_DEPS}
inRDEPEND
(andDEPEND
, if necessary);python-any-r1
requires it inDEPEND
.If Python is used conditionally, the dependency can be wrapped in appropriate USE conditionals.
- property desc¶
Result description.
- name = 'PythonMissingDeps'¶
- class pkgcheck.checks.python.PythonMissingRequiredUse(pkg, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package is missing
PYTHON_REQUIRED_USE
.The
python-r1
andpython-single-r1
eclasses require the packages to explicitly specifyREQUIRED_USE=${PYTHON_REQUIRED_USE}
. If Python is used conditionally, it can be wrapped in appropriate USE conditionals.- desc = 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"'¶
- name = 'PythonMissingRequiredUse'¶
- class pkgcheck.checks.python.PythonMissingSCMDependency(pkg, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package is missing BDEPEND on setuptools-scm or alike.
Packages which define
SETUPTOOLS_SCM_PRETEND_VERSION
should BDEPEND ondev-python/setuptools-scm
or a similar package [7].[7] - desc = 'defines SETUPTOOLS_SCM_PRETEND_VERSION but is missing BDEPEND on setuptools-scm or alike'¶
- name = 'PythonMissingSCMDependency'¶
- class pkgcheck.checks.python.PythonPackageNameCheck(options, **kwargs)[source]¶
Bases:
Check
Check ebuild names in dev-python/*.
- known_results = frozenset({<class 'pkgcheck.checks.python.PythonMismatchedPackageName'>})¶
- scope = <PackageScope desc='package' @0x7fc9bedc8f50>¶
- class pkgcheck.checks.python.PythonRuntimeDepInAnyR1(dep_type, dep, **kwargs)[source]¶
Bases:
VersionResult
,Warning
Package depends on Python at runtime but uses any-r1 eclass.
The
python-any-r1
eclass is meant to be used purely for build-time dependencies on Python. However, this package lists Python as a runtime dependency. If this is intentional, the package needs to switch topython-r1
orpython-single-r1
eclass, otherwise the runtime dependency should be removed.- property desc¶
Result description.
- name = 'PythonRuntimeDepInAnyR1'¶