Skip to content

Commit

Permalink
PEP 561 CI x 2.
Browse files Browse the repository at this point in the history
This commit is the next (and hopefully last) in a commit chain resolving
spurious continuous integration (CI) errors with respect to recently
supported PEP 561 compliance. Specifically, this commit conditionally
installs mypy under tox only when the active Python interpreter is *not*
PyPy, which remains incompatible with mypy. (*Dubious mellifluousness!*)
  • Loading branch information
leycec committed Feb 20, 2021
1 parent ada1508 commit bbc2cbb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion beartype/_util/py/utilpyinterpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See "LICENSE" for further details.

'''
**Beartype Python interpreter utilities.**
Project-wide **Python interpreter utilities.**
This private submodule is *not* intended for importation by downstream callers.
'''
Expand Down
30 changes: 26 additions & 4 deletions beartype/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
# installation. This includes all standard Python and package modules but
# *NOT* third-party dependencies, which if currently uninstalled will only be
# installed at some later time in the installation.
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# WARNING: To avoid polluting the public module namespace, external attributes
# should be locally imported at module scope *ONLY* under alternate private
# names (e.g., "from argparse import ArgumentParser as _ArgumentParser" rather
# than merely "from argparse import ArgumentParser").
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

import sys as _sys
from typing import Tuple
from beartype._util.py.utilpyinterpreter import IS_PYPY as _IS_PYPY
from typing import Tuple as _Tuple

# See the "beartype.cave" submodule for further commentary.
__all__ = ['STAR_IMPORTS_CONSIDERED_HARMFUL']
Expand Down Expand Up @@ -92,7 +94,7 @@
'''


def _convert_version_str_to_tuple(version_str: str) -> Tuple[int, ...]:
def _convert_version_str_to_tuple(version_str: str) -> _Tuple[int, ...]:
'''
Convert the passed human-readable ``.``-delimited version string into a
machine-readable version tuple of corresponding integers.
Expand Down Expand Up @@ -280,12 +282,31 @@ def _convert_version_str_to_tuple(version_str: str) -> Tuple[int, ...]:
'''

# ....................{ METADATA ~ libs : test }....................
LIBS_TESTTIME_MANDATORY_TOX = (
_LIBS_TESTTIME_MANDATORY_MYPY = (
# A *VERY* modern version of mypy is recommended. Even fairly recent older
# versions of mypy are significantly deficient with respect to error
# reporting to the point of uselessness.
'mypy >=0.800',
'mypy >=0.800' ,
) if not _IS_PYPY else ()
'''
**Mandatory mypy test-time package dependency** (i.e., dependencies required
to test this package under :mod:`tox`) as a tuple of :mod:`setuptools`-specific
requirements strings of the format ``{project_name}
{comparison1}{version1},...,{comparisonN}{versionN}`` if the active Python
interpreter is not PyPy *or* the empty tuple otherwise (i.e., if this
interpreter is PyPy).
See Also
----------
:data:`LIBS_RUNTIME_OPTIONAL`
Further details.
https://mypy.readthedocs.io/en/stable/faq.html#does-it-run-on-pypy
Official documentation discussing mypy's current incompatibility with PyPy
to presumably be fixed at some future point.
'''


LIBS_TESTTIME_MANDATORY_TOX = _LIBS_TESTTIME_MANDATORY_MYPY + (
# A fairly modern version of pytest is required.
'pytest >=4.0.0',
)
Expand All @@ -294,6 +315,7 @@ def _convert_version_str_to_tuple(version_str: str) -> Tuple[int, ...]:
to test this package under :mod:`tox`) as a tuple of :mod:`setuptools`-specific
requirements strings of the format ``{project_name}
{comparison1}{version1},...,{comparisonN}{versionN}``.
See Also
----------
:data:`LIBS_RUNTIME_OPTIONAL`
Expand Down
1 change: 0 additions & 1 deletion beartype_test/a90_func/pep/test_pep561_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def test_pep561_mypy() -> None:
'''

# Defer heavyweight imports.
from beartype_test.util.os.command.pytcmdexit import is_success
from beartype_test.util.path.pytpathproject import get_project_package_dir
from mypy import api

Expand Down

0 comments on commit bbc2cbb

Please sign in to comment.