Public API¶
Functions:
|
Load the |
|
Try to import |
|
Convert filesystem paths into dotted import names. |
Classes:
|
|
|
Class for checking modules can be imported. |
|
Returned by |
|
Returned by |
-
load_toml
(filename)[source]¶ Load the
importcheck
configuration mapping from the given TOML file.- Parameters
- Return type
-
check_module
(module, combine_output=False)[source]¶ Try to import
module
, otherwise handle the resulting error.
-
paths_to_modules
(*paths)[source]¶ Convert filesystem paths into dotted import names.
For example,
foo/bar.py
becomesfoo.bar
.New in version 0.3.0.
-
typeddict
ConfigDict
[source]¶ Bases:
TypedDict
typing.TypedDict
representing the configuration mapping parsed frompyproject.toml
or similar.
-
class
ImportChecker
(modules, *, show=False, colour=False)[source]¶ Bases:
object
Class for checking modules can be imported.
New in version 0.3.0.
- Parameters
Attributes:
The list of modules to be checked.
Dictionary holding statistics about passing/failing imports.
Whether to show stdout and stderr generated from imports.
Whether to use coloured output.
Methods:
Checks modules can be imported.
Returns a string reporting the number of modules imported successfully.
-
namedtuple
OK
(module)[source]¶ Bases:
NamedTuple
Returned by
check_module()
if the module is successfully imported.- Fields
module (
str
) – The name of the module being checked.
-
namedtuple
Error
(module, stdout, stderr)[source]¶ Bases:
NamedTuple
Returned by
check_module()
if the module could not be successfully imported.- Fields
module (
str
) – The name of the module being checked.stdout (
str
) – The standard output from importing the module. This may also contain standard error if the streams are combined bycheck_module()
stderr (
str
) – Standard error generated by importing the module. This may also contain standard out if the streams are combined bycheck_module()
.