Python Code Analysis

Open-source Python projects categorized as Code Analysis

Top 23 Python Code Analysis Projects

  • black

    The uncompromising Python code formatter

  • Project mention: How to setup Black and pre-commit in python for auto text-formatting on commit | dev.to | 2024-03-29

    $ git commit -m "add pre-commit configuration" [INFO] Initializing environment for https://github.com/psf/black. [INFO] Installing environment for https://github.com/psf/black. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... black................................................(no files to check)Skipped [main 6e21eab] add pre-commit configuration 1 file changed, 7 insertions(+)

  • YouCompleteMe

    A code-completion engine for Vim

  • Project mention: How to configure vim like an IDE | /r/vim | 2023-06-27

    For vim specifically, I've been using coc.nvim, which works pretty well for my needs, and I know its quite popular. Another fairly popular one is YouCompleteMe, which I had taken a look at for some other languages; but ended up just using coc as I can't justify using YCM once a year (if that) -- too much "headache" for not a lot of use, you know?

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • yapf

    A formatter for Python files

  • Project mention: Enhance Your Project Quality with These Top Python Libraries | dev.to | 2024-03-18

    YAPF (Yet Another Python Formatter): YAPF takes a different approach in that it’s based off of ‘clang-format’, a popular formatter for C++ code. YAPF reformats Python code so that it conforms to the style guide and looks good.

  • scalene

    Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python with AI-powered optimization proposals

  • Project mention: Memray – A Memory Profiler for Python | news.ycombinator.com | 2024-02-10

    I collected a list of profilers (also memory profilers, also specifically for Python) here: https://github.com/albertz/wiki/blob/master/profiling.md

    Currently I actually need a Python memory profiler, because I want to figure out whether there is some memory leak in my application (PyTorch based training script), and where exactly (in this case, it's not a problem of GPU memory, but CPU memory).

    I tried Scalene (https://github.com/plasma-umass/scalene), which seems to be powerful, but somehow the output it gives me is not useful at all? It doesn't really give me a flamegraph, or a list of the top lines with memory allocations, but instead it gives me a listing of all source code lines, and prints some (very sparse) information on each line. So I need to search through that listing now by hand to find the spots? Maybe I just don't know how to use it properly.

    I tried Memray, but first ran into an issue (https://github.com/bloomberg/memray/issues/212), but after using some workaround, it worked now. I get a flamegraph out, but it doesn't really seem accurate? After a while, there don't seem to be any new memory allocations at all anymore, and I don't quite trust that this is correct.

    There is also Austin (https://github.com/P403n1x87/austin), which I also wanted to try (have not yet).

    Somehow this experience so far was very disappointing.

    (Side node, I debugged some very strange memory allocation behavior of Python before, where all local variables were kept around after an exception, even though I made sure there is no reference anymore to the exception object, to the traceback, etc, and I even called frame.clear() for all frames to really clear it. It turns out, frame.f_locals will create another copy of all the local variables, and the exception object and all the locals in the other frame still stay alive until you access frame.f_locals again. At that point, it will sync the f_locals again with the real (fast) locals, and then it can finally free everything. It was quite annoying to find the source of this problem and to find workarounds for it. https://github.com/python/cpython/issues/113939)

  • isort

    A Python utility / library to sort imports.

  • Project mention: Enhance Your Project Quality with These Top Python Libraries | dev.to | 2024-03-18

    isort: This library sorts your imports alphabetically, and automatically separates them into sections and by type. It provides a cleaner and more organised way to manage project imports.

  • pytype

    A static type analyzer for Python code

  • Project mention: Google lays off its Python team | news.ycombinator.com | 2024-04-27

    it's open source! check out https://github.com/google/pytype and https://github.com/google/pytype/blob/main/docs/developers/t... for more on the multi-file runner

  • typeshed

    Collection of library stubs for Python, with static types

  • Project mention: What's the point of using `Any` in Union, such as `str | Any` | /r/learnpython | 2023-08-17

    "csv.pyi is from VS Code Pylance extension" is misleading. Yes, it's included in the code base of the extension, but it's likely originally from python/typeshed. I diffed csv.pyi in the extension and the repository, and they're exactly the same.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • vprof

    Visual profiler for Python

  • code2flow

    Pretty good call graphs for dynamic languages

  • coala

    coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

  • vulture

    Find dead Python code

  • Project mention: This Week In Python | dev.to | 2024-05-10

    vulture – Find dead Python code

  • wemake-python-styleguide

    The strictest and most opinionated python linter ever!

  • ycmd

    A code-completion & code-comprehension server

  • pylance-release

    Documentation and issues for Pylance

  • Project mention: Open source versus Microsoft: The new rebellion begins | news.ycombinator.com | 2024-04-15

    One of the things that comes to mind here is the fact that the default Python extension for VS Code is, perhaps surprisingly to many, not open source. https://github.com/microsoft/pylance-release

    While it's possible to fork VS Code, it is not possible to fork VS Code and provide a seamless onramp towards a Python editing experience that is fully open source, because users are used to the nuances of the closed-source Pylance experience in VS Code proper. You could use the minified/compiled Pylance plugin in your fork, but you'd have no way to expand its capabilities to new hooks your fork provides. Microsoft's development process would always be able to move faster than a fork, because it could coordinate VS Code internal API development with its internal Pylance team, and could become incompatible with forks at any time.

    It's worth re-reading the quote from J Allard in https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis... with this modern example in mind.

    (Also worth mentioning https://github.com/detachhead/basedpyright?tab=readme-ov-fil... which is a heroic effort to derisk this, but it's an uphill battle for sure!)

  • pydeps

    Python Module Dependency graphs

  • pyannotate

    Auto-generate PEP-484 annotations

  • git-fame

    :star: Pretty-print `git` repository collaborators sorted by contributions

  • lancer

    Turn your python code into a hideous mess. Ever heard of Black? This is the opposite.

  • tokei-pie

    Render tokei's output to interactive sunburst chart.

  • monitors4codegen

    Code and Data artifact for NeurIPS 2023 paper - "Monitor-Guided Decoding of Code LMs with Static Analysis of Repository Context". `multispy` is a lsp client library in Python intended to be used to build applications around language servers.

  • Project mention: Show HN: Multilspy – A library to easily use language servers to analyze code | news.ycombinator.com | 2023-11-28
  • chainjacking

    Find which of your direct GitHub dependencies is susceptible to RepoJacking attacks

  • cookiecutter-cpp-project

    A cookiecutter for a C++ Project with lots of configuration options

  • smart-imports

    smart imports for Python

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020).

Python Code Analysis related posts

  • This Week In Python

    5 projects | dev.to | 10 May 2024
  • Google lays off its Python team

    4 projects | news.ycombinator.com | 27 Apr 2024
  • Pylyzer – A fast static code analyzer and language server for Python

    6 projects | news.ycombinator.com | 11 Apr 2024
  • How to setup Black and pre-commit in python for auto text-formatting on commit

    3 projects | dev.to | 29 Mar 2024
  • Enhance Your Project Quality with These Top Python Libraries

    16 projects | dev.to | 18 Mar 2024
  • Let's meet Black: Python Code Formatting

    2 projects | dev.to | 7 Feb 2024
  • Show HN: Visualize the Entropy of a Codebase with a 3D Force-Directed Graph

    6 projects | news.ycombinator.com | 31 Jan 2024
  • A note from our sponsor - InfluxDB
    www.influxdata.com | 10 May 2024
    Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality. Learn more →

Index

What are some of the best open-source Code Analysis projects in Python? This list will help you:

Project Stars
1 black 37,456
2 YouCompleteMe 25,284
3 yapf 13,663
4 scalene 11,191
5 isort 6,325
6 pytype 4,617
7 typeshed 4,089
8 vprof 3,948
9 code2flow 3,709
10 coala 3,520
11 vulture 3,068
12 wemake-python-styleguide 2,431
13 ycmd 1,683
14 pylance-release 1,653
15 pydeps 1,618
16 pyannotate 1,409
17 git-fame 587
18 lancer 253
19 tokei-pie 168
20 monitors4codegen 108
21 chainjacking 53
22 cookiecutter-cpp-project 49
23 smart-imports 39

Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com