typeguard


Nametypeguard JSON
Version 4.4.1 PyPI version JSON
download
home_pageNone
SummaryRun-time type checker for Python
upload_time2024-11-03 12:15:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
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.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Alex Gr\u00f6nholm <alex.gronholm@nextday.fi>",
    "download_url": "https://files.pythonhosted.org/packages/62/c3/400917dd37d7b8c07e9723f3046818530423e1e759a56a22133362adab00/typeguard-4.4.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.4.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": "f2539465dedf2d69fe26008e7732cf6e0a385e387c240869e7d54eed49782a3c",
                "md5": "a7bb892198bda4246b3e2d31e085a0ea",
                "sha256": "9324ec07a27ec67fc54a9c063020ca4c0ae6abad5e9f0f9804ca59aee68c6e21"
            },
            "downloads": -1,
            "filename": "typeguard-4.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a7bb892198bda4246b3e2d31e085a0ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 35635,
            "upload_time": "2024-11-03T12:15:00",
            "upload_time_iso_8601": "2024-11-03T12:15:00.391594Z",
            "url": "https://files.pythonhosted.org/packages/f2/53/9465dedf2d69fe26008e7732cf6e0a385e387c240869e7d54eed49782a3c/typeguard-4.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62c3400917dd37d7b8c07e9723f3046818530423e1e759a56a22133362adab00",
                "md5": "842237266846dbb102b7239fcf4faeb6",
                "sha256": "0d22a89d00b453b47c49875f42b6601b961757541a2e1e0ef517b6e24213c21b"
            },
            "downloads": -1,
            "filename": "typeguard-4.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "842237266846dbb102b7239fcf4faeb6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 74959,
            "upload_time": "2024-11-03T12:15:01",
            "upload_time_iso_8601": "2024-11-03T12:15:01.913856Z",
            "url": "https://files.pythonhosted.org/packages/62/c3/400917dd37d7b8c07e9723f3046818530423e1e759a56a22133362adab00/typeguard-4.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-03 12:15:01",
    "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.59457s