Skip to main content

A CLI linter for Python that flags optimization and security issues

Project description

PyWard

PyPI version CI

PyWard is a lightweight command-line linter for Python code. It helps developers catch optimization issues (like unused imports and unreachable code) and security vulnerabilities (such as unsafe eval/exec usage and known CVE patterns).

Features

  • Optimization Checks

    • Detects unused imports
    • Flags unreachable code blocks
  • Security Checks

    • Flags usage of eval() and exec() (e.g., CVE-2025-3248)
    • Detects vulnerable imports like python_json_logger (e.g., CVE-2025-27607)
  • Flexible CLI

    • Run all checks by default
    • Use -o/--optimize to run only optimization checks
    • Use -s/--security to run only security checks
    • Use -v/--verbose for detailed output, even if no issues are found

Installation

Install from PyPI:

pip install pyward-cli

Ensure that you have Python 3.7 or newer.

Usage

Basic usage (runs both optimization and security checks):

pyward <your_python_file.py>

Options

  • -o, --optimize
    Run only optimization checks (unused imports, unreachable code).

  • -s, --security
    Run only security checks (unsafe calls, CVE-based rules).

  • -v, --verbose
    Show detailed warnings and suggestions, even if no issues are detected.

Examples

Run all checks on demo.py:

pyward demo.py

Run only optimization checks:

pyward -o demo.py

Run only security checks:

pyward -s demo.py

Run with verbose mode:

pyward -v demo.py

Contributing

Contributions are welcome! To add new rules or improve existing ones:

  1. Fork the repository.
  2. Create a new branch (e.g., feature/new-rule).
  3. Implement your changes and add tests if applicable.
  4. Open a pull request detailing your enhancements.

Please adhere to the project’s coding style and include meaningful commit messages. For more details on the contributing process, see the CONTRIBUTING

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributors

Karan
Karan Vasudevamurthy
cafewang/
cafewang
REECK
REECK MONDAL
nature011235/
nature011235
DannyNavi/
DannyNavi
Ritwik
Ritwik Singh
Aydyn
Aydyn Maxadov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyward_cli-0.1.7.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyward_cli-0.1.7-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file pyward_cli-0.1.7.tar.gz.

File metadata

  • Download URL: pyward_cli-0.1.7.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pyward_cli-0.1.7.tar.gz
Algorithm Hash digest
SHA256 975bad28c5e66cad3d8ef5011cbeab008c91d4f23804e5a709458fb50de14722
MD5 49e5c3025ce3b30be4357c22f80a23d3
BLAKE2b-256 143e456923d4660ec876ed73a0388c2d45043a895c973c9fa38058641b7b1904

See more details on using hashes here.

File details

Details for the file pyward_cli-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pyward_cli-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pyward_cli-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5f6196973648e05a51d5ffd861576bbd6b7c0d398c0484c0edf1e342835142
MD5 c8edaa81533dbfc7d64035af362b0992
BLAKE2b-256 8a9ebb79d23ec52a0e22d89ebe677cf5f2a792ce5e949c67d796f7a594492c68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page