[![Tests](https://github.com/ricardojob/PSASpotter/actions/workflows/tests.yaml/badge.svg)](https://github.com/ricardojob/PSASpotter/actions/workflows/tests.yaml)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/psaspotter)](https://pypi.org/project/psaspotter/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7025599.svg)](https://doi.org/10.5281/zenodo.14029218)
[![License](https://img.shields.io/badge/License-MIT-blue)](LICENSE.txt)
<!-- ![Maven](https://github.com/VariantSync/SyncStudy/actions/workflows/maven.yml/badge.svg) -->
<!-- [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7025599.svg)](https://doi.org/10.5281/zenodo.14029218)
[![Documentation](https://img.shields.io/badge/Documentation-read%20here-blue)][documentation]
[![Requirements](https://img.shields.io/badge/System%20Requirements-read%20here-blue)](INSTALL.md)
[![Install](https://img.shields.io/badge/Installation%20Instructions-read%20here-blue)](INSTALL.md)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](LICENSE) -->
# PSASpotter
An automated tool for extracting Platform-Specific API from Git repositories written in Python.
The `psaspotter` (**P**latform-**S**pecific **A**PI Spotter) is primarily designed to be used as a command-line tool.
With `psaspotter`, you can easily extract information about the Platform-Specific APIs and their usages from the Git repository or directory (only python files are analyzed).
The set of Platform-Specific APIs are saved in a given CSV file.
PSASpotter is an AST-based tool that detects API usage at the function/method level.
Given a Git project, PSASpotter analyzes all Python files and exports details of platform-specific API usage.
Specifically, for each usage, PSASpotter reports information about the analyzed project (name and commit), the used API (name and availability), and the usage location (filename, line, and GitHub link).
In addition, PSASpotter also reports whether the usage happens within defensive code.
## Install
The easiest way to install `psaspotter` is to install from Pypi
```
pip install psaspotter
```
Alternatively, you can install from `test environment`
```
pip install --index-url https://test.pypi.org/simple/ --no-deps psaspotter
```
You may wish to use this tool in a virtual environment. You can use the following commands.
```
virtualenv psaspotter_venv
source psaspotter_venv/bin/activate
pip install psaspotter
```
## Quick examples
As an example, the following command extracts every platform-specific APIs from the directory `repository_local`.
It also saves various information (line, module, filename ...) in `output.csv`.
Additionally, we can provide information about the project present in the directory provided.
For this, the parameters `-n` and `-c` can be added to inform the name (`my/local`) and last commit (`da39a3ee5e6b4b0d3255bfef95601890afd80709`) of the project.
This information will be available in the output file.
```bash
psaspotter repository_local -o output.csv -n my/local --commit da39a3ee5e6b4b0d3255bfef95601890afd80709
```
Note that the repository does not have to be already cloned, the tool also can fetch it.
For example, the GitHub repository `https://github.com/ricardojob/PSASpotter` will be fetched, saved under the `data/PSASpotter` directory.
Note that, by default all projects are cloned to the `data` directory.
```bash
psaspotter https://github.com/ricardojob/PSASpotter -o output.csv
```
## Usage
After installation, the `psaspotter` command-line tool should be available in your shell.
Otherwise, please replace `psaspotter` by `python -m psaspotter`.
The explanations in the following stays valid in both cases.
We can use PSASpotter to extract information about the usage of platform-specific in a Git repository:
```bash
psaspotter <git_repo> -o <output_file.csv>
```
The first parameter is the Git repository to be analyzed.
The parameter `-o` represents the name of the CSV output file.
You can use `psaspotter` with the following arguments:
```
-o, Output CSV file.
-c, Commit or tag to be analyzed.
-p, Platform-specific API category.
```
The CSV file given to `-o` (or that will be written to the standard output by default) will contain the following columns:
- `project_name`: Respository name
- `project_commit`: Analyzed commit
- `api_name`: Name of the used platform-specific API
- `api_availability`: Availability of the used platform-specific API
- `usage_filename`: Filename using the platform-specific API
- `usage_line`: Filename line using the platform-specific API
- `usage_github_link`: Github link to the filename and line
- `defensive_code`: Check if the API is used within defensive code
## License
Distributed under [MIT License](https://github.com/ricardojob/PSASpotter/blob/main/LICENSE.txt).
## Acknowledgements
The structure of this project was heavily inspired by the [gigawork](https://github.com/cardoeng/gigawork) and [spotflow](https://github.com/andrehora/spotflow) projects.
Raw data
{
"_id": null,
"home_page": "https://github.com/ricardojob/psaspotter",
"name": "psaspotter",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": "platform-specific api detect tool",
"author": "Ricardo Job",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ce/ba/b8240631943cb594bf9a348f8b3cc5bd0b267ce2bd954d02100e46f6587f/psaspotter-0.0.10.tar.gz",
"platform": null,
"description": "[![Tests](https://github.com/ricardojob/PSASpotter/actions/workflows/tests.yaml/badge.svg)](https://github.com/ricardojob/PSASpotter/actions/workflows/tests.yaml)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/psaspotter)](https://pypi.org/project/psaspotter/)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7025599.svg)](https://doi.org/10.5281/zenodo.14029218)\n[![License](https://img.shields.io/badge/License-MIT-blue)](LICENSE.txt)\n\n<!-- ![Maven](https://github.com/VariantSync/SyncStudy/actions/workflows/maven.yml/badge.svg) -->\n<!-- [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7025599.svg)](https://doi.org/10.5281/zenodo.14029218)\n[![Documentation](https://img.shields.io/badge/Documentation-read%20here-blue)][documentation]\n[![Requirements](https://img.shields.io/badge/System%20Requirements-read%20here-blue)](INSTALL.md)\n[![Install](https://img.shields.io/badge/Installation%20Instructions-read%20here-blue)](INSTALL.md)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](LICENSE) -->\n\n# PSASpotter\n\nAn automated tool for extracting Platform-Specific API from Git repositories written in Python. \nThe `psaspotter` (**P**latform-**S**pecific **A**PI Spotter) is primarily designed to be used as a command-line tool. \nWith `psaspotter`, you can easily extract information about the Platform-Specific APIs and their usages from the Git repository or directory (only python files are analyzed).\nThe set of Platform-Specific APIs are saved in a given CSV file.\n\nPSASpotter is an AST-based tool that detects API usage at the function/method level. \nGiven a Git project, PSASpotter analyzes all Python files and exports details of platform-specific API usage. \nSpecifically, for each usage, PSASpotter reports information about the analyzed project (name and commit), the used API (name and availability), and the usage location (filename, line, and GitHub link). \nIn addition, PSASpotter also reports whether the usage happens within defensive code.\n\n## Install\n\nThe easiest way to install `psaspotter` is to install from Pypi\n\n```\npip install psaspotter\n```\n\nAlternatively, you can install from `test environment`\n```\npip install --index-url https://test.pypi.org/simple/ --no-deps psaspotter\n```\n\nYou may wish to use this tool in a virtual environment. You can use the following commands.\n\n```\nvirtualenv psaspotter_venv\nsource psaspotter_venv/bin/activate\npip install psaspotter\n```\n\n## Quick examples\n\nAs an example, the following command extracts every platform-specific APIs from the directory `repository_local`. \nIt also saves various information (line, module, filename ...) in `output.csv`. \nAdditionally, we can provide information about the project present in the directory provided. \nFor this, the parameters `-n` and `-c` can be added to inform the name (`my/local`) and last commit (`da39a3ee5e6b4b0d3255bfef95601890afd80709`) of the project. \nThis information will be available in the output file.\n\n```bash\npsaspotter repository_local -o output.csv -n my/local --commit da39a3ee5e6b4b0d3255bfef95601890afd80709 \n```\n\nNote that the repository does not have to be already cloned, the tool also can fetch it. \nFor example, the GitHub repository `https://github.com/ricardojob/PSASpotter` will be fetched, saved under the `data/PSASpotter` directory.\nNote that, by default all projects are cloned to the `data` directory.\n\n```bash\npsaspotter https://github.com/ricardojob/PSASpotter -o output.csv\n```\n\n## Usage\n\nAfter installation, the `psaspotter` command-line tool should be available in your shell. \nOtherwise, please replace `psaspotter` by `python -m psaspotter`. \nThe explanations in the following stays valid in both cases.\n\nWe can use PSASpotter to extract information about the usage of platform-specific in a Git repository:\n\n\n```bash\npsaspotter <git_repo> -o <output_file.csv>\n```\n\nThe first parameter is the Git repository to be analyzed. \nThe parameter `-o` represents the name of the CSV output file.\n\nYou can use `psaspotter` with the following arguments:\n\n```\n -o, Output CSV file.\n -c, Commit or tag to be analyzed.\n -p, Platform-specific API category.\n```\n\nThe CSV file given to `-o` (or that will be written to the standard output by default) will contain the following columns:\n- `project_name`: Respository name\n- `project_commit`: Analyzed commit\n- `api_name`: Name of the used platform-specific API\n- `api_availability`: Availability of the used platform-specific API\n- `usage_filename`: Filename using the platform-specific API\n- `usage_line`: Filename line using the platform-specific API\n- `usage_github_link`: Github link to the filename and line\n- `defensive_code`: Check if the API is used within defensive code\n\n## License\n\nDistributed under [MIT License](https://github.com/ricardojob/PSASpotter/blob/main/LICENSE.txt).\n\n## Acknowledgements\n\nThe structure of this project was heavily inspired by the [gigawork](https://github.com/cardoeng/gigawork) and [spotflow](https://github.com/andrehora/spotflow) projects.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool for extracting of Platform-Specific APIs",
"version": "0.0.10",
"project_urls": {
"Homepage": "https://github.com/ricardojob/psaspotter"
},
"split_keywords": [
"platform-specific",
"api",
"detect",
"tool"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "96b018e1ae9073f9eade8a4e03c6748fc68238c579350be94694ad1cea16b661",
"md5": "1e497527869cde51660e59a1f04b68c6",
"sha256": "a1374242046c2291a8fa55196d77a8637a35334868fac3f806c6eb52067d0e01"
},
"downloads": -1,
"filename": "psaspotter-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e497527869cde51660e59a1f04b68c6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 42707,
"upload_time": "2024-12-03T01:40:29",
"upload_time_iso_8601": "2024-12-03T01:40:29.221580Z",
"url": "https://files.pythonhosted.org/packages/96/b0/18e1ae9073f9eade8a4e03c6748fc68238c579350be94694ad1cea16b661/psaspotter-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cebab8240631943cb594bf9a348f8b3cc5bd0b267ce2bd954d02100e46f6587f",
"md5": "61110054e6c851c4bdf58a10ecaf209f",
"sha256": "8d62fca887514cd499b2dee51b09ace856b2e1a3746d2806ff5bcd7a5c8a3c00"
},
"downloads": -1,
"filename": "psaspotter-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "61110054e6c851c4bdf58a10ecaf209f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 39678,
"upload_time": "2024-12-03T01:40:30",
"upload_time_iso_8601": "2024-12-03T01:40:30.349386Z",
"url": "https://files.pythonhosted.org/packages/ce/ba/b8240631943cb594bf9a348f8b3cc5bd0b267ce2bd954d02100e46f6587f/psaspotter-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-03 01:40:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ricardojob",
"github_project": "psaspotter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "smmap",
"specs": [
[
"==",
"5.0.1"
]
]
},
{
"name": "jsonschema",
"specs": [
[
"==",
"4.21.1"
]
]
},
{
"name": "coverage",
"specs": [
[
"==",
"6.5.0"
]
]
},
{
"name": "pytest",
"specs": []
},
{
"name": "pygments",
"specs": []
},
{
"name": "pydriller",
"specs": []
},
{
"name": "requests",
"specs": []
}
],
"lcname": "psaspotter"
}