pkgcheck.checks.python module¶
- class pkgcheck.checks.python.DistutilsNonPEP517Build(pkg, **kwargs)[source]¶
Bases:
VersionResult,WarningEbuild 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.EPyTestPluginsSuggestion(pkg, **kwargs)[source]¶
Bases:
VersionResult,InfoEPYTEST_PLUGINScan be used to control pluginsThe package could benefit from using
EPYTEST_PLUGINSto specify pytest plugins to be loaded.- property desc¶
Result description.
- name = 'EPyTestPluginsSuggestion'¶
- class pkgcheck.checks.python.MisplacedEPyTestVar(variable, **kwargs)[source]¶
Bases:
LineResult,ErrorInvalid placement of
EPYTEST_*variableEPYTEST_*variables need to be set prior todistutils_enable_teststo enable its functionality. The exception to that rule are local overrides inpython_test()– we presume the author knows what they’re doing.- property desc¶
Result description.
- name = 'MisplacedEPyTestVar'¶
- class pkgcheck.checks.python.MissingPythonEclass(eclass, dep_type, dep, **kwargs)[source]¶
Bases:
VersionResult,WarningPackage 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,WarningPackage has mismatch in dependencies between call to
python_gen_any_depandpython_has_version.For every dependency used under
python_gen_any_dep, a matching check for a matching python implementation inpython_has_versionshould 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,WarningPackage has mismatch in dependency’s use flags between call to
python_gen_any_depandpython_has_version.For every dependency used under
python_gen_any_dep, the check for a matching python implementation inpython_has_versionshould 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:
CheckPython 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_OPTIONALandDISTUTILS_USE_PEP517 != nobut${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.EPyTestPluginsSuggestion'>, <class 'pkgcheck.checks.python.MisplacedEPyTestVar'>, <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'>, <class 'pkgcheck.checks.python.RedundantPyTestDisablePluginAutoload'>, <class 'pkgcheck.checks.python.ShadowedEPyTestTimeout'>})¶
- scope = <PackageScope desc='version' @0x7fb1134c5220>¶
- 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:
CheckCheck python ebuilds for possible
PYTHON_COMPATupdates.Supports ebuilds inheriting
python-r1,python-single-r1, andpython-any-r1.- known_results = frozenset({<class 'pkgcheck.checks.python.PythonCompatUpdate'>})¶
- scope = <PackageScope desc='version' @0x7fb1134c5220>¶
- 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,InfoPYTHON_COMPATcan be updated to support newer python version(s).- property desc¶
Result description.
- name = 'PythonCompatUpdate'¶
- class pkgcheck.checks.python.PythonEclassError(msg, **kwargs)[source]¶
Bases:
VersionResult,ErrorGeneric python eclass error.
- property desc¶
Result description.
- name = 'PythonEclassError'¶
- class pkgcheck.checks.python.PythonFetchableCheck(*args, use_addon)[source]¶
Bases:
CheckPerform 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' @0x7fb1134c5220>¶
- class pkgcheck.checks.python.PythonGHDistfileSuffix(filename, uri, **kwargs)[source]¶
Bases:
VersionResult,WarningDistfile 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_URIto include the suffix. There is no need to contact upstream, as it is done simply by adding-> ${P}.gh.tar.gzafter the URI.- property desc¶
Result description.
- name = 'PythonGHDistfileSuffix'¶
- class pkgcheck.checks.python.PythonHasVersionMissingPythonUseDep(line, lineno, **kwargs)[source]¶
Bases:
LineResult,ErrorPackage calls
python_has_versionorhas_versionwithout[${PYTHON_USEDEP}]or[${PYTHON_SINGLE_USEDEP}]suffix.All calls to
python_has_versionorhas_versioninsidepython_check_depsshould contain[${PYTHON_USEDEP}]or[${PYTHON_SINGLE_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,StylePackage uses has_version inside
python_check_deps.Ebuilds which declare the
python_check_depsfunction (which tests Python implementations for matching dependencies) should use the specialpython_has_versionfunction (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,WarningPyPI URI used inline instead of via pypi.eclass
- name = 'PythonInlinePyPIURI'¶
- class pkgcheck.checks.python.PythonMismatchedPackageName(recommended: str, **kwargs)[source]¶
Bases:
PackageResult,InfoPackage 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,WarningPackage is missing
PYTHON_DEPS.The
python-r1andpython-single-r1eclasses require the packages to explicitly reference${PYTHON_DEPS}inRDEPEND(andDEPEND, if necessary);python-any-r1requires 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,WarningPackage is missing
PYTHON_REQUIRED_USE.The
python-r1andpython-single-r1eclasses 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,WarningPackage is missing BDEPEND on setuptools-scm or alike.
Packages which define
SETUPTOOLS_SCM_PRETEND_VERSIONshould BDEPEND ondev-python/setuptools-scmor 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:
CheckCheck ebuild names in dev-python/*.
- known_results = frozenset({<class 'pkgcheck.checks.python.PythonMismatchedPackageName'>})¶
- scope = <PackageScope desc='package' @0x7fb113484b90>¶
- class pkgcheck.checks.python.PythonRuntimeDepInAnyR1(dep_type, dep, **kwargs)[source]¶
Bases:
VersionResult,WarningPackage depends on Python at runtime but uses any-r1 eclass.
The
python-any-r1eclass 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-r1orpython-single-r1eclass, otherwise the runtime dependency should be removed.- property desc¶
Result description.
- name = 'PythonRuntimeDepInAnyR1'¶
- class pkgcheck.checks.python.RedundantPyTestDisablePluginAutoload(line, lineno, **kwargs)[source]¶
Bases:
LineResult,WarningRedundant
PYTEST_DISABLE_PLUGIN_AUTOLOADThe package uses
EPYTEST_PLUGINSto disable plugin autoloading already, soPYTEST_DISABLE_PLUGIN_AUTOLOADis redundant.- property desc¶
Result description.
- name = 'RedundantPyTestDisablePluginAutoload'¶
- class pkgcheck.checks.python.ShadowedEPyTestTimeout(line, lineno, **kwargs)[source]¶
Bases:
LineResult,WarningEPYTEST_TIMEOUTshadows user-specified valueEPYTEST_TIMEOUTshould be set via${EPYTEST_TIMEOUT:=...}to permit using an environment variable to override it.- property desc¶
Result description.
- name = 'ShadowedEPyTestTimeout'¶