Skip to main content

Purity validator for Python code.

Project description

Pure validator

Purity validator for Python code.

GitHub

Overview

Pure validator is a static analysis tool for checking the purity of Python functions and modules. It analyzes Python source code and reports on side effects, global state usage, and other purity-related concerns.

Suppose you have the following code:

def impure_function(): # pragma: pure
    print("This is impure!")

Running the purity checker, will report an error similar to:

example.py:3: Function 'impure_function' is marked as pure but has side effects (print statement)

There is also a flake8 plugin available that can be used to check purity violations in your codebase.

$ flake8 --select PURE file-or-directory

For more information on using flake8, you can refer to the official flake8 documentation.

Features

  • Recursively analyzes Python files in directories
  • Reports purity violations and messages
  • CLI and module entry point (python -mpure_validator)
  • Easy integration with CI/CD

Installation

You can install Pure via pip:

$ pip install pure-validator

Usage

Command Line

$ pure-validator file-or-directory

Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.

License

This project is licensed under the terms of the license found in the LICENSE file.

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

pure_validator-0.3.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

pure_validator-0.3.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file pure_validator-0.3.0.tar.gz.

File metadata

  • Download URL: pure_validator-0.3.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for pure_validator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3e72e330f03edca5230bea593ccf055f59e74f72122930b40e5941ea8c03ceff
MD5 9425f8efa3bc288b63f24d05a41bfede
BLAKE2b-256 008de36f6218ebec81e5e54450fa373e2ed054cbe903c7a37ba31e81086082a1

See more details on using hashes here.

File details

Details for the file pure_validator-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pure_validator-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb16012b0b51a1372af21a4e881b7bfb55b8aa371318728c8e1b410f92af5a49
MD5 a7ffd81d13609e4f448aea21d3a2b49a
BLAKE2b-256 0f4fc0dc8dfc6ef5cfb6e8a0fa819cc2a6658a119cc2dab5284a847b5e355879

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