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 →
Top 23 Python Code Analysis Projects
-
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.
-
scalene
Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python with AI-powered optimization proposals
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
coala
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.
-
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.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
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(+)
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?
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.
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: 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.
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
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.
vulture – Find dead Python code
Project mention: Open source versus Microsoft: The new rebellion begins | news.ycombinator.com | 2024-04-15One 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!)
Project mention: Show HN: Multilspy – A library to easily use language servers to analyze code | news.ycombinator.com | 2023-11-28
Python Code Analysis related posts
-
This Week In Python
-
Google lays off its Python team
-
Pylyzer – A fast static code analyzer and language server for Python
-
How to setup Black and pre-commit in python for auto text-formatting on commit
-
Enhance Your Project Quality with These Top Python Libraries
-
Let's meet Black: Python Code Formatting
-
Show HN: Visualize the Entropy of a Codebase with a 3D Force-Directed Graph
-
A note from our sponsor - InfluxDB
www.influxdata.com | 10 May 2024
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