Skip to main content

mck is a Python module checker that verifies if one or more modules can be imported individually.

Some existing Python projects have many modules. In some cases, if you run pydoc, try to generate a reference with Sphinx or want to create unit tests, many of the modules will fail to import.

In these cases, mck can quickly check every module, helping to identify the cause of each error and if there are similar errors, in order to fix them. The output of mck shows all the errors in one place and the progress in fixing them.

The following is a very simple project, it has a package with only two modules:

package/module1.py

import package.module2

def f():
    pass

package/module2.py

from package.module1 import f

def g():
    f()

Will each module import? Instead of manually trying import package.module1 and import package.module2, we run mck and supply the path to the folder of the package:

py -m mck path/package
1 package.module1
Traceback (most recent call last):
  File "~/Documents/mck/example/fails/package/module1.py", line 1, in <module>
    import package.module2
  File "~/Documents/mck/example/fails/package/module2.py", line 1, in <module>
    from package.module1 import f
ImportError: cannot import name 'f' from partially initialized module 'package.module1' (most likely due to a circular import) (~/Documents/mck/example/fails/package/module1.py)

✓ package.module2

1 module(s) failed out of 2

The output shows that module1 fails and module2 passes. The first module fails due to ImportError: cannot import name 'f' from partially initialized module. We can fix this error by changing the import and the reference to function f in module2 to this:

package/module2.py

import package.module1

def g():
    package.module1.f()

The output of mck now shows that the error has been fixed and all modules pass :

py -m mck path/package
✓ package.module1
✓ package.module2

0 module(s) failed out of 2

mck is available here in the Python Package Index (PyPI) for installation using pip, and this is the source code repository in Gitlab.

The name mck is based on the name of other checker programs like fsck, pvck, vgck, pwck.

Metadata

Release files for mck 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mck 0.2
File Size Uploaded
mck-0.2.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mck 0.2
File Interpreter ABI Platform
mck-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / mck-0.2.tar.gz

Download URL mck-0.2.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c6fae57efe25b4aabf67351fd2967508877f228eb4d8e2723cbf1cad7fed8cee
BLAKE2b-256 checksum
How to use checksums
586622c85e57a0fd5b7a14e1bad70d1540fef8d81314ce3dae4e4aec5b0ceb7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / mck-0.2-py3-none-any.whl

Download URL mck-0.2-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2914c2042972188c9380206a95694ff48e5f279cbf6d587e6384f17d96915f09
BLAKE2b-256 checksum
How to use checksums
c006bce0c48afa3f32ef0b662640f5f04f3b50676aa5c647795b15e573097142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page