Skip to main content

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

Metadata

Release files for pyward-cli 0.2.1

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

Source distribution (sdist)

Source distribution for pyward-cli 0.2.1
File Size Uploaded
pyward_cli-0.2.1.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyward-cli 0.2.1
File Interpreter ABI Platform
pyward_cli-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.6 kB

Release files / pyward_cli-0.2.1.tar.gz

Download URL pyward_cli-0.2.1.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
854a1daf85df1dd3d1e43f869c46f02697b02a3f292ea430f07825045edad250
BLAKE2b-256 checksum
How to use checksums
e6848235157423343685dcbcd3bb4b4e3c371a5cd891373ad49917d3afe2b8c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / pyward_cli-0.2.1-py3-none-any.whl

Download URL pyward_cli-0.2.1-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6123ef313a5646df3934f267aba266b88cf9e50712e3c197303b46bcf4803a0f
BLAKE2b-256 checksum
How to use checksums
64f451da47a5f0fc0ecc8088004a6b258383d1795105b5ef296055d3ac8211ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.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