{"id":13511823,"url":"https://github.com/yinwang0/pysonar2","last_synced_at":"2025-05-15T10:02:09.619Z","repository":{"id":11479083,"uuid":"13949084","full_name":"yinwang0/pysonar2","owner":"yinwang0","description":"PySonar2: a semantic indexer for Python with interprocedual type inference","archived":false,"fork":false,"pushed_at":"2024-10-03T18:46:42.000Z","size":9211,"stargazers_count":1405,"open_issues_count":3,"forks_count":505,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-04-11T19:57:51.633Z","etag":null,"topics":["code-analysis","code-intelligence","code-search","index","python","static-analysis","type-inference"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yinwang0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-10-29T07:20:43.000Z","updated_at":"2025-04-09T17:31:29.000Z","dependencies_parsed_at":"2024-11-28T02:01:49.836Z","dependency_job_id":"c5a55925-3a49-496f-a745-f87ade3433b6","html_url":"https://github.com/yinwang0/pysonar2","commit_stats":{"total_commits":531,"total_committers":18,"mean_commits":29.5,"dds":"0.10546139359698681","last_synced_commit":"f47662443310200755cbfa9a3bc020efc1a442de"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinwang0%2Fpysonar2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinwang0%2Fpysonar2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinwang0%2Fpysonar2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinwang0%2Fpysonar2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yinwang0","download_url":"https://codeload.github.com/yinwang0/pysonar2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319717,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-analysis","code-intelligence","code-search","index","python","static-analysis","type-inference"],"created_at":"2024-08-01T03:01:12.426Z","updated_at":"2025-05-15T10:02:08.455Z","avatar_url":"https://github.com/yinwang0.png","language":"Java","funding_links":[],"categories":["Java","资源列表","Code Analysis and Linter","VI. Program languages and applications that were written with Java"],"sub_categories":["代码分析和 Lint 工具","2. Other program languages tools that were written with Java"],"readme":"# PySonar2 - a semantic indexer for Python with interprocedural type inference\n\nPySonar2 is a semantic indexer library for Python, designed for batch processing of large code\nbases. The resulting index can be used to build code browsers and code search engines.\n\nPython is a highly dynamic language. To achieve high accuracy and quality, PySonar2 performs \ninterprocedural analysis to infer types. PySonar2 generally produces better index than Python IDEs,\nwhile at the same time sacrificing real-time update capabilities of IDEs.\n\nNotice the term \"type inference\" here is descriptive rather than prescriptive, meaning the inferred\ntypes describe how the code is actually used, but does not prescribe how they must be used. So the way\ntype inference works here is different from type systems (e.g. Hindley-Milner system).\n\nPySonar2 has been the underlying indexing engine for several large-scale code navigation services,\nsuch as Google's internal Code Search, sourcegraph.com and insight.io (now part of elastic).\n\n\u003ca href=\"http://www.yinwang.org/resources/demos/pysonar2/email/header.py.html\"\u003e\n\u003cimg src=\"http://www.yinwang.org/images/pysonar2.gif\" width=\"70%\"\u003e\n\u003c/a\u003e\n\n\n### How to build\n\n    mvn package -DskipTests\n\n\n### Demo\n\nTo have a feel of what PySonar2 produce, you can build a simple code browser of the Python 2.7\nstandard library with the following command line:\n\n    java -jar target/pysonar-\u003cversion\u003e.jar /usr/lib/python2.7 ./html\n\nThis may take a few minutes depending on your machine. You should find some interactive HTML files\ninside the _html_ directory after this process. You can move your mouse on the variables and click\non them to jump to definitions etc.\n\nNote that this is just a simple demo program based on the library. PySonar2 is not meant to be an\nend-user tool. It is mainly designed as a library for Python IDEs, developer tools and code search\nengines, so its interface may not be as appealing as an end-user tool.\n\nIf you have problems with it, please feel free to contact me.\n\n\n### System requirements\n\n* Python 2.7.x\n* Python 3.x\n* Java 8+\n* maven\n\n\n### Environment variables\n\nPySonar2 uses CPython's built-in `ast` package to parse Python code, so please make sure you have\n`python` or `python3` installed and pointed to by the `PATH` environment variable. If you have them\nin different names, please make symbol links.\n\n`PYTHONPATH` environment variable is used for locating the Python standard libraries. It is\nimportant to point it to the correct Python library, for example\n\n    export PYTHONPATH=/usr/lib/python2.7\n\nIf this is not set up correctly, references to library code will not be found.\n\n\n### Contribute\n\nYou are welcome to make code contributions.\n\nBecause of the highly complex and unpublished theory behind PySonar2, things may go wrong easily\nwith even an innocent-looking change. If you hope to contribute to PySonar2, please discuss with me\nfirst before making significant changes, otherwise I may not be able to review your changes.\n\nFor basic verification, you can run the unit tests. PySonar2 has a basic test framework. You can run\nthe tests using this command:\n\n    mvn test\n\nIf you modify the code or tests, you need to generate new expected results. Run these command lines:\n\n    mvn package -DskipTests\n    java -classpath target/pysonar-\u003cversion\u003e.jar org.yinwang.pysonar.TestInference -generate tests\n\nTo write new tests, you just need to write relevant Python code demonstrating your change, put them\ninto a directory named `tests/testname.test`(test directory name must end with \".test\"). Please look\nat the `tests` directory for examples.\n\nPlease don't expect the tests to catch all bugs. Be very careful :)\n\n\n### License\n\nApache 2.0 License. See LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyinwang0%2Fpysonar2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyinwang0%2Fpysonar2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyinwang0%2Fpysonar2/lists"}