typeguard


Nametypeguard JSON
Version 4.2.1 PyPI version JSON
download
home_pageNone
SummaryRun-time type checker for Python
upload_time2024-03-24 08:06:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
  :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
  :alt: Build Status
.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
  :target: https://coveralls.io/github/agronholm/typeguard?branch=master
  :alt: Code Coverage
.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
  :target: https://typeguard.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation

This library provides run-time type checking for functions defined with
`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type
annotations, and any arbitrary objects. It can be used together with static type
checkers as an additional layer of type safety, to catch type violations that could only
be detected at run time.

Two principal ways to do type checking are provided:

#. The ``check_type`` function:

   * like ``isinstance()``, but supports arbitrary type annotations (within limits)
   * can be used as a ``cast()`` replacement, but with actual checking of the value
#. Code instrumentation:

   * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
     type checking code injected into them
   * automatically checks function arguments, return values and assignments to annotated
     local variables
   * for generator functions (regular and async), checks yield and send values
   * requires the original source code of the instrumented module(s) to be accessible

Two options are provided for code instrumentation:

#. the ``@typechecked`` function:

   * can be applied to functions individually
#. the import hook (``typeguard.install_import_hook()``):

   * automatically instruments targeted modules on import
   * no manual code changes required in the target modules
   * requires the import hook to be installed before the targeted modules are imported
   * may clash with other import hooks

See the documentation_ for further information.

.. _documentation: https://typeguard.readthedocs.io/en/latest/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "typeguard",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Alex Gr\u00f6nholm <alex.gronholm@nextday.fi>",
    "download_url": "https://files.pythonhosted.org/packages/6e/0e/96ec359939521f8c3e6c7b69526afab96fafe0520b5e1b890e061a66abc9/typeguard-4.2.1.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg\n  :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml\n  :alt: Build Status\n.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github\n  :target: https://coveralls.io/github/agronholm/typeguard?branch=master\n  :alt: Code Coverage\n.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest\n  :target: https://typeguard.readthedocs.io/en/latest/?badge=latest\n  :alt: Documentation\n\nThis library provides run-time type checking for functions defined with\n`PEP 484 <https://www.python.org/dev/peps/pep-0484/>`_ argument (and return) type\nannotations, and any arbitrary objects. It can be used together with static type\ncheckers as an additional layer of type safety, to catch type violations that could only\nbe detected at run time.\n\nTwo principal ways to do type checking are provided:\n\n#. The ``check_type`` function:\n\n   * like ``isinstance()``, but supports arbitrary type annotations (within limits)\n   * can be used as a ``cast()`` replacement, but with actual checking of the value\n#. Code instrumentation:\n\n   * entire modules, or individual functions (via ``@typechecked``) are recompiled, with\n     type checking code injected into them\n   * automatically checks function arguments, return values and assignments to annotated\n     local variables\n   * for generator functions (regular and async), checks yield and send values\n   * requires the original source code of the instrumented module(s) to be accessible\n\nTwo options are provided for code instrumentation:\n\n#. the ``@typechecked`` function:\n\n   * can be applied to functions individually\n#. the import hook (``typeguard.install_import_hook()``):\n\n   * automatically instruments targeted modules on import\n   * no manual code changes required in the target modules\n   * requires the import hook to be installed before the targeted modules are imported\n   * may clash with other import hooks\n\nSee the documentation_ for further information.\n\n.. _documentation: https://typeguard.readthedocs.io/en/latest/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Run-time type checker for Python",
    "version": "4.2.1",
    "project_urls": {
        "Change log": "https://typeguard.readthedocs.io/en/latest/versionhistory.html",
        "Documentation": "https://typeguard.readthedocs.io/en/latest/",
        "Issue tracker": "https://github.com/agronholm/typeguard/issues",
        "Source code": "https://github.com/agronholm/typeguard"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d959e02336eb478ccdfc9bb0d4c27ce04a4260cd8b45aa04f6b00bcfdbb66a2a",
                "md5": "d61c7b3e31e65b5807de09586be27f38",
                "sha256": "7da3bd46e61f03e0852f8d251dcbdc2a336aa495d7daff01e092b55327796eb8"
            },
            "downloads": -1,
            "filename": "typeguard-4.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d61c7b3e31e65b5807de09586be27f38",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 34634,
            "upload_time": "2024-03-24T08:06:15",
            "upload_time_iso_8601": "2024-03-24T08:06:15.936147Z",
            "url": "https://files.pythonhosted.org/packages/d9/59/e02336eb478ccdfc9bb0d4c27ce04a4260cd8b45aa04f6b00bcfdbb66a2a/typeguard-4.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e0e96ec359939521f8c3e6c7b69526afab96fafe0520b5e1b890e061a66abc9",
                "md5": "b09323026044615970d3150a79bcc7ca",
                "sha256": "c556a1b95948230510070ca53fa0341fb0964611bd05d598d87fb52115d65fee"
            },
            "downloads": -1,
            "filename": "typeguard-4.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b09323026044615970d3150a79bcc7ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 71292,
            "upload_time": "2024-03-24T08:06:18",
            "upload_time_iso_8601": "2024-03-24T08:06:18.233645Z",
            "url": "https://files.pythonhosted.org/packages/6e/0e/96ec359939521f8c3e6c7b69526afab96fafe0520b5e1b890e061a66abc9/typeguard-4.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 08:06:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "agronholm",
    "github_project": "typeguard",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "typeguard"
}
        
Elapsed time: 0.21620s