Skip to main content

py_static_check

py_static_check can statically check your Python code for a lot of common errors. It uses a modified pyflakes code and extends with following things:

  • Ability to specify what star imports resolve to (-s argument)

  • Ability to ignore unused import warnings (-i argument)

  • Better sorting of warnings/errors

For more information check out:

To install it do following:

sudo easy_install py_static_check

Here are some of the things py_static_check can do.

Catch undefined names, even for star imports

Example code:

from os import *

def function_with_error():
    print path
    print paths

star_imports.py:

import os
STAR_IMPORTS = {
    'os': os.__all__,
}

When ran with py_static_check:

$ py_static_check -s tests/star_import.py tests/undefined_name_star.py
tests/undefined_name.py:5: undefined name 'paths

Ignore not used warnings

Exampel code:

from os import path

When ran with py_static_check -i option:

$ py_static_check -i tests/ignore_not_used.py

$ py_static_check tests/ignore_not_used.py
tests/ignore_not_used.py:10: 'path' imported but unused

Assigned but never used

Like pyflakes it can catch a lot of errors, such as defining a variable without using it.

Exampel code:

def some_function():
    def inner_fn():
        local_var = ""

When ran with py_static_check:

$ py_static_check tests/assigned_but_never_used.py

tests/assigned_but_never_used.py:8: local variable 'local_var' is assigned to but never used

Copyright: 2011 by amix License: MIT.

Release files for py_static_check 1.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 py_static_check 1.2
File Size Uploaded
py_static_check-1.2.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py_static_check 1.2
File Interpreter ABI Platform
py_static_check-1.2-py2.7.egg Legacy Egg format - - Details

Total release size: 32.5 kB

Release files / py_static_check-1.2.tar.gz

Download URL py_static_check-1.2.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
67bc0377ee40a422d5d92a7d4a5e6f2275ba16567fe6a1836f7833b1cdad479f
BLAKE2b-256 checksum
How to use checksums
387fde1683a9a61586caa476ceda3572f07b3f229c6ee756dd339c97ad4658fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / py_static_check-1.2-py2.7.egg

Download URL py_static_check-1.2-py2.7.egg
Size 22.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
f8355d971c1271c587379b2fc922f5b533e97141295d514206a6385751e9f679
BLAKE2b-256 checksum
How to use checksums
09564c15db657129dcc0100e5d0786ccc8c0cb7c328a1e9c2d78691792a3aeaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

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