Performant type-checking for python.

Overview

lint tests pyre

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally – providing instantaneous feedback to developers as they write code.

Pyre ships with Pysa, a security focused static analysis tool we've built on top of Pyre that reasons about data flows in Python applications. Please refer to our documentation to get started with our security analysis.

Requirements

To get started, you need Python 3.6 or later and watchman working on your system. On MacOS you can get everything with homebrew:

$ brew install python3 watchman

On Ubuntu, Mint, or Debian; use apt-get:

$ sudo apt-get install python3 python3-pip watchman

We tested Pyre on Ubuntu 16.04 LTS, CentOS 7, as well as OSX 10.11 and later.

Setting up a Project

We start by creating an empty project directory and setting up a virtual environment:

$ mkdir my_project && cd my_project
$ python3 -m venv ~/.venvs/venv
$ source ~/.venvs/venv/bin/activate
(venv) $ pip install pyre-check

Next, we teach Pyre about our new project:

(venv) $ pyre init

This command will set up a configuration for Pyre (.pyre_configuration) as well as watchman (.watchmanconfig) in your project's directory. Accept the defaults for now – you can change them later if necessary.

Running Pyre

We are now ready to run Pyre:

(venv) $ echo "i: int = 'string'" > test.py
(venv) $ pyre
 ƛ Found 1 type error!
test.py:1:0 Incompatible variable type [9]: i is declared to have type `int` but is used as type `str`.

This first invocation will start a daemon listening for filesystem changes – type checking your project incrementally as you make edits to the code. You will notice that subsequent invocations of pyre will be faster than the first one.

For more detailed documentation, see https://pyre-check.org.

Join the Pyre community

See CONTRIBUTING.md for how to help out.

License

Pyre is licensed under the MIT license.

Comments
  • Adds python script and github action for testing Pysa

    Adds python script and github action for testing Pysa

    Adds python script which compares the issues pysa detects in delibrately_vulnerable_app and raise exceptions (return an error) when there is a mismatch. The output is also out and compared with diff if there is a mismatch.

    Adds a github action called pysa that compiles pyre-check from the source code in the repository using ocaml, opam, and dune, runs setup.sh, and the run_integration_tests.py python script.

    Modifies ./scripts/setup.py to build a Makefile without tests.

    Significant attention has been given to make sure we cache as many dependencies as possible thereby making sure the action can run as quickly as possible.

    Adds full_results.json that will contain issues known to be true in the app. For now, it's just issues from rce.py, but can be expanded later on as more vulnerabilities are added to the flask app.

    The python script, run_integration_tests.py uses integration_test_utils.py to reads issues in resulsts.expected, run pysa, compare issues generated by pysa against those specified manually.

    run_integration_tests.py and its supporting integration_test_utils.py script reside at a new folder: ./tools/integration_tests/.

    Modifies .pyre_configuration to exclude checking the folder.

    Adds .gitignore containing list of directories generated by running pysa and those files generated by running run_integration_tests.py

    Modifies setup.sh to tailor to the github actions by creating a .pyre_configuration file with taint_models_path pointing to ../../stubs and copy the integration test utils to the folder of the delibrately_vulnerable_flask_app. setup.sh is referenced during the github action as mentioned above.

    Adds requirements.txt to contain requirements for the flask app. Currently it contains only flask but will be expanded later when more vulnerabilities are added to flask app.

    Fixes https://github.com/MLH-Fellowship/pyre-check/issues/11

    CLA Signed Merged 
    opened by abishekvashok 59
  • Bump acorn from 5.7.3 to 5.7.4 in /tools/sapp/ui/frontend

    Bump acorn from 5.7.3 to 5.7.4 in /tools/sapp/ui/frontend

    Bumps acorn from 5.7.3 to 5.7.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    CLA Signed dependencies 
    opened by dependabot[bot] 46
  • Adds a pysa quick start command: init-pya

    Adds a pysa quick start command: init-pya

    Adds a pysa quick command: init-pysa, that helps users setup a suitable environment to run pysa. It handles commonly found issues in pysa and creates the best possible environment while handling some of the edge cases.

    Test Plan

    • create (or enter into the directory of) a python project you'd like to run pysa on
    • install pyre from source (see installation docs) (suitably create an alias for the client)
    • run pyre init-pysa

    Preview: Preview

    Signed-off-by: Abishek V Ashok [email protected] Fixes: https://github.com/MLH-Fellowship/pyre-check/issues/80

    CLA Signed Merged 
    opened by abishekvashok 34
  • Bump lodash from 4.17.15 to 4.17.19 in /tools/sapp/ui/frontend

    Bump lodash from 4.17.15 to 4.17.19 in /tools/sapp/ui/frontend

    Bumps lodash from 4.17.15 to 4.17.19.

    Release notes

    Sourced from lodash's releases.

    4.17.16

    Commits
    Maintainer changes

    This version was pushed to npm by mathias, a new releaser for lodash since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    CLA Signed dependencies 
    opened by dependabot[bot] 34
  • Sinks and type definitions for the mysql.connector

    Sinks and type definitions for the mysql.connector

    Here are the sinks and the type definitions for the mysql.connector. With these files, Pyre is able to find all three SQL injection vulnerabilities in the following example: unsafe-mysql-py.zip

    Fixes https://github.com/facebook/pyre-check/issues/411

    CLA Signed Merged 
    opened by maximmasiutin 31
  • Creating Pysa language server (temporary copy of Pyre's server)

    Creating Pysa language server (temporary copy of Pyre's server)

    Creating a copy of Pyre's language server and server handler for Pysa. After having two separate language server classes, I will introduce logic for the -tool command that will use a different language server based on arguments passed with the persistent command.

    CLA Signed Merged 
    opened by saydus 30
  • refactored pysa_server.py to stage for Pysa's Language Server specific changes

    refactored pysa_server.py to stage for Pysa's Language Server specific changes

    Expected outcome for this PR is to display and highlight errors for .pysa files, via the Pysa VSCode Extension. This is part of the larger issue of creating a VSCode extension for Pysa in the MLH-Fellowship program listed here and has been discussed with @gbleaney before.

    Possible milestones:

    • [X] Make template extension code for Pysa by cloning Pyre
    • [X] Add new functions necessary for handling model validation errors to pysa_server.py and persistent.py
    • [X] Connect everything and call get_invalid_taint_models() in query.py
    • [X] Make relevant changes on the extension side
    • [x] Clean up the server of old Pyre code

    Output so far: image

    Errors are being calculated but are not being published due to server_state.opened_documents list being empty as show in the output. The publishing diagnostics function iterates over this list and sends the errors to VSCode. It's empty right now and hence, the errors are never published. (Opening/closing documents is not being detected)

    CLA Signed Merged 
    opened by m0mosenpai 25
  • pyre 0.0.23 and 0.0.24 crashing with SharedMemory exception

    pyre 0.0.23 and 0.0.24 crashing with SharedMemory exception

    0.0.22 is not crashing, however. This is on an Ubuntu 18.04 (x64) system using Python 3.7.3

    Here's the output I see on a --debug run of 0.0.24:

    2019-04-29 09:51:04,729 WARNING Could not parse 22 external files due to syntax errors!
    2019-04-29 09:51:04,829 PERFORMANCE Stubs parsed: 8.907000s
    2019-04-29 09:51:40,474 INFO Parsing 136 sources in `/redacted`...
    2019-04-29 09:51:40,577 PERFORMANCE Sources parsed: 0.142000s
    2019-04-29 09:51:40,578 PERFORMANCE Registered ignores: 0.063000s
    2019-04-29 09:51:40,580 INFO Adding environment information to shared memory...
    2019-04-29 09:51:40,580 PERFORMANCE Added environment to shared memory: 0.001000s
    2019-04-29 09:51:40,681 INFO Building type environment...
    2019-04-29 09:53:57,634 ERROR Client exited with error code 1:
    Exception: SharedMem.C_assertion_failure("hh_shared.c : 1072")
    Potential backtrace:
    Raised at file "map.ml", line 131, characters 10-25
    Called from file "sexp_conv.ml", line 148, characters 10-37
    Worker exited (code: 2)
    Exception: SharedMem.C_assertion_failure("hh_shared.c : 1072")
    Potential backtrace:
    Raised at file "map.ml", line 131, characters 10-25
    Called from file "sexp_conv.ml", line 148, characters 10-37
    Worker exited (code: 2)
    Exception: SharedMem.C_assertion_failure("hh_shared.c : 1072")
    Potential backtrace:
    Raised at file "map.ml", line 131, characters 10-25
    Called from file "sexp_conv.ml", line 148, characters 10-37
    Worker exited (code: 2)
    Exception: SharedMem.C_assertion_failure("hh_shared.c : 1072")
    Potential backtrace:
    Raised at file "map.ml", line 131, characters 10-25
    Called from file "sexp_conv.ml", line 148, characters 10-37
    Worker exited (code: 2)
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    Worker interrupted with signal: sigpipe
    

    Let me know if I can provide any more info. I've reverted to 0.0.22 to continue using pyre in the meanwhile.

    opened by dseevr 25
  • Modify pyre sandbox to add support for Pysa

    Modify pyre sandbox to add support for Pysa

    Modifies pyre sandbox and adds in support for running pysa. This is done by modifying how the Pyre object is created and by adding an additional analyze endpoint to the flask app. Adds support for adding user-defined as well as the open source models for pysa.

    Signed-off-by: Abishek V Ashok [email protected]

    Test Plan

    • Pull in #509 and then build the frontend with
    cd documentation/website
    yarn install
    yarn start
    
    • Build and run the backend in a virtual environment:
    python3 -m venv ~/venvs/sandbox
    source ~/venvs/sandbox/bin/activate
    cd tools/sandbox
    export PYSA_PLAYGROUND_STUBS=<path-to-your-pyre-check-repo>/stubs
    pip3 install -r requirements.txt
    python3 application.py --debug
    
    • Goto http://localhost:3000/pysa-playground and play around in the playground

    Signed-off-by: Abishek V Ashok [email protected] Fixes https://github.com/MLH-Fellowship/pyre-check/issues/79

    CLA Signed Merged 
    opened by abishekvashok 23
  • Adds publishable github action for pysa

    Adds publishable github action for pysa

    Adds publishable github action that others can include into their github actions that enables users to run pysa via github actions.

    The action is a composite github action that installs pyre-check, runs pysa, and expose the results in SARIF format by creating sarif.json at the repository root using fb-sapp.

    Adds instructions to run the action in documentation/pysa_github_action/README.md

    Signed-off-by: Abishek V Ashok [email protected] Fixes: https://github.com/MLH-Fellowship/pyre-check/issues/13

    See it in action: https://github.com/abishekvashok/zulip/actions/runs/1149735960

    CLA Signed 
    opened by abishekvashok 21
  • Add flask_mysql cursor execute as sink

    Add flask_mysql cursor execute as sink

    I'm testing Pysa to detect vulnerabilities in my flask web application, but i can't add flask_mysqldb commands as Pysa sinks. If i run pyre analyze --no-verify Pysa doesn't detect this as a vulnerability

    from flask_mysqldb import MySQL
    
    db = MySQL(app)
    
    email = request.form['email']
    cursor = db.connection.cursor()
    
    query = "SELECT * FROM accounts WHERE email ='"+email+"'"
    cursor.execute(query)
    

    Should i add a new sink in .pysa files in taint folder ?

    opened by pzsette 21
  • Short form Enum('Color', ['Red', 'Blue']) does not work

    Short form Enum('Color', ['Red', 'Blue']) does not work

    Pyre Bug

    Bug description Pyre doesn't understand the two argument form of enum.Enum

    Reproduction steps

    import enum
    
    Color = enum.Enum('Color', ['Red', 'Blue'])
    print(Color.Red)
    

    Expected behavior It typechecks

    Logs

    $ pyre
    ƛ Found 2 type errors!
    a.py:3:8 Too many arguments [19]: Call `enum.Enum.__new__` expects 1 positional argument, 2 were provided.
    a.py:4:6 Undefined attribute [16]: `enum.Enum` has no attribute `Red`.
    

    Rage: https://gist.github.com/a5ac7a79e8896f73521a02e91838bec2

    opened by ezyang 0
  • Type narrowing with isinstance doesn't work when the first argument is a walrus-operator assignment

    Type narrowing with isinstance doesn't work when the first argument is a walrus-operator assignment

    Bug description As pyre is quite strict with the type narrowing of non-final attributes (which I don't mind), I want to use the walrus operator to make the type narrowing more convenient, but it doesn't seem to play nice with isinstance().

    Reproduction steps

    from dataclasses import dataclass
    
    @dataclass
    class A:
        x: str | int
    
        def f(self) -> int:
            if isinstance(y := self.x, int):
                reveal_type(y)  # Revealed type for `y` is `typing.Union[int, str]`.
                reveal_type(self.x)  # Revealed type for `self.x` is `typing.Union[int, str]`.
                return y + 2  # Error: `+` is not supported for operand types `typing.Union[int, str]` and `int`.
            return 0
    

    Expected behavior The type of y should be int because I just narrowed it.

    Actual behavior The type of y is not narrowed.

    Additional context It works fine in mypy and pyright.

    Furthermore, the following works fine in pyre:

    from dataclasses import dataclass
    
    @dataclass
    class B:
        x: str | int
    
        def f(self) -> int:
            y = self.x
            if isinstance(y, int):
                reveal_type(y)  # Revealed type for `y` is `int`.
                reveal_type(self.x)  # Revealed type for `self.x` is `typing.Union[int, str]`.
                return y + 2
            return 0
    

    pyre version

    Binary version: d4aef6ea269d577faf9a2a503032fda33f725936
    Client version: 0.9.17
    
    opened by thomkeh 1
  • Allow pyre to read configuration from pyproject.toml

    Allow pyre to read configuration from pyproject.toml

    Pyre Feature Request

    Having custom config files for each tool is fine. Since most tools use pyproject.toml file for configuration, if pyre supports configuration using it, it would be great.

    opened by ChillarAnand 0
  • Overloaded decorators can hide parameters with default values

    Overloaded decorators can hide parameters with default values

    Pyre Bug

    Bug description

    Some decorators change the type of the decorated function's inputs. Because there is no easy way to describe a "mapping" over a ParamSpec, such decorators may be typed with a series of overloads, one for each number of parameters up to a reasonable maximum:

    @overload
    def boxed_args(
        func: Callable[[_P1], _R],
    ) -> Callable[[Box[_P1]], _R]:
        pass
    
    @overload
    def boxed_args(
        func: Callable[[_P1, _P2], _R],
    ) -> Callable[[Box[_P1], Box[_P2]], _R]:
        pass
    
    @overload
    def boxed_args(
        func: Callable[[_P1, _P2, _P3], _R],
    ) -> Callable[[Box[_P1], Box[_P2], Box[_P3]], _R]:
        pass
    
    ...
    

    When such a decorator is applied to a function with default values for one or more parameters, Pyre selects the first matching overload for the decorator, i.e. the overload with only the required parameters. It then forgets about the parameters with default values:

    # inferred type (Box[str]) -> None
    @boxed_args
    def takes_str_and_default_int_decorated(p1: str, p2: int = 404) -> None:
        print(p1, p2)
    
    # does not typecheck
    takes_str_and_default_int_decorated(Box("Luc"), Box(0))
    

    Reproduction steps

    Complete example on GitHub

    Inline:
    #!/usr/bin/env python3
    
    from abc import ABC
    from functools import wraps
    from typing import Any, Callable, Generic, TypeVar, overload
    
    _T = TypeVar('_T')
    
    
    class Box(ABC, Generic[_T]):
        def __init__(self, value: _T):
            self.value = value
    
    
    _P1 = TypeVar('_P1')
    _P2 = TypeVar('_P2')
    _P3 = TypeVar('_P3')
    _R = TypeVar('_R')
    
    
    @overload
    def boxed_args(
        func: Callable[[_P1], _R],
    ) -> Callable[[Box[_P1]], _R]:
        pass
    
    
    @overload
    def boxed_args(
        func: Callable[[_P1, _P2], _R],
    ) -> Callable[[Box[_P1], Box[_P2]], _R]:
        pass
    
    
    @overload
    def boxed_args(
        func: Callable[[_P1, _P2, _P3], _R],
    ) -> Callable[[Box[_P1], Box[_P2], Box[_P3]], _R]:
        pass
    
    
    def boxed_args(func: Callable[..., _R]) -> Callable[..., _R]:
        @wraps(func)
        def wrapper(*args: Any) -> _R:
            return func(*(arg.value for arg in args))
    
        return wrapper
    
    
    def takes_str_and_default_int(p1: str, p2: int = 404) -> None:
        print(p1, p2)
    
    
    @boxed_args
    def takes_str_and_default_int_decorated(p1: str, p2: int = 404) -> None:
        print(p1, p2)
    
    
    if __name__ == '__main__':
        # typechecks successfully
        takes_str_and_default_int("Typechecker", 1)
        # does not typecheck
        takes_str_and_default_int_decorated(Box("Luc"), Box(0))
    

    Install Pyre (I'm using it through Poetry, with poetry add --group dev pyre-check; poetry run pyre init). Run with pyre (or poetry run pyre).

    Expected behavior

    The inferred type for the decorated function should be overloaded based on each matching overload of the decorator. In the example above, the decorated function should have a type equivalent to (Box[str]) -> None overloaded with (Box[str], Box[int]) -> None.

    Logs

    ƛ No watchman binary found.
    To enable pyre incremental, you can install watchman: https://facebook.github.io/watchman/docs/install
    ƛ Defaulting to non-incremental check.
    ƛ Found 1 type error!
    sandbox/__init__.py:63:4 Too many arguments [19]: PositionalOnly call expects 1 positional argument, 2 were provided.
    

    pyre_rage.log

    Additional context

    mypy and Pyright both have very similar bugs; discussion at python/mypy#14144 and microsoft/pyright#4211 may be relevant if this is a weakness in the Python type system rather than in Pyre's implementation.

    opened by wlritchi 0
  • Update full_result.json

    Update full_result.json

    Pre-submission checklist

    • [ ] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
    • [ ] pre-commit run

    Summary

    Test Plan

    CLA Signed 
    opened by litho17 0
Releases(v0.9.11)
  • v0.9.11(Apr 20, 2022)

    • Better source location if there are type errors within type comments.
    • Basic support for PEP 681 (dataclass transforms).
    • Prototype support for LSP hovering and goto-definition (needs to opt-in via configuration but this may change in the future).
    • Basic support for PEP 561 (needs to opt-in via configuration but this may change in the future).
    • Parsing is now performed lazily. This should significantly reduce the type checking time for small projects.
    Source code(tar.gz)
    Source code(zip)
  • v0.9.10(Jan 11, 2022)

    • Fixed parser crashes on files with non-utf codec.
    • Fixed bad JSON error in setup.py.
    • Various fixes regarding tuple expansions at callsites.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.59(Jan 15, 2021)

    Incomprehensive list of changes since last release:

    • Add support for generic type aliases.
    • Experimental support for recursive type aliases.
    • Deprecated several queries that are no longer actively maintained.
    • Automatically add all site packages to search_path if none is specified and a virtual env is activated.
    Source code(tar.gz)
    Source code(zip)
  • v0.0.56(Sep 25, 2020)

  • v0.0.55(Sep 18, 2020)

  • v0.0.54(Sep 16, 2020)

  • v0.0.38(Dec 19, 2019)

  • v0.0.30(Aug 7, 2019)

    Biggest changes since last release (non-exhaustive):

    • Fixed support for nested recursive function.
    • Fixed several issues where the type of globally-accessible values are erroneously locally refined.
    • Support batch type lookup query pyre query "types(...)".
    • Support basic variadic generics on functions & classes.
    • Added a safe_cast that functions similar to typing.cast but enforces subclass.
    • Fixed several issues with search path construction & error filtering.
    • search_path configuration now allows entries of the form { "site-package": "XXX" }
    • Support specifying relative paths in binary, typeshed, and ignore_all_errors.
    • Special placeholder ${SOURCE_DIRECTORY} can be added to exclude configuration to allow relative path matching in exclude configuration.
    • Improved the quality of pyre-infer annotations.
    • sapp is no longer bundled.
    Source code(tar.gz)
    Source code(zip)
Owner
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
Facebook
Inspects Python source files and provides information about type and location of classes, methods etc

prospector About Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and comple

Python Code Quality Authority 1.7k Dec 31, 2022
A system for Python that generates static type annotations by collecting runtime types

MonkeyType MonkeyType collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type

Instagram 4.1k Jan 2, 2023
A static type analyzer for Python code

pytype - ? ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Static type checker for Python

Static type checker for Python Speed Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fas

Microsoft 9.4k Jan 7, 2023
Data parsing and validation using Python type hints

pydantic Data validation and settings management using Python type hinting. Fast and extensible, pydantic plays nicely with your linters/IDE/brain. De

Samuel Colvin 12.1k Jan 5, 2023
Run-time type checker for Python

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. Four principal ways to do type

Alex Grönholm 1.1k Dec 19, 2022
pycallgraph is a Python module that creates call graphs for Python programs.

Project Abandoned Many apologies. I've stopped maintaining this project due to personal time constraints. Blog post with more information. I'm happy t

gak 1.7k Jan 1, 2023
Turn your Python and Javascript code into DOT flowcharts

Notes from 2017 This is an older project which I am no longer working on. It was built before ES6 existed and before Python 3 had much usage. While it

Scott Rogowski 3k Jan 9, 2023
Find dead Python code

Vulture - Find dead code Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code bases. If you r

Jendrik Seipp 2.4k Jan 3, 2023
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 966 Dec 29, 2022
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 5, 2023
The uncompromising Python code formatter

The Uncompromising Code Formatter “Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over

Python Software Foundation 30.7k Dec 28, 2022
A Python utility / library to sort imports.

Read Latest Documentation - Browse GitHub Code Repository isort your imports, so you don't have to. isort is a Python utility / library to sort import

Python Code Quality Authority 5.5k Jan 6, 2023
A formatter for Python files

YAPF Introduction Most of the current formatters for Python --- e.g., autopep8, and pep8ify --- are made to remove lint errors from code. This has som

Google 13k Dec 31, 2022
Collection of library stubs for Python, with static types

typeshed About Typeshed contains external type annotations for the Python standard library and Python builtins, as well as third party packages as con

Python 3.3k Jan 2, 2023
Optional static typing for Python 3 and 2 (PEP 484)

Mypy: Optional Static Typing for Python Got a question? Join us on Gitter! We don't have a mailing list; but we are always happy to answer questions o

Python 14.4k Jan 5, 2023
A static analysis tool for Python

pyanalyze Pyanalyze is a tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some catego

Quora 212 Jan 7, 2023
Typing-toolbox for Python 3 _and_ 2.7 w.r.t. PEP 484.

Welcome to the pytypes project pytypes is a typing toolbox w.r.t. PEP 484 (PEP 526 on the road map, later also 544 if it gets accepted). Its main feat

Stefan Richthofer 188 Dec 29, 2022
Typical: Fast, simple, & correct data-validation using Python 3 typing.

typical: Python's Typing Toolkit Introduction Typical is a library devoted to runtime analysis, inference, validation, and enforcement of Python types

Sean 170 Dec 26, 2022