Skip to main content

A tool to measure the percentage of typed arguments in python functions

Project description

PyTypeGauge

PyTypeGauge is a Python library that provides comprehensive statistics and metrics for your typed functions and Python code. The primary goal is to encourage developers to achieve 100% type coverage in their codebases.

⚠️ Note: PyTypeGauge is a simple tool designed to encourage better type annotation in your Python code. It does not validate the correctness of the types you add. The concept is straightforward: it recursively scans all Python files in a repository, using regular expressions to identify function prototypes and check whether their arguments and return types are annotated. PyTypeGauge then calculates the proportion of fully typed functions and arguments, providing a summary of your type coverage. Additionally, you can generate a comprehensive report in markdown format, highlighting functions and files that may need refactoring or additional type annotations.

PyTypeGauge is intended to be used with pre-commit hooks and can update your README.md with your project's type coverage progress.

For more advanced type checking and validation, consider using other well-maintained libraries such as mypy or pyright.

Features

  • Analyze the type coverage of your Python functions.
  • Generate detailed reports on the use of type hints.
  • Track the progress of type hint adoption in your codebase.

Installation

To install PyTypeGauge, run:

⚠️ Note: PyTypeGauge is not yet available on PyPI.

pip install pytypegauge

Usage

Here's a simple example of how to use PyTypeGauge:

pytypegauge [directory] [options]

for more information, run:

pytypegauge --help

TODO:

  • Add hooks for pre-commit
  • Add a description of the project
  • Add a list of the project's dependencies in setup.py
  • Fix bugs in the project
  • Add a Logger to the project for Debugging
  • Type correctly the project
  • Add the feature with matplotlib
  • Translate the code in English
  • Add the feature with pandas
  • add tests for the project
  • Clean the code
  • Add to pypi
  • Make the readme more informative
  • Create the hooks to use this project as a template

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

pytypegauge-0.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

pytypegauge-0.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file pytypegauge-0.1.tar.gz.

File metadata

  • Download URL: pytypegauge-0.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.5

File hashes

Hashes for pytypegauge-0.1.tar.gz
Algorithm Hash digest
SHA256 852004847a2870bba6486f035d7504a391956bb1692943e8970d8fc1dbd6b05a
MD5 5f692ad9350f5e345f31b5b83d28430c
BLAKE2b-256 9c5b30863ca3de3489b74ded45add898a50cd278b00517e8dff15edaa0437220

See more details on using hashes here.

File details

Details for the file pytypegauge-0.1-py3-none-any.whl.

File metadata

  • Download URL: pytypegauge-0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.5

File hashes

Hashes for pytypegauge-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 447ef713367f16940d9a7041eface252c7a1d4643592f6d4df44d46fdf8308f1
MD5 1a70385054423e95546db057925244af
BLAKE2b-256 1d4ab26ac7adf08c67c541be76789d16a3f335912874ec71f241a2e4b89e8be3

See more details on using hashes here.

Supported by

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