-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
A tool takes as input a python version, host system, python implementation, and body of python code, and returns a set of errors. Some tools may also support querying the type of an expression (e.g. for autocompletion of its attributes in an IDE).
How many and how finely it supports the platform checks, and whether it allows running checks for platforms other than the one it is currently running (simultaneously or in a separate run), is a QoI issue - this document nearly. However, tools should not make it impossible to check Windows-specific code from a Linux host.
At the very least, most tools will want to support python2 vs python3 detection.
Here's my list of branches that should be followed:
assert
andif
statements with comparisons (==
,!=
,<
,>
,<=
,>=
; possibly chained likex < y < z
), andand
,not
, andor
expressions containing only comparisons, which contain only literals (of typestr
,int
, ortuple
of literals) and the following:platform.python_version()
platform.python_version_tuple()
sys.version
sys.version_info
- indexing and slices of the above
sys.hexversion
platform.python_implementation()
platform.system()
sys.platform
maybe? (icky for e.g.linux2
vslinux
)- Some way to specify that a value exported really is supposed to be constant.
- "Anything that is not initialized to
...
" would require changing many stubs that currently usex = ('', 0)
as a short form ofx = ... # type: Tuple[str, int]
. - Use this to implement a
six
stub via the above.
- "Anything that is not initialized to
else
andelif
branches following the above (not thatelif
need not have such an expression)- Other:
if string_literal [not] in sys.modules
maybe? Needs justification.try ... except ImportError
try ... except AttributeError
where the object is a module.try ... except NameError
for builtins e.g.unicode
andlong
.
Metadata
Metadata
Assignees
Labels
No labels